Skip to content

Support Metadata 2.4 and 2.5, update vendored 'packaging' to 26.0#28

Merged
dstufft merged 1 commit into
wheelnext:mainfrom
jameslamb:wheel-metadata-2.4
Feb 6, 2026
Merged

Support Metadata 2.4 and 2.5, update vendored 'packaging' to 26.0#28
dstufft merged 1 commit into
wheelnext:mainfrom
jameslamb:wheel-metadata-2.4

Conversation

@jameslamb

@jameslamb jameslamb commented Feb 5, 2026

Copy link
Copy Markdown
Member

In response to loud deprecation warnings from setuptools, RAPIDS projects recently all switched to PEP 639 license metadata, which bumps their wheel Metadata-Version to 2.4 (ref: rapidsai/build-planning#152).

Stubs currently can't be built from those wheels, because this project does not support wheel Metadata-Version beyond 2.3.

This fixes that, with the following:

  • updates vendored packaging from 24.1 to 26.0
  • modifies assert_valid_metadata() to allow for wheels that have License-Expression but not License (License was deprecated beginning with Metadata-Version 2.4)
  • adds docs on how to update the vendored code

Notes for Reviewers

How I updated packaging

0 manual changes were made in _vendor/. Updated packaging to 26.0 (its latest version) like this:

pushd ./src/wheel_stub/_vendor
git rm -rf packaging*

pip download --no-deps 'packaging==26.0'
unzip \
    -o \
    packaging*.whl

rm *.whl

popd

How I tested this

Followed the instructions in the README, using a wheel I know this project failed to produce an sdist for.

testing code (example)
# clean up from previous attempts
rm -rf ./dist
rm -rf ./demo/dist
rm -f ./demo/*.whl
rm -rf ./.venv

# work in a venv
python -m venv .venv
source .venv/bin/activate

# install build dependencies
pip install hatch hatchling

# build wheel-stub
hatch build -t wheel

# try to build an sdist from a cuCIM 26.2 wheel
pushd demo
WHEEL_URL="https://pypi.anaconda.org/rapidsai-wheels-nightly/simple/cucim-cu13/26.2.0a35/cucim_cu13-26.2.0a35-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl"

wget "${WHEEL_URL}"

PIP_FIND_LINKS=$(pwd)/../dist \
PIP_NO_INDEX=1 \
   python -m build \
      --sdist \
      --config-setting source_wheel=cucim_cu13-26.2.0a35-cp313-cp313-manylinux_2_27_x86_64.manylinux_2_28_x86_64.whl

On main, this fails in the same way we observed in internal pipelines building a wheel-stub sdist:

Traceback (most recent call last):
  File "/home/jlamb/repos/wheel-stub/.venv/lib/python3.12/site-packages/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
    main()
...
  File "/tmp/build-env-pho0yp4y/lib/python3.12/site-packages/wheel_stub/sdist.py", line 148, in build
    self.assert_valid_metadata(parsed_metadata)
  File "/tmp/build-env-pho0yp4y/lib/python3.12/site-packages/wheel_stub/sdist.py", line 224, in assert_valid_metadata
    assert "License" in parsed, "Software should have a license"
           ^^^^^^^^^^^^^^^^^^^
AssertionError: Software should have a license

ERROR Backend subprocess exited when trying to invoke build_sdist

On this branch, it succeeds

* Creating isolated environment: venv+pip...
* Installing packages in isolated environment:
  - wheel-stub
* Getting build dependencies for sdist...
* Building sdist...
Successfully built cucim_cu13-26.2.0a35.tar.gz

Also ran all the tests

$ pip install -r ./requirements/requirements-lock.txt .
$ pytest
=== 11 passed in 13.94s ===

@jameslamb
jameslamb marked this pull request as ready for review February 5, 2026 19:48
Comment thread src/wheel_stub/sdist.py
assert "Name" in parsed, "Must have a distribution name"
assert "Version" in parsed, "Must have a version"

# 'License' was deprecated in Metadata Version 2.4 (PEP 639)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

This file is the only Python code I manually changed, just calling it out so it isn't lost in the diff.

At https://packaging.python.org/en/latest/specifications/core-metadata/#license it says:

License
Deprecated since version 2.4: in favour of License-Expression.

@vyasr vyasr changed the title WIP: support Metadata 2.4 and 2.5, update vendored 'packaging' to 26.0 Support Metadata 2.4 and 2.5, update vendored 'packaging' to 26.0 Feb 5, 2026
@dstufft
dstufft merged commit d0fca4f into wheelnext:main Feb 6, 2026
6 checks passed
@jameslamb
jameslamb deleted the wheel-metadata-2.4 branch February 6, 2026 16:24
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.

2 participants