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

Author Regex Too Restrictive #6933

Open
4 tasks done
muellert opened this issue Nov 1, 2022 · 3 comments · May be fixed by python-poetry/poetry-core#517
Open
4 tasks done

Author Regex Too Restrictive #6933

muellert opened this issue Nov 1, 2022 · 3 comments · May be fixed by python-poetry/poetry-core#517
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Milestone

Comments

@muellert
Copy link

muellert commented Nov 1, 2022

  • Poetry version: 1.2.2
  • Python version: 3.9
  • OS version and name:
  • pyproject.toml: not relevant, see below
  • I am on the latest stable Poetry version, installed using a recommended method.
  • I have searched the issues of this repo and believe that this is not a duplicate.
  • I have consulted the FAQ and blog for any relevant entries or release notes.
  • If an exception occurs when executing a command, I executed it again in debug mode (-vvv option) and have included the output below.

Issue

I am trying to use Poetry in an environment where user names, as per the Gecos field, are structured like 'Surname, Given Name [Department]'. If I run 'poetry new testing-poetry', I get a pyproject.yaml file that has

authors = ["Surname, Given Name [Department]"]

When I now run 'poetry build', this will bomb out with

"Invalid author string. Must be in the format: John Smith john@example.com"

I suggest augmenting the AUTHOR_REGEX, which, in "my" installation (virtualenv) is duplicated in

core/masonry/builders/builder.py and
core/package/package.py

to allow for square brackets in the name field of the author.

@muellert muellert added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Nov 1, 2022
@Jenjen1324
Copy link

Just as a heads up, one might want to check what restrictions should actually be placed on the author name:

Per PEP621 the authors/maintainers name MUST be a valid email name. It refers to RFC 822, but I found the following SO post which explains what an email name is a bit more clearly: https://stackoverflow.com/a/2049510/2232127 (the post also refers to this nice Wikipedia article: https://en.wikipedia.org/wiki/Email_address#Local-part )

While [] seems to be allowed, they seem to require escaping and explicit quoting when used in an email address. So in general I'd be weary of actually using [] in the author.

@muellert
Copy link
Author

muellert commented Feb 7, 2023

The square brackets are not part of the author email, but part of the author name. Also, using or not using them is beyond my sphere of influence because this aspect of naming is managed by the organization, and I have no say in that whatsoever. To recap, what the organization gives me, is of the form

"Last, First [department]" <someid@example.com>

In this example, 'someid' is the local part of the email, but poetry falls over at the square brackets in the 'display-name' field (please refer to RFC 2822, section 3.4). The local part of the email address is perfectly fine and contains no problematic characters.

@whinee
Copy link

whinee commented Apr 3, 2023

Hello, I would like to add to this (arguably) dead discussion.

According to the linked wiki article: en.wikipedia.org/wiki/Email_address#Local-part, tilde (~) and exclamation point (!) is allowed in E-mail. But from my testing, it it not allowed in the author's name.

I guess using goofy author names like whi~nyaan! will have the coding gods strike a lighting upon you. But still...

@Secrus Secrus added this to the Poetry 2.0 milestone Oct 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants