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

Error message is vague when wheel platform is not supported #17548

Open
mara004 opened this issue Feb 3, 2025 · 10 comments
Open

Error message is vague when wheel platform is not supported #17548

mara004 opened this issue Feb 3, 2025 · 10 comments

Comments

@mara004
Copy link

mara004 commented Feb 3, 2025

Describe the bug
Trying to upload pypdfium2 to TestPyPI failed with HTTPError: 400 Bad Request from https://test.pypi.org/legacy/

Digest: sha256:97989de369e12a10abbdf72e5b225ba5dca57ada26e6f606259b116a98ca5eeb
Status: Downloaded newer image for ghcr.io/pypa/gh-action-pypi-publish:release-v1
Checking dist/pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-macosx_10_13_x86_64.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-macosx_11_0_arm64.whl: PASSED
Checking 
dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
: PASSED
Checking 
dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl: PASSED
Checking 
dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_i686.manylinux2014_i686.whl: PASSED
Checking 
dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_aarch64.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_i686.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_x86_64.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-win32.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-win_amd64.whl: PASSED
Checking dist/pypdfium2-5.0.0b1-py3-none-win_arm64.whl: PASSED
Checking dist/pypdfium2-5.0.0b1.tar.gz: PASSED
Uploading distributions to https://test.pypi.org/legacy/
Uploading pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl
WARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 400 Bad Request from https://test.pypi.org/legacy/          
         Bad Request                                                            

https://github.com/pypdfium2-team/pypdfium2/actions/runs/13120190203/job/36604287202

Expected behavior

Upload should pass, as it did on our previous release with the same workflow.
The workflow file itself has barely changed, however we've added a new platform in the build script (android).

To Reproduce

Run pypdfium2's release workflow. See the link above.

My Platform

GH actions runner (ubuntu-latest)

Additional context

This is our first release to include an android arm64 wheel (cf. PEP 738).
Alphabetically, this is the first file the PyPI publish action attempts to upload.
It is not clear to us whether the failure is specific to the android wheel, or if this was merely coincidence.

@mara004 mara004 added bug 🐛 requires triaging maintainers need to do initial inspection of issue labels Feb 3, 2025
@di
Copy link
Member

di commented Feb 3, 2025

Can you turn on verbosity, retry & share the output? See https://github.com/pypa/gh-action-pypi-publish?tab=readme-ov-file#for-debugging

mara004 added a commit to pypdfium2-team/pypdfium2 that referenced this issue Feb 3, 2025
@mara004
Copy link
Author

mara004 commented Feb 3, 2025

Thanks for the quick response. I've turned verbose on and triggered a new run:
https://github.com/pypdfium2-team/pypdfium2/actions/runs/13120749457
It will take a couple of minutes for the test matrix to complete.

@mara004
Copy link
Author

mara004 commented Feb 3, 2025

