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

poetry new silently transforms underscores to dashes #8848

Closed
4 tasks done
Gerrit-K opened this issue Jan 4, 2024 · 6 comments
Closed
4 tasks done

poetry new silently transforms underscores to dashes #8848

Gerrit-K opened this issue Jan 4, 2024 · 6 comments
Labels
kind/bug Something isn't working as expected

Comments

@Gerrit-K
Copy link
Contributor

Gerrit-K commented Jan 4, 2024

  • Poetry version: 1.7.1

  • Python version: 3.9.18

  • OS version and name: macOS 14.2.1 (23C71)

  • pyproject.toml: none, see repro steps 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

Poetry doesn't handle underscores in package names really well. Two examples are:

  • poetry new test_package
    • prints Created package test_package in test_package
    • but cat test_package/pyproject.toml actually prints name = "test-package"
  • poetry version still prints test-package, even if you manually change pyproject.toml to name = "test_package"
@Gerrit-K Gerrit-K added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Jan 4, 2024
@Gerrit-K Gerrit-K changed the title Poetry new silently transforms underscores to dashes poetry new silently transforms underscores to dashes Jan 4, 2024
@dimbleby
Copy link
Contributor

dimbleby commented Jan 4, 2024

that is the correctly normalized package name, not a bug

@Gerrit-K
Copy link
Contributor Author

Gerrit-K commented Jan 4, 2024

You're right, sorry. I somehow didn't find PEP-503 when researching this.

@Gerrit-K Gerrit-K closed this as completed Jan 4, 2024
@Gerrit-K
Copy link
Contributor Author

Gerrit-K commented Jan 4, 2024

Though, on second thought, I'd argue that poetry version should at least return whatever is set as name. This is done correctly in poetry publish, e.g. name = "test_package" is correctly published as test_package, but poetry version results in test-package 0.1.0.

@dimbleby is this also by design?

@dimbleby
Copy link
Contributor

dimbleby commented Jan 4, 2024

🤷

if you want to submit a merge request changing package.name to package.pretty_name at

f"<comment>{self.poetry.package.name}</>"
then I wouldn't much care either way, but no doubt a maintainer would take a view

@Gerrit-K
Copy link
Contributor Author

Gerrit-K commented Jan 4, 2024

Alright, thank you! I'll take a look

Copy link

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 29, 2024
@abn abn removed the status/triage This issue needs to be triaged label Mar 2, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
kind/bug Something isn't working as expected
Projects
None yet
Development

No branches or pull requests

3 participants