InvalidVersion: Inconsistency in version handling
See original GitHub issue- I am on the latest Poetry version.
- I have searched the issues of this repo and believe that this is not a duplicate.
- If an exception occurs when executing a command, I executed it again in debug mode (
-vvv
option).
- OS version and name: Running in Github Actions on
ubuntu-latest
- Poetry version: 1.0.8
- Link of a Gist with the contents of your pyproject.toml file: https://gist.github.com/djjudas21/c239c36a51385f40f7b97baa751027a5
Issue
I’m using Poetry in a Github Actions pipeline to set the version based on the git tag, and then to build and publish my project. My pipeline is configured like this but effectively runs:
poetry version <git tag>
poetry publish -n --build --username __token__ --password ${{ secrets.pypi_password }}
The git tag is a semver with an optional trailing name and the poetry version
command succeeds in setting the version, but then poetry publish
rejects the version. In this case the version is 0.9.4-poetry5
and it yields the following output:
# Run poetry version 0.9.4-poetry5
Bumping version from 0.0.0 to 0.9.4-poetry5
# Run poetry publish -n --build --username __token__ --password ***
[InvalidVersion]
Invalid version: '0.9.4-poetry5'
##[error]Process completed with exit code 1.
Full output of the pipeline is available.
Why does Poetry accept the version in poetry version
and later reject it in poetry publish
? Thanks
Issue Analytics
- State:
- Created 3 years ago
- Reactions:3
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Update module to > v2 - HUGO
invalid version : module contains a go.mod file, so major version must be compatible: should be v0 or v1, not v2.
Read more >Receiving 404 "Invalid version: graph.microsoft.com" for 80 ...
Hi,. Our code for querying https://graph.microsoft.com/v1.0/me stopped working suddenly today. We request the users details with the OAuth ...
Read more >Version Handling - Packaging
InvalidVersion – When the version string is not a valid version. This class abstracts handling of a project's versions. A Version instance is...
Read more >Inconsistency in production version - SAP Community
i am facing this problem with all new product codes created from last months period change. because of this i am not able...
Read more >Core version key in module's .info.yml doesn't respect ... - Drupal
Determine if profiles .info.yml files should be handled in a ... Could not parse version constraint 8.nonsense: Invalid version string ...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
IMHO, restricting versions to the PEP 440 regex excludes a lot of use-cases.
I think I have a similar problem. I want to publish a temporary branch version with this:
X.Y.Z-<branch>+<build>
poetry version
has no problem with that butpoetry build
can’t handle it.Here are a couple of tests:
It’s coming from here: https://github.com/python-poetry/poetry/blob/1.0.10/poetry/utils/helpers.py#L33-L34 https://github.com/python-poetry/poetry/blob/1.0.10/poetry/version/version.py#L14-L56
The regex has a particularly demanding format because while official SemVer says the prerelease component can be an arbitrary string, Python opts for this particular form which Poetry is using: https://semver.org/#spec-item-9 https://www.python.org/dev/peps/pep-0440/