Showing hash values of files to be uploaded:
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_i686.whl
SHA256: 43476b213d5eaadf9e709932fd772d58fde339cacf7ee3024624293db7194848
MD5: 8a47b8176f6f80400480dd783ab95e8e
BLAKE2-256: ef3ad374d5fed5a9bbc4ec6595d2be6f520b39f5955285e781ea2af54663dee3
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_aarch64.manylinux2014_aarch64.whl
SHA256: 5c2d8411972ec16748b449ef0bc19f0e7a7889759776b7cea97d2ad2662a19a8
MD5: c721a4b4fc90e1f6f4e03e2166d6b0f4
BLAKE2-256: 605d5a1d79c0e9d3ec55276e410bb034a93ab8c5be7709c7b3170e506e11801a
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_aarch64.whl
SHA256: 02f40ec05619b6870ba9874d293b365ebec6174c8a5556c64949989208f8ef8c
MD5: f35ddd9f928b2a1397365507dc50ee29
BLAKE2-256: 2032b72da260697a47a7bd02e53199a8a38ef17d548f59383380c8cc3ba3b22b
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl
SHA256: 54f75e3bca50bb779ff80eae1c94b6c2e900cc26b0cc3ccb0498eba0e8b9eadb
MD5: 18b9de47a439aa305a31482d9613b497
BLAKE2-256: c5aa3360d266c5699c9b5205f2c45f12bbedb508091892939[173](https://github.com/pypdfium2-team/pypdfium2/actions/runs/13120749457/job/36605980434#step:7:179)ed7491ef5015
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-win_arm64.whl
SHA256: b73b3047f85c0af81f2d5500e74b17527947c44196c3e8628bfa404f7897a551
MD5: ab31a124382c7e08efbe201464800a08
BLAKE2-256: dd3c2240cc2560131fed4bc6aadc028b41a2fa801692496c3cd06cfddbe5a68d
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-macosx_11_0_arm64.whl
SHA256: bd37e60061334ca622a6bac28d292a0001b03b0c09b8d05140dc428c2b5cd7fc
MD5: 6059b1e162217c7ed561911908d83ea0
BLAKE2-256: e80a6856b69f27bce47ca7079284bc26306c1e08a0371b71f4c8ae5068151ffb
/github/workspace/dist/pypdfium2-5.0.0b1.tar.gz
SHA256: b89cd6ba9c780bc0b69c4d2a777d65f947b73f1c6b436794824663cf3e41c435
MD5: 9c4307441d1ad145c97bb209303364c3
BLAKE2-256: d5e45a9d84d5ad2205a57ffbf1a10[179](https://github.com/pypdfium2-team/pypdfium2/actions/runs/13120749457/job/36605980434#step:7:185)640547ebb85179e68f2f663cc15b1f57
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-win32.whl
SHA256: 8e34a896fe713f1f7e5f641babfd7900cfd74df1f9abe15135b094e8c699b59b
MD5: 45ad0d130e28e3107d30db34dd344606
BLAKE2-256: 63406d943c8228d01343702c495f18ec7ce0eb6899bf007f2bd12dcf4fb40b6b
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-win_amd64.whl
SHA256: f5f62fc1d509925b551ab99575b29c5095fdbff4b7658b6b78cb5aac09448e8f
MD5: 5ef3d38a0a2cafc343922e331bf68ce0
BLAKE2-256: ab5ea2789b063ae5f0b493ac5a52721f4c5a4cd3bce2292c0da58bb3f2ce7398
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_x86_64.whl
SHA256: 1f3b9dfcb341570faaff3270db7d3cf5c95a321f86c94968223871bdebf63fa9
MD5: fd568a32d32ad17211b3d811009df86a
BLAKE2-256: 75f14055ae26a40d5881302dd951a700d8837a450eda22730fa12c2be6ba292b
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_armv7l.manylinux2014_armv7l.whl
SHA256: 4487a12e15e2f7807f4e986fb2544a57ec0f0d4601edcf7e80c6bed8aae44be3
MD5: 559d13c1f72075a5defca5cb0a18a731
BLAKE2-256: 2cbb4bfc1a238a882c527593c4c1346864aaf64455c00105b435bf43f998c5af
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl
SHA256: e824a3418a27aaf57a769d2235ce23c2b952088eb2eb48109c0c918b9792ddfc
MD5: 66e2442a8f11cbc7f95805a60a2a4e96
BLAKE2-256: 61374662272d8e53fdf17ba76f828d638493fafb335209e46a7dc053fef488d8
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-macosx_10_13_x86_64.whl
SHA256: 03e81ea0b60510165dd1e86009dae3a883d45258b7b3bdfa7948a4fe02d27478
MD5: 065f3890b9737842d0766e4a8a02957d
BLAKE2-256: 607bc321e794b9b07c1a87341be68aa9c6aec8df75322a568e712d585ecd3f3f
/github/workspace/dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_i686.manylinux[201](https://github.com/pypdfium2-team/pypdfium2/actions/runs/13120749457/job/36605980434#step:7:207)4_i686.whl
SHA256: e83f67d18acfdab950b85116c2e761a03ce165b8988f687a82f2ae278b64cf62
MD5: 9293229648e3e84d6484246e470b127c
BLAKE2-256: f23dedd38c9ae617e28704bb24e7b051a3101a7170e358cbe28e28079e20797c
Uploading distributions to https://test.pypi.org/legacy/
INFO     dist/pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl (2.5 MB)      
INFO     dist/pypdfium2-5.0.0b1-py3-none-macosx_10_13_x86_64.whl (2.8 MB)       
INFO     dist/pypdfium2-5.0.0b1-py3-none-macosx_11_0_arm64.whl (2.7 MB)         
INFO     dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_aarch64.manylinux2014_aa
         rch64.whl (2.7 MB)                                                     
INFO     dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_armv7l.manylinux2014_arm
         v7l.whl (2.5 MB)                                                       
INFO     dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_i686.manylinux2014_i686.
         whl (2.8 MB)                                                           
INFO     dist/pypdfium2-5.0.0b1-py3-none-manylinux_2_17_x86_64.manylinux2014_x86
         _64.whl (2.7 MB)                                                       
INFO     dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_aarch64.whl (5.9 MB)     
INFO     dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_i686.whl (6.0 MB)        
INFO     dist/pypdfium2-5.0.0b1-py3-none-musllinux_1_1_x86_64.whl (6.0 MB)      
INFO     dist/pypdfium2-5.0.0b1-py3-none-win32.whl (2.7 MB)                     
INFO     dist/pypdfium2-5.0.0b1-py3-none-win_amd64.whl (2.8 MB)                 
INFO     dist/pypdfium2-5.0.0b1-py3-none-win_arm64.whl (2.7 MB)                 
INFO     dist/pypdfium2-5.0.0b1.tar.gz (167.0 KB)                               
INFO     username set by command options                                        
INFO     password set by command options                                        
INFO     username: __token__                                                    
INFO     password: <hidden>                                                     
Uploading pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl
INFO     Response from https://test.pypi.org/legacy/:                           
         400 Bad Request                                                        
INFO     <html>                                                                 
          <head>                                                                
           <title>400 Binary wheel                                              
         'pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl' has an           
         unsupported platform tag 'android_21_arm64_v8a'.</title>               
          </head>                                                               
          <body>                                                                
           <h1>400 Binary wheel                                                 
         'pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl' has an           
         unsupported platform tag 'android_21_arm64_v8a'.</h1>                  
           The server could not comply with the request since it is either      
         malformed or otherwise incorrect.<br/><br/>                            
         Binary wheel                                                           
         &#x27;pypdfium2-5.0.0b1-py3-none-android_21_arm64_v8a.whl&#x27; has an 
         unsupported platform tag &#x27;android_21_arm64_v8a&#x27;.             
                                                                                
                                                                                
          </body>                                                               
         </html>                                                                
ERROR    HTTPError: 400 Bad Request from https://test.pypi.org/legacy/          
         Bad Request

@mara004
Copy link
Author

mara004 commented Feb 3, 2025

Indeed, PyPI seems to refuse the android wheel.
However, the tag is identical to the example in https://peps.python.org/pep-0738/#packaging, and the PEP is marked as final.

@di
Copy link
Member

di commented Feb 3, 2025

Actually, looking more closely, I think we just don't support PEP 738 yet. The list of platforms we permit in wheel filenames is here:

_PLATFORMS = [
(re.compile(r"^win_(.*?)$"), lambda m: f"Windows {_normalize_arch(m.group(1))}"),
(re.compile(r"^win32$"), lambda m: "Windows x86"),
(
re.compile(r"^manylinux2010_(.*?)$"),
lambda m: f"manylinux: glibc 2.12+ {_normalize_arch(m.group(1))}",
),
(
re.compile(r"^manylinux_(\d+)_(\d+)_(.*?)$"),
lambda m: (
f"manylinux: glibc "
f"{m.group(1)}.{m.group(2)}+ {_normalize_arch(m.group(3))}"
),
),
(
re.compile(r"^musllinux_(\d+)_(\d+)_(.*?)$"),
lambda m: (
f"musllinux: musl {m.group(1)}.{m.group(2)}+ {_normalize_arch(m.group(3))}"
),
),
(
re.compile(r"^macosx_(\d+)_(\d+)_(.*?)$"),
lambda m: f"macOS {m.group(1)}.{m.group(2)}+ {_normalize_arch(m.group(3))}",
),
]

I see that PEP 738 says "The Android wheel tag format should also be added to the list of tags accepted by PyPI." but I don't think anyone's requested or proposed that yet.

I would have expected a more useful error message though, so we should look into fixing that as well.

@di di changed the title TestPyPI upload failure (HTTPError: 400 Bad Request) Error message is vague when wheel platform is not supported Feb 3, 2025
@di
Copy link
Member

di commented Feb 3, 2025

I renamed this issue to be able the vague error message, and created #17549 to capture our need to support PEP 738.

@di di added APIs/feeds and removed requires triaging maintainers need to do initial inspection of issue labels Feb 3, 2025
@di
Copy link
Member

di commented Feb 3, 2025

Twine should be outputing the reason: https://github.com/pypa/twine/blob/d9e4b080f0934b274f9f2896ea1f8812987cac7b/twine/__main__.py#L44

Maybe we're failing to provide it correctly?

mara004 added a commit to pypdfium2-team/pypdfium2 that referenced this issue Feb 3, 2025
@mara004
Copy link
Author

mara004 commented Feb 3, 2025

OK, I've taken out the android wheel and re-triggered the release. Publishing the other wheels worked well.
Thanks for the good support here, really appreciated!

@mhsmith
Copy link

mhsmith commented Feb 10, 2025

The Android wheel tag has now been enabled in #17559, so you can try releasing it again if you like.

@mara004
Copy link
Author

mara004 commented Feb 11, 2025

Thanks for the info. For various reasons, I've decided not to provide android wheels for now after all.
pypdfium2's setup is a bit crazy, we have our own platform detection and implicit downloading of pdfium-binaries, so wheels aren't too relevant. Of course, we provide them for common platforms to avoid the need to run setup code, but for niche platforms it's not a big deal if we don't, as you will still get the binaries.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants