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

Prevent poetry from creating projects with invalid project names #10170

Open
Ronimsenn opened this issue Feb 11, 2025 · 0 comments
Open

Prevent poetry from creating projects with invalid project names #10170

Ronimsenn opened this issue Feb 11, 2025 · 0 comments
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged

Comments

@Ronimsenn
Copy link

Issue Kind

Change in current behaviour

Description

Using Poetry 2.0.1 on Windows 11.

When creating a poetry project with a + in the project name - might be the same for other invalid characters -, generation runs smoothly:

D:\Development\test> poetry init -v

This command will guide you through creating your pyproject.toml config.

Package name [test]:  test+test
Version [0.1.0]:
Description []:
Author [Your Name <[email protected]>, n to skip]:  n
License []:
Trying to detect current active python executable as specified in the config.
Found: D:\Program Files\Python313\python.EXE
Compatible Python versions [>=3.13]:

Would you like to define your main dependencies interactively? (yes/no) [yes] no
Would you like to define your development dependencies interactively? (yes/no) [yes] no
Generated file

[project]
name = "test+test"
version = "0.1.0"
description = ""
authors = [
    {name = "Your Name",email = "[email protected]"}
]
readme = "README.md"
requires-python = ">=3.13"
dependencies = [
]

[build-system]
requires = ["poetry-core>=2.0.0,<3.0.0"]
build-backend = "poetry.core.masonry.api"

Do you confirm generation? (yes/no) [yes] yes

Then, when trying to add a new dependency with poetry add, it fails due to an invalid project name:

D:\Development\test> poetry add requests

The Poetry configuration is invalid:
  - project.name must match pattern ^([a-zA-Z\d]|[a-zA-Z\d][\w.-]*[a-zA-Z\d])$

Impact

Prevent the user from creating projects with invalid names.
While the current behaviour is not in any way problematic or breaking, it's unexpected and should be improved in my opinion.

Workarounds

Use a project name with no + :)

@Ronimsenn Ronimsenn added kind/feature Feature requests/implementations status/triage This issue needs to be triaged labels Feb 11, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Feature requests/implementations status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

1 participant