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

Metadata: escape display name in email addresses #1832

Merged
merged 3 commits into from Nov 2, 2023

Conversation

robsdedude
Copy link
Contributor

This follows the way setuptools handles email addresses from pyproject.toml files.

See here where it utilizes the std lib package email, which in turn escapes email addresses here and then here.

I noticed this bug when I tried to upload a package to PyPI with something like this in my pyproject.toml:

[project]
# ...
authors = [
    {name = "FooBar, Inc.", email = "contact@foobar.com"}
]
# ...

PyPI rejected the package:

HTTPError: 400 Bad Request from https://test.pypi.org/legacy/
'FooBar, Inc. <contact@nfoobar.com>' is an invalid value for Author-email.
Error: Use a valid email address See
https://packaging.python.org/specifications/core-metadata for more
information.

As a workaround, I changed my pyproject.toml to

[project]
# ...
authors = [
    {email = "\"FooBar, Inc.\" <contact@foobar.com>"}
]
# ...

Copy link

netlify bot commented Nov 2, 2023

Deploy Preview for maturin-guide ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 693f81f
🔍 Latest deploy log https://app.netlify.com/sites/maturin-guide/deploys/6543980afa3b7300086d6c09
😎 Deploy Preview https://deploy-preview-1832--maturin-guide.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

Thanks! Can you also add a test case for the new function?

src/metadata.rs Outdated Show resolved Hide resolved
src/metadata.rs Outdated Show resolved Hide resolved
src/metadata.rs Outdated Show resolved Hide resolved
robsdedude

This comment was marked as resolved.

robsdedude and others added 2 commits November 2, 2023 12:05
@robsdedude
Copy link
Contributor Author

@messense tests added.

Copy link
Member

@messense messense left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@messense messense merged commit 7a476bc into PyO3:main Nov 2, 2023
26 of 27 checks passed
@robsdedude robsdedude deleted the fix-author-email-escaping branch November 2, 2023 13:05
bmwiedemann pushed a commit to bmwiedemann/openSUSE that referenced this pull request Nov 15, 2023
https://build.opensuse.org/request/show/1126453
by user mia + anag+factory
- Update to 1.3.2
  * Switch to Ruff formatter
    gh#PyO3/maturin#1817
  * Upgrade ring to 0.17
    gh#PyO3/maturin#1819
  * Un-deprecate MATURIN_PEP517_ARGS env var
    gh#PyO3/maturin#1820
  * Add support for uniffi library mode
    gh#PyO3/maturin#1729
  * Fix missing member in Cargo.toml for sdist of nested workspace
    layout
    gh#PyO3/maturin#1828
  * Metadata: escape display name in email addresses
    gh#PyO3/maturin#1832
  * Fix rewriting workspace Cargo.toml in sdist
    gh#PyO3/maturin#1841
  * Fix glob workspace members matching in sdist
    gh#PyO3/maturin#1846
  * Add sdist tests for well-known downstream repositories
    gh#PyO3/maturin#1849
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.

None yet

2 participants