Advancing Pyodide interoperability and interactive documentation for Scientific Python projects

Agriya Khetarpal, 20312915002

University of Delhi
Software Engineer I, Quansight Labs

Mentored by Dr 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 NumPy docs are now interactive

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!

statsmodels

SciPy

Planned

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
  • Feature improvements to jupyterlite-sphinx
  • Accessibility improvements

Ancillary accolades

  • Named in PyWavelets 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
  • Joined the Pyodide organisation on GitHub 

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 grant CZI 2022-316713 towards Scientific Python

Thank you for your time 

Special thanks to

Ralf Gommers

Co-Director, Quansight Labs

Pavithra Eswaramoorthy

Developer Advocate, Quansight

july-2024

By Agriya Khetarpal

july-2024

  • 34