Skip to content

Feature request: support pyproject.toml version strings #391

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

Closed
bersbersbers opened this issue Jan 23, 2023 · 3 comments
Closed

Feature request: support pyproject.toml version strings #391

bersbersbers opened this issue Jan 23, 2023 · 3 comments

Comments

@bersbersbers
Copy link

Python version strings, at least as defined in pyproject.toml files, use something to the sort of [N!]N(.N)*[{a|b|rc}N][.postN][.devN].

Situation

>>> semver.Version.parse("1.2.3.4")                                  
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Users\vers\.pyenv-win-venv\envs\project\Lib\site-packages\semver\version.py", line 608, in parse
    raise ValueError(f"{version} is not valid SemVer string")
ValueError: 1.2.3.4 is not valid SemVer string

Possible Solution/Idea

Support more (all?) possible Python version strings.

Additional context

@tomschr
Copy link
Member

tomschr commented Jan 23, 2023

Hi @bersbersbers, 👋

thanks for your bug report, much appreciated! 👍

Your request goes beyond what the semver spec and this library supports. The error message you received is correct. Python version strings are unfortunately not fully semver compatible. This is the bad news.

The good news is that to some degree it's possible to convert from one version spec to the other. I covered this already in the section Converting versions between PyPI and semver. The documentation mentions explicitly PEP 440.

If something is not covered in the documentation, I'm more than happy to amend the text. However, adding support for PEP440 into the library is out of scope.

Is the above documentation sufficient for your use case?

@bersbersbers
Copy link
Author

This is great, thank you!

Sorry for opening this without any need - I had searched for PEP 440 in the issue without finding anything, yet had not checked out the docs before. I guess other people doing the same will now at at least find this very issue ;)

@tomschr
Copy link
Member

tomschr commented Jan 23, 2023

Don't worry, this is absolutely no problem. 🙂 Thanks for commenting.

Yes, there was a similar feature request some time ago. Seems I need to advertise the docs more prominently. 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants