packages = ["bokeh", "pandas", "numpy", "networkx", "diagrams", "scikit-learn", "pillow", "matplotlib", "plotly"] [[fetch]] files = ["diagrams_base.py"] from = "../../python/diagrams/" [[fetch]] files = ["pyscript_manager.py", "data.py"] to_folder = "lib" from = "../../python/lib/" [[fetch]] files = ["bokeh_utils.py"] from = "../../python/bokeh/" [[fetch]] files = ["matplotlib_utils.py", "plotly_utils.py"] from = "../../python/matplotlib/" [[fetch]] files = ["agent.py", "trainer.py", "utils.py", "metrics_chart.py", "crossover.py", "__init__.py"] to_folder = "ml/neuro" from = "../../python/ml/neuro/" [[fetch]] files = ["trainer.py"] to_folder = "ml/grokking" from = "../../python/ml/grokking/"

Loading...

Initializing Python module...

Advanced Interop - Text Encoder

This example demonstrates advanced PyScript interoperability...

πŸ” Available Encodings

  • MD5 Hash - 128-bit cryptographic hash
  • SHA-1 Hash - 160-bit cryptographic hash
  • SHA-256 Hash - 256-bit secure cryptographic hash
  • Base64 - Binary-to-text encoding
  • ROT13 Cipher - Simple letter substitution cipher

πŸ’‘ Why Python?

These operations are trivial in Python thanks to built-in libraries:

  • hashlib - Cryptographic hashing
  • base64 - Base64 encoding/decoding
  • codecs - Text encoding transformations

In JavaScript, you would need...

πŸš€ What's New: PyScriptManager

This example uses the new PyScriptManager system:

  • Event-driven - No polling
  • Instant readiness - Python signals when ready
  • Error handling - Captures errors
  • Multiple exports - 6 functions loaded

Check the browser console...

πŸ—οΈ Architecture

Clean separation of concerns:

  • Python - Uses PyScriptManager
  • Controller - Manages lifecycle
  • Svelte - Pure UI rendering

View Python source Β· View PyScriptManager

🐍 Python Console