Repository navigation
Conversation
…oups Read the dependencies, the optional dependencies and the PEP 735 dependency groups from the pyproject.toml and add a helper to select the packages using dependency group specifiers.
Add the `hide_unexposed_packages` attribute to the hub repository. When set, the aliases of the packages that are not exposed are only visible to the wheel repositories that depend on them.
Add the `pip.configure` tag class that limits the packages that a hub exposes to the ones listed in the dependency groups of a `pyproject.toml` file. The other packages of the hub are still used by the wheels that need them, but their aliases are not public.
Otherwise the unified hub would point to the hidden aliases of the hub and fail with a visibility error instead of the missing package error.
pip.configure with ["*", "transitive"] used the packages that are available on all platforms, which made the platform-specific packages private. Treat it as if the hub was not configured instead, which keeps these packages public and out of all_requirements as before.
…igure Replace the nested comprehensions and the long inline conditions with explicit loops and use types.is_string.
Keep a single wiring test for pip.configure in the extension tests, as the selection is tested in hub_exposure_tests, and test that the pip.default pyproject_toml is used. Also link the issue in the news entry.
…igure-extras # Conflicts: # python/private/pypi/BUILD.bazel # python/private/pypi/hub_repository.bzl # python/private/pypi/render_pkg_aliases.bzl
select_dependency_groups now also returns the extras that the selected requirements request, e.g. requests[socks], so that pip.configure can expose them through the hub.
The extras requested in the selected pyproject.toml dependency groups are added to the hub, so @pypi//requests:[socks] exists and @pypi//requests includes the extra even if the lock file does not request it. hub_exposure now returns the extras together with the exposed packages and add_extras adds them to the config settings of the hub whl_map.
Collaborator
Author
|
This PR was drafted by a Claude Code agent as a design proposal for exposing the This is an agent-generated comment, automatically generated. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Stacked on #4395 and #4490.
Lock files often do not record the extras that a project requests, e.g.
uv pip compileandpip-compile --strip-extrasdrop them, so with theper-extra hub targets the
@pypi//requests:[socks]target does not existand
@pypi//requestsdoes not include the extra, even though thepyproject.tomlasks forrequests[socks].With this change
pip.configurereads the extras from the requirements inthe selected
pyproject.tomldependency groups ([project] dependencies,[project.optional-dependencies]and[dependency-groups]) and adds themto the hub, so the user only has to point the hub at the
pyproject.toml:select_dependency_groupsnow also returns the extras of the selectedrequirements,
hub_exposurereturns them for each configured hub andadd_extrasadds them to thewhl_config_settingvalues of the hubwhl_map, which the hub already uses to render the[<extra>]targets andthe available extras for the spoke repositories. With
dependency_groups = ["*", "transitive"]all of the packages stay publicand the extras of all of the groups are added. The environment markers of
the requirements are ignored, so the extras are added on all of the
platforms.
Work towards #2786