Skip to content

ENH Support alternative index urls - #74

Merged
ryanking13 merged 11 commits into
pyodide:mainfrom
ryanking13:extra-index-urls
Jul 18, 2023
Merged

ENH Support alternative index urls#74
ryanking13 merged 11 commits into
pyodide:mainfrom
ryanking13:extra-index-urls

Conversation

@ryanking13

@ryanking13 ryanking13 commented Jul 17, 2023

Copy link
Copy Markdown
Member

Resolve #7

This PR allows users to specify an index URL from which micropip can download packages. This allows users to install packages from a custom package index that provides PyPI-compatible APIs.

This PR covers both methods: modifying the index URL globally (micropip.set_index_urls) and passing the index URL as a parameter to micropip.install. This allows service operators like pyscript / jupyterlite to add their own package indexes as a default setting, while also allowing users to choose and use multiple indexes when needed.

  • changelog

@ryanking13 ryanking13 changed the title ENH Support setting custom index urls ENH Support alternative index urls Jul 17, 2023

@rth rth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very nice! A few comments otherwise LGTM. Thanks @ryanking13 !

Comment thread micropip/package_index.py Outdated


async def search_packages(
pkg: str,

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should it be search_package if it searches just 1 package? Also, it might be more user friendly to name the first argument name.

It's not "search" technically though. Search is returning top k results for a query, possibly with some pre-processing or fuzzing of the query. While this return a single response with which is the exact match. Maybe query_package? But I'm open to other name suggestions.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the suggestion! I wasn't aware of the difference between search and query :) I will go with query_package.

Comment thread micropip/_commands/install.py Outdated
Comment thread micropip/package_index.py Outdated
@ryanking13

ryanking13 commented Jul 18, 2023

Copy link
Copy Markdown
Member Author

I removed the <package_name> placeholder limitation so that index URLs for Simple APIs (e.g. https://pypi.org/simple) can be passed without modification.

@ryanking13
ryanking13 merged commit 075289c into pyodide:main Jul 18, 2023
@ryanking13
ryanking13 deleted the extra-index-urls branch July 18, 2023 12:39
@ryanking13 ryanking13 mentioned this pull request Jul 19, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support alternative registries in micropip

2 participants