Skip to content

Recognize build tags in wheel data directories - #343

Open
lin-hongkuan wants to merge 1 commit into
pypa:mainfrom
lin-hongkuan:codex/build-tag-data-dir
Open

Recognize build tags in wheel data directories#343
lin-hongkuan wants to merge 1 commit into
pypa:mainfrom
lin-hongkuan:codex/build-tag-data-dir

Conversation

@lin-hongkuan

Copy link
Copy Markdown

Fixes #193.

This updates WheelFile.data_dir to include the optional wheel build tag parsed from the wheel filename, so files under directories such as foo-0.4.2-1337.data/ are routed through the wheel .data scheme instead of being treated as root-scheme files.

The base WheelSource behavior is unchanged for callers that construct sources without a wheel filename.

Tests added:

  • WheelFile.data_dir includes the build tag for build-tagged wheels.
  • install() routes a build-tagged wheel data file to the data scheme.

Checks run locally:

  • PYTHONPATH=src python -m pytest tests\test_sources.py::TestWheelFile::test_build_tag_is_part_of_data_dir tests\test_core.py::TestInstall::test_handles_wheel_data_dir_with_build_tag -q
  • PYTHONPATH=src python -m pytest tests\test_sources.py tests\test_core.py -q
  • PYTHONPATH=src python -m pytest -q
  • python -m ruff check src tests
  • python -m ruff format --check src tests
  • PYTHONPATH=src python -m mypy src
  • git diff --check

@yangfan-yf-yf yangfan-yf-yf left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

The optional build tag belongs only in the wheel filename. The wheel specification defines the data directory as the dist-info directory name with the extension changed to .data, so a build-tagged wheel still uses distribution-version.data.

Changing WheelFile.data_dir to include self._build_tag makes a compliant wheel such as fancy-1.0.0-1337-py3-none-any.whl with fancy-1.0.0.data/data/... no longer match the data scheme. The new fixture and assertions instead encode the non-standard fancy-1.0.0-1337.data layout.

Could this preserve the required distribution-version.data handling for build-tagged wheels? If compatibility with legacy non-standard artifacts is desired, it needs to be additive rather than replacing the standard directory name, with regression coverage for both layouts.

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.

data_dir lacks optional build tag

3 participants