Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ENH Support alternative index urls #74

Merged
merged 11 commits into from
Jul 18, 2023

Conversation

ryanking13
Copy link
Member

@ryanking13 ryanking13 commented Jul 17, 2023

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
Copy link
Member

@rth rth left a comment

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 !



async def search_packages(
pkg: str,
Copy link
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
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.

micropip/_commands/install.py Outdated Show resolved Hide resolved
micropip/package_index.py Outdated Show resolved Hide resolved
@ryanking13
Copy link
Member Author

ryanking13 commented Jul 18, 2023

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
5 checks passed
@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