Skip to content

feat: data files in the venv #2936

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

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented May 27, 2025

This adds the necessary .dist-info files into the mix
and should get us reasonably close to handling 99% of the cases.

The expected differences from this and a venv built by uv would be:

  • Shared libraries are stored in <package>.libs in uv venvs. It seems
    that this happens if you install latest package versions (e.g. numpy) has
    libraries in numpy.libs in the latest version.
  • The RECORD files are excluded from the venvs for better cache hit
    rate in bazel, however I am not sure if we should do that for actual
    wheels that are downloaded from the internet.

Tested:

  • Building the //docs and manually checking the symlinks.
  • Ensure that the .pyi files get included.
  • Ensure that the libs get included.
  • Tests that .dist_info gets included.
  • Tests that ensure that there are files only from one version of the package.

Work towards #2156

This adds the necessary `.dist-info` files into the mix
and should get us reasonably close to handling 99% of the cases.

The expected differences from this and a `venv` built by `uv` would be:
* Shared libraries are stored in `<package>.libs` in `uv` venvs. This
  can be achieved in `rules_python` by changing the `installer` settings
  in the `wheel_installer/wheel.py#unzip` function.
* The `RECORD` files are excluded from the `venv`s for better cache hit
  rate in `bazel`, however I am not sure if we should do that for actual
  wheels that are downloaded from the internet.

Tested:
- [x] Building the `//docs` and manually checking the symlinks.
- [ ] Unit tests

Work towards bazel-contrib#2156
@aignas aignas force-pushed the exp/distinfo-venv branch from ebed371 to 9dd7589 Compare May 28, 2025 14:16
@aignas
Copy link
Collaborator Author

aignas commented May 28, 2025

I am thinking I should also link other things passed as data for completeness.

I think excluding anything outside site-packages directory for now would be wise.

@aignas aignas changed the title wip: dist-info folders in the venv feat: dist-info folders in the venv May 28, 2025
@aignas aignas changed the title feat: dist-info folders in the venv feat: data files in the venv May 28, 2025
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