Context
wheel tags is a new feature from wheel 0.40.0 for wheel maintainers to tag a wheel, independent of the build system. It is extremely handy especially in the post-PEP 517 time where the build backend is no longer dominated by setuptools. Not all build backends allow the developer to easily tweak the wheel tags, and so the easiest way is to build a wheel in the most convenient fashion, and tag it afterwards.
However, wheel-inspect is outdated and not catching up with this new approach. The last update v1.7.1 was released in Apr 2022, whereas wheel tags is part of wheel 0.40.0 released in Mar 2023.
Symptom
Using wheel-inspect v1.7.1 on a wheel tagged via wheel tags, this is what we get
[root@b58bcbb2915e test]# wheel tags --platform-tag "manylinux2014_x86_64" cuquantum_python_cu11-23.6.0-11-cp39-cp39-linux_x86_64.whl
cuquantum_python_cu11-23.6.0-11-cp39-cp39-manylinux2014_x86_64.whl
[root@b58bcbb2915e test]# wheel2json cuquantum_python_cu11-23.6.0-11-cp39-cp39-manylinux2014_x86_64.whl
Traceback (most recent call last):
File "/opt/conda/bin/wheel2json", line 8, in <module>
sys.exit(main())
File "/opt/conda/lib/python3.9/site-packages/wheel_inspect/__main__.py", line 12, in main
about = inspect_wheel(path)
File "/opt/conda/lib/python3.9/site-packages/wheel_inspect/inspecting.py", line 191, in inspect_wheel
return inspect(wf)
File "/opt/conda/lib/python3.9/site-packages/wheel_inspect/inspecting.py", line 121, in inspect
about["dist_info"]["wheel"] = obj.get_wheel_info()
File "/opt/conda/lib/python3.9/site-packages/wheel_inspect/classes.py", line 69, in get_wheel_info
return parse_wheel_info(txtfp)
File "/opt/conda/lib/python3.9/site-packages/wheel_inspect/wheel_info.py", line 53, in parse_wheel_info
wi = infoparser.parse(fp)
File "/opt/conda/lib/python3.9/site-packages/headerparser/parser.py", line 288, in parse
return self.parse_stream(scan(iterable, **self._scan_opts))
File "/opt/conda/lib/python3.9/site-packages/headerparser/parser.py", line 264, in parse_stream
raise errors.MissingFieldError(hd.name)
headerparser.errors.MissingFieldError: Required header field 'Tag' is not present
where it complains the wheel tag is missing, but I do not think tags have to be present. PyPA has clearly stated that
The wheel built package format includes these tags in its filenames
so the assumption (which wheel-inspect relies on) that the WHEEL file always contains a Tag field is not really held.
Suggested fix
This line can be relaxed to use required=False:
https://github.com/jwodder/wheel-inspect/blob/bd2051e9de2edb88075b40763d430887ef15c26d/src/wheel_inspect/wheel_info.py#L10
If Tag is not found, then wheel-inspect can just use the wheel filename to fetch the tag.
Context
wheel tagsis a new feature from wheel 0.40.0 for wheel maintainers to tag a wheel, independent of the build system. It is extremely handy especially in the post-PEP 517 time where the build backend is no longer dominated by setuptools. Not all build backends allow the developer to easily tweak the wheel tags, and so the easiest way is to build a wheel in the most convenient fashion, and tag it afterwards.However, wheel-inspect is outdated and not catching up with this new approach. The last update v1.7.1 was released in Apr 2022, whereas
wheel tagsis part of wheel 0.40.0 released in Mar 2023.Symptom
Using wheel-inspect v1.7.1 on a wheel tagged via
wheel tags, this is what we getwhere it complains the wheel tag is missing, but I do not think tags have to be present. PyPA has clearly stated that
so the assumption (which wheel-inspect relies on) that the
WHEELfile always contains aTagfield is not really held.Suggested fix
This line can be relaxed to use
required=False:https://github.com/jwodder/wheel-inspect/blob/bd2051e9de2edb88075b40763d430887ef15c26d/src/wheel_inspect/wheel_info.py#L10
If
Tagis not found, then wheel-inspect can just use the wheel filename to fetch the tag.