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

twine check passes but pypi rejects #937

Closed
ashb opened this issue Oct 31, 2022 · 5 comments
Closed

twine check passes but pypi rejects #937

ashb opened this issue Oct 31, 2022 · 5 comments

Comments

@ashb
Copy link

ashb commented Oct 31, 2022

Your Environment

Thank you for taking the time to report an issue.

To more efficiently resolve this issue, we'd like to know some basic information about your system and setup.

  1. Your operating system: Windows

  2. Version of python you are running:

$ python --version
Python 3.11.0
  1. How did you install twine? Did you use your operating system's package manager or pip or something else?

pipx

  1. Version of twine you have installed (include complete output of):
$ twine --version
twine version 4.0.1 (importlib-metadata: 5.0.0, keyring: 23.9.3, pkginfo: 1.8.3, requests: 2.28.1, requests-toolbelt: 0.10.1, urllib3: 1.26.12)
  1. Which package repository are you targeting?

pypi

The Issue

Please describe the issue that you are experiencing.

twine check passed, but on trying to upload the dist to pypi (with twine upload) failed with an error:

Uploading distributions to https://upload.pypi.org/legacy/
Uploading windows_fonts-0.1.0a1-cp310-none-win_amd64.whl
25l
  0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/156.8 kB • --:-- • ?
  0% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 0.0/156.8 kB • --:-- • ?
 89% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━╸━━━━ 139.3/156.8 kB • 00:01 • 3.6 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 156.8/156.8 kB • 00:00 • 2.1 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 156.8/156.8 kB • 00:00 • 2.1 MB/s
100% ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━ 156.8/156.8 kB • 00:00 • 2.1 MB/s
25hWARNING  Error during upload. Retry with the --verbose option for more details. 
ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         'Ash Berlin-Taylor <[email protected]>>' is an invalid value   
         for Author-email. Error: Use a valid email address See                 
         https://packaging.python.org/specifications/core-metadata for more     
         information.                                                           

Steps to Reproduce

If the issue is predictable and consistently reproducible, please list the steps here.

[project]
name = "test-project"
version = "0.0"
description = "Holding"
authors = [
   {name="Ash Berlin-Taylor", email="[email protected]>"}
]
license = {text="MIT"}

If you build a dist with this (python -m build) and then upload it, PyPi will reject it.

Notice the error/typo at the end of the email >.

@frague59
Copy link

frague59 commented Nov 7, 2022

Hi, I've exactly the same issue, without the typo in the email address...

[project]
name = "django-delayed-notifications"
description = "django-delayed-notifications provides tracking of notifications, and delayed sending."
authors = [
    { name = "François GUÉRIN", email = "[email protected]" },
]
license = { text = "MIT" }

Error:

ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         '=?utf-8?b?RnJhbsOnb2lzIEdVw4lS...PGZyYWd1ZTU5QGdtYWlsLmNvbT4=?=' is an
         invalid value for Author-email. Error: Use a valid email address See   
         https://packaging.python.org/specifications/core-metadata for more     
         information. 

@sigmavirus24
Copy link
Member

@frague59 I suspect the metadata generated for you by your build tool is the greater problem.

Twine check looks for a very small subset of things that PyPI might validate since twine is used against multiple repositories and cannot validate all that every repository cares about.

I don't believe we'll add this check

@rindPHI
Copy link

rindPHI commented Nov 8, 2022

Hi, I've exactly the same issue, without the typo in the email address...

[project]
name = "django-delayed-notifications"
description = "django-delayed-notifications provides tracking of notifications, and delayed sending."
authors = [
    { name = "François GUÉRIN", email = "[email protected]" },
]
license = { text = "MIT" }

Error:

ERROR    HTTPError: 400 Bad Request from https://upload.pypi.org/legacy/        
         '=?utf-8?b?RnJhbsOnb2lzIEdVw4lS...PGZyYWd1ZTU5QGdtYWlsLmNvbT4=?=' is an
         invalid value for Author-email. Error: Use a valid email address See   
         https://packaging.python.org/specifications/core-metadata for more     
         information. 

The problem seems to be the UTF-8 characters, in your case the "ç" and the "É" in the name. I experienced the same with the "ö" in my surname. Substituting it with "oe" solved the issue for me.

The problem is that this seems to be a regression either in build, twine, or PyPi. I had no problems with my German Umlaut before.

@sigmavirus24
Copy link
Member

Twine simply uses what's in the metadata to send the for and metadata to PyPI. I don't think PyPI is at fault for generating that string. I suggest building your project and then looking at what is generated

@frague59
Copy link

frague59 commented Nov 9, 2022

Hi,
I've noticed the warehouse project, they redirect my issue to setuptools.

pypa/setuptools#3663

pypi/warehouse#12490

You can close this issue.

Thanks !

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

No branches or pull requests

5 participants