Skip to content
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

InvalidDistribution error for whl from pyo3/maturin 0.23.3 #310

Closed
cdump opened this issue Dec 5, 2024 · 6 comments · Fixed by #313
Closed

InvalidDistribution error for whl from pyo3/maturin 0.23.3 #310

cdump opened this issue Dec 5, 2024 · 6 comments · Fixed by #313
Labels
bug Something isn't working

Comments

@cdump
Copy link

cdump commented Dec 5, 2024

Looks like twine upgrade in #309 is not enough, pkginfo upgrade required

unstable-v1 image hash = 83623c34c365

$ podman run -v `pwd`:/mnt --entrypoint /bin/bash --rm -it ghcr.io/pypa/gh-action-pypi-publish:unstable-v1

root@910b2e56a188:/app# twine --version
twine version 6.0.1 (keyring: 25.2.1, pkginfo: 1.10.0, requests: 2.32.3, requests-toolbelt: 1.0.0,
urllib3: 2.2.1)

root@910b2e56a188:/app# twine check /mnt/*.whl
Checking /mnt/evmole-0.6.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl: ERROR    InvalidDistribution: Metadata is missing required fields: Name, Version.
         Make sure the distribution includes the files where those fields are specified, and is using a
         supported Metadata-Version: 1.0, 1.1, 1.2, 2.0, 2.1, 2.2, 2.3.


root@910b2e56a188:/app# pip3 install pkginfo --upgrade
..
Successfully installed pkginfo-1.12.0

root@910b2e56a188:/app# twine check /mnt/*.whl
Checking /mnt/evmole-0.6.1-cp310-cp310-macosx_10_12_x86_64.macosx_11_0_arm64.macosx_10_12_universal2.whl: PASSED
@webknjaz
Copy link
Member

webknjaz commented Dec 5, 2024

Right. @woodruffw mentioned that it might not be. It'd be useful to get the steps for making a wheel for the reproducer documented. Then, I could think of running that in CI.

@webknjaz webknjaz added the bug Something isn't working label Dec 5, 2024
@cdump
Copy link
Author

cdump commented Dec 5, 2024

Minimal reproducer:

Dockerfile:

# syntax=docker/dockerfile:1

FROM rust:1.83 AS build
RUN  wget https://github.com/PyO3/maturin/releases/download/v1.7.6/maturin-x86_64-unknown-linux-musl.tar.gz \
  && tar xf maturin-*.tar.gz && mv maturin /usr/local/bin/
WORKDIR /workdir
RUN cargo init
RUN echo 'pyo3 = { version = "0.23.3", features = ["extension-module"] }' >> Cargo.toml
RUN maturin build --release --out wheel/

FROM ghcr.io/pypa/gh-action-pypi-publish:unstable-v1
COPY --from=build /workdir/wheel ./wheel
RUN twine check ./wheel/*.whl

run:

$ docker build -t asd .
...
 => ERROR [stage-1 3/3] RUN twine check ./wheel/*.whl                                                                                         0.9s
------
 > [stage-1 3/3] RUN twine check ./wheel/*.whl:
0.852 Checking ./wheel/workdir-0.1.0-cp311-cp311-manylinux_2_34_x86_64.whl: ERROR    InvalidDistribution: Metadata is missing required fields: Name,
0.856          Version.
0.856          Make sure the distribution includes the files where those fields are
0.856          specified, and is using a supported Metadata-Version: 1.0, 1.1, 1.2,
0.856          2.0, 2.1, 2.2, 2.3.
------
Dockerfile:13
--------------------
  11 |     FROM ghcr.io/pypa/gh-action-pypi-publish:unstable-v1
  12 |     COPY --from=build /workdir/wheel ./wheel
  13 | >>> RUN twine check ./wheel/*.whl
  14 |
--------------------
ERROR: failed to solve: process "/bin/sh -c twine check ./wheel/*.whl" did not complete successfully: exit code: 1

@woodruffw
Copy link
Member

Ah yeah, I see what happened here -- we also need to explicitly bump pkginfo since pip/pip-compile didn't do it for us. I can send a PR for that in a bit.

@webknjaz
Copy link
Member

webknjaz commented Dec 5, 2024

@woodruffw perhaps Twine should bump the lower requirement if v6 promises support for newer metadata? Or mention it in the changelog that the supported metadata versions depend on pkginfo present currently?

@woodruffw
Copy link
Member

@woodruffw perhaps Twine should bump the lower requirement if v6 promises support for newer metadata? Or mention it in the changelog that the supported metadata versions depend on pkginfo present currently?

Another one of the twine maintainers decided to retain compatibility with pkginfo <= 1.10, because of distribution constraints. I think that causes a lot of unfortunate complexity in cases like here, but I don't really understand the distribution constraints well enough to fully understand the rationale. This is all in pypa/twine#1123.

I think the plan with future releases is to drop pkginfo entirely, and go solely with packaging. But yeah, I think this could use a better changelog/documentation; I'll look into that.

@webknjaz
Copy link
Member

webknjaz commented Dec 5, 2024

ack, thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
3 participants