Skip to content

Add a --index-urls CLI flag for pip-install magics #166

Open
@agriyakhetarpal

Description

@agriyakhetarpal

Problem

piplite supports passing a string or a list of strings of index URLs

index_urls: list[str] | str | None = None,

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: pyodide/pyodide#4898 (comment), 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.

Metadata

Metadata

Labels

enhancementNew feature or request

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions