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 publishes package under different name #4631

Closed
1 task done
eblis opened this issue Oct 13, 2021 · 6 comments
Closed
1 task done

Poetry publishes package under different name #4631

eblis opened this issue Oct 13, 2021 · 6 comments
Labels
kind/bug Something isn't working as expected status/triage This issue needs to be triaged

Comments

@eblis
Copy link

eblis commented Oct 13, 2021

  • I am on the latest Poetry version.

  • [x ] I have searched the issues of this repo and believe that this is not a duplicate.

  • **Windows 10 x64 **:

  • Poetry version 1.1.11:

  • Pyproject.toml

[tool.poetry]
name = "peds_common"
version = "0.0.6"
description = "PEDS common libraries"
packages = [
	{ include = "peds" }
]
include = [ "README.md" ]

[[tool.poetry.source]]
name = 'peds'
url = '<artifactory url>/PEDSSW_pypi'

[tool.poetry.dependencies]
python = "^3.9"
pyaml = "^21.10.1"
cachetools = "^4.2.4"
colorlog = "^6.5.0"
colorama = "^0.4.4"
cryptography = "^35.0.0"

[tool.poetry.dev-dependencies]
pytest = "^6.2.5"

[build-system]
requires = ["poetry-core>=1.0.0"]
build-backend = "poetry.core.masonry.api"

Issue

Poetry says that it will deploy the project named peds_common, but it uploads to peds-common in Artifactory.
poetry publish command
image

package name in artifactory:
image

The version uploaded by poetry is 0.0.6 under peds-common, the other ones uploaded under peds_common are uploaded by setup.py before moving to poetry

@eblis eblis added kind/bug Something isn't working as expected status/triage This issue needs to be triaged labels Oct 13, 2021
@Mariatta
Copy link
Contributor

PEP 503 states that project names should be normalized as follows:

lowercased with all runs of the characters ., -, or _ replaced with a single - character.

If I understand the code correctly, poetry-core normalized your package name to peds-common.

https://github.com/python-poetry/poetry-core/blob/1ad005fcb371710c36bbead6cbdd14e6d7f8a948/poetry/core/utils/helpers.py#L26-L27, therefore when you use poetry to publish, it normalized the package name to peds-common

Perhaps setuptools did not normalize the package name per PEP 503, and therefore it uploaded to the peds_common instead of peds-common.

So I'm not sure if this is a bug. Perhaps needing some documentation/faq regarding this behavior.

@eblis
Copy link
Author

eblis commented Oct 18, 2021

If it's documented I think that's fine by me.
If I have the peds-common 0.0.5 version installed it will not update to 0.0.6, says that 0.0.5 is latest version available. But once I removed peds-common and reinstalled it then it picked 0.0.6 up automatically.

@shanelanan
Copy link

Is there anyway to override this behavior? I am trying to publish to an existing repository that I do not have control over. It was published with underscores from an old setup.py script.

@jack-mcivor
Copy link

Is this still valid? It seems to me like:

  • The name field of the [tool.poetry] section is respected for the upload path (hyphens stay hyphens, underscores stay underscores)
  • This is the version referenced in the output of poetry build
  • The built wheel and sdist replace hyphens with underscores in the package name
  • poetry version always replaces underscores with hyphens

@radoering
Copy link
Member

Should be resolved by python-poetry/poetry-core#620

Copy link

github-actions bot commented Mar 5, 2024

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 Mar 5, 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 status/triage This issue needs to be triaged
Projects
None yet
Development

No branches or pull requests

5 participants