Pyodide packaging and improving interoperability for the Scientific Python ecosystem, and advances in interactive documentation via WebAssembly and JupyterLite

Agriya Khetarpal, 20312915002

University of Delhi
Software Engineer I, Quansight Labs

Mentored by Ralf Gommers

Co-Director, Quansight Labs

The why

  • Python projects and their environments are tricky to install and manage
  • For maintainers and core developers: difficult to target various platforms and architectures
  • Slightly steep learning curve a euphemism for "learn it yourself like we all did"
  • Lower barrier to entry to learning Python, especially for new programmers

XKCD 1987

The why

  • Documentation for scientific software needs to do more
  • Some guidelines
    • Explanatory (descriptive)
    • Illustrative (graphs, diagrams, visual aids, and more)
    • Interactive (a boost to user experience)
https://diataxis.fr/

Run NumPy online

The why

  • In come Pyodide and WebAssembly
    • Python compiled via the Emscripten toolchain using LLVM to run in the browser
    • A paradigm shift towards code that is written once, and runs everywhere
      • Chromium (Google Chrome, Microsoft Edge, Brave Browser, etc.), Mozilla Firefox, Apple Safari, and even inside browsers on Android and iOS (and iPadOS too)!
    • JupyterLite provides a runtime just like standard Jupyter Notebooks
https://scikit-learn.org/stable/auto_examples/cluster/plot_color_quantization.html#sphx-glr-auto-examples-cluster-plot-color-quantization-py

The what (do I do) and the where (do I come into the picture)

  • Visiting Scientific Python projects one-by-one to establish CI/CD pipelines for Pyodide support, end-to-end, across their entire test suite

    • Packaged and uploaded to a custom Anaconda index for use in interactive documentation

    • Technical writing and documentation infrastructure to bring interactivity

Project Status
PyWavelets
NumPy
pandas
scikit-image
numcodecs 🚧
zarr 🚧
Matplotlib 🚧

and so on!

The what (do I do) and the where (do I come into the picture)

  • Interactive documentation via JupyterLite
  • Run all examples online
    • Uses your own browser and memory to execute the code
    • Minimises security concerns
    • Flair of dynamic content to otherwise a static website
  • First milestone has been hit

Try it right now!

Ancillary accolades

  • Triage permissions for the PyWavelets main repository, plus named in v1.6.0 release
    • https://zenodo.org/records/10904326
  • Around the globe, named among
    • one of the 193 contributors to SciPy v1.13.0, and
    • one of the 96 contributors to NumPy v2.0.0 (coming soon – release candidate is available!) 

Footnotes

  • I consider it a privilege to be able to get to work on open-source software, and then get paid for it during the process
  • My work is being supported by a generous, collaborative Chan Zuckerberg Initiative – Scientific Python grant

Thank you for your time – stay tuned for more

Special thanks to

Ralf Gommers

Co-Director, Quansight Labs

Pavithra Eswaramoorthy

Developer Advocate, Quansight

2024

By Agriya Khetarpal

2024

  • 122