jupyterlite / jupyterlite/pyodide-kernel
Add a `--index-urls` CLI flag for pip-install magics
- Dominant language
- Python
- Stars
- 90
- Forks
- 47
- Avg merge
- 3d 13h
- Merged PRs (30d)
- 11
Description
### Problem
`piplite` supports passing a string or a list of strings of index URLs
https://github.com/jupyterlite/pyodide-kernel/blob/36aedb97d38cf283df8c3b0d65d7d6b8e575f0ab/packages/pyodide-kernel/py/piplite/piplite/piplite.py#L134
but it does not yet provide a CLI flag for them, so it is currently not possible to write commands `%pip install numpy --index-urls https://anaconda.org/scientific-python-nightly-wheels/simple`, as extra indices are/will be ignored and NumPy 2.0.2 from the Pyodide distribution is installed instead.
### Proposed Solution
Extend https://github.com/jupyterlite/pyodide-kernel/blob/36aedb97d38cf283df8c3b0d65d7d6b8e575f0ab/packages/pyodide-kernel/py/piplite/piplite/cli.py to have a simple `--index-urls` option that is passed to `piplite.py`, at first. It could be extended to `--index-url` or `--extra-index-url` options later if and when such a change is brought upstream in `micropip`.
### Additional context
xref: https://github.com/pyodide/pyodide/issues/4898#issuecomment-2637731077, as I've been meaning to test out the rollout of CORS headers for the Anaconda.org PyPI-like index through `piplite`, but I found I was unable to do so, while `micropip` works.
Contributor guide
Assessment
This issue has not been assessed yet.