Skip to content

feat(rules): add PyInfo.packages with the PyPI packages of a target - #4506

Closed
aignas wants to merge 1 commit into
bazel-contrib:mainfrom
aignas:feat.aignas.py-info-packages
Closed

aignas wants to merge 1 commit into
bazel-contrib:mainfrom
aignas:feat.aignas.py-info-packages

Conversation

@aignas

@aignas aignas commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator

py_library targets that have a .dist-info/METADATA file in their data,
such as the ones pip.parse creates from wheels, now record their normalized
package name in the new PyInfo.packages depset, which is propagated
transitively.

Previously, the package name was only available in PyInfo.venv_symlinks,
and only when --venvs_site_packages=yes was set, so rules could not tell
whether a target depends on a given PyPI package. For example, py_test
needs this to use a coverage package that it already depends on for
bazel coverage instead of the toolchain coverage tool.

Work towards #3902

`py_library` targets that have a `.dist-info/METADATA` file in their `data`,
such as the ones `pip.parse` creates from wheels, record their normalized
package name in the new `PyInfo.packages` depset, which is propagated
transitively. Previously the name was only available via `venv_symlinks`
when `--venvs_site_packages=yes` was set.

This allows rules to check whether a target depends on a given package, e.g.
so that a `py_test` can tell whether it already depends on `coverage`.
@aignas
aignas requested a review from rickeylev as a code owner November 15, 2026 08:19
@aignas

aignas commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

This PR was drafted by an AI coding agent (Claude Code) working for @aignas, as a prerequisite for the reworked #4433. Review comments will be handled by @aignas, possibly with the help of the agent; any agent-written replies will be marked as such.

Agent-generated comment, posted on behalf of the user.

aignas added a commit to aignas/rules_python that referenced this pull request Nov 15, 2026
`PyInfo.packages` is no longer used by the `--coverage` flag, and it is
proposed separately in bazel-contrib#4506, so remove it from this change.
@aignas

aignas commented Nov 15, 2026

Copy link
Copy Markdown
Collaborator Author

Closing: the coverage changes (#4433) no longer detect a coverage dependency, so nothing needs PyInfo.packages for now.

This comment was generated by an AI agent and approved by @aignas.

@aignas aignas closed this Nov 15, 2026
@aignas
aignas deleted the feat.aignas.py-info-packages branch November 15, 2026 14:31
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.

1 participant