micropip icon indicating copy to clipboard operation
micropip copied to clipboard

Enhancement ideas from JupyterLite

Open rth opened this issue 1 year ago • 8 comments

As summarized in https://github.com/pyodide/pyodide/issues/3093#issuecomment-1245786852 by @bollwyvl there are a number of features in piplite/JupyterLite built on top of micropip, some of which could make sense to move upstream, now that this package is standalone,

What piplite/jupyterlite hacks are wanted? Happy to shed some stuff!

Even if all our hacks weren't desirable, it would be lovely to have a few more documented ways to customize micropip, rather than trying to solve some things Once And For All... presenting the two together:

  1. handling multiple package sources
    1. we check for a custom Warehouse (or warehouse-like file format) for custom/offline packages
    2. notionally, micropip.add_pypi_json_resolver(key: str, get_pypi_json: Callable[[str, dict], PackageReleases])
  2. disabling package sources
    1. for offline (but still dynamic) installations, it's nice to have some guardrails in place to avoid calling out to Big PyPI
    2. notionally, micropip.remove_pypi_json_resolver(key: str)
  3. specifying no-op packages to be considered installed
    1. not handled in piplite, but rather in separate build packages
    2. notionally, micropip.add_noop_package(package_name: str)

Some things that we hack outside of piplite, so maybe they belong in core:

  1. specifying patches that need to occur at import time
    1. we un-lazily load and patch some heavy hitters (matplotlib, oy!)
    2. this is really more of a loader-time thing, so maybe should be a pyodide API
    3. we tried to use some off-the-shelf stuff, but at some point it stopped working
  2. specifying mock packages
    1. we mock some packages

rth avatar Oct 15 '22 08:10 rth