#1955·pyodide

Add more docstring examples

Author: rthCreated Nov 13, 2021Updated Jul 30, 2026
Labelshelp wantedgood first issueOSSCA2025

I think it would be helpful to have more example in docstrings on how to use various functions and methods exposed in Pyodide. The general approach could be to,

  • have a short description documenting the function/method/class and its parameters/return value
  • include an example, ideally that is run as a doctest (we need to figure out how to do this) otherwise those will get outdated in time
  • link to the user manual for more details, when it makes sense

This is related to #1498

Python API

(looking at the API documentation)

  • pyodide.CodeRunner
  • pyodide.JsProxy
  • console.Console
  • console.ConsoleFuture
  • console.repr_shorten
  • pyodide.create_once_callable
  • pyodide.create_proxy
  • pyodide.destroy_proxies
  • pyodide.eval_code
  • pyodide.eval_code_async
  • pyodide.find_imports
  • pyodide.open_url
  • pyodide.register_js_module
  • pyodide.should_quiet
  • pyodide.to_js
  • pyodide.unregister_js_module
  • class webloop.WebLoop

Micropip API

  • micropip.install

JS API

It's still unclear to me how dostring examples should look like in JS and whether they could be run as doctests. Will open a separate issue.

  • pyodide.isPyProxy
  • pyodide.loadPackage
  • pyodide.loadPackagesFromImports: the is a verbal example, but I think it would be easier to read it as code.
  • pyodide.registerComlink
  • pyodide.registerJsModule
  • pyodide.runPython
  • pyodide.runPythonAsync
  • pyodide.setStandardStreams also misses argument description
  • pyodide.toPy
  • pyodide.PyBuffer: there is an example but I find it quite complex
  • PyProxy (and possibly its methods)