Open imphil opened 5 months ago
PyPI releases (Python version numbers) do not contain leading 0's. 1.01.01
is 1.1.1
. The tag uses leading zeros to sort nicely, but the Python version number doesn't reflect that.
>>> import packaging.version
>>> packaging.version.Version("1.01")
<Version('1.1')>
I see. Unfortunately, that's causing a bit of confusion, since pre-commit uses the git tag in some places, and in other places the PyPi version:
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
- id: validate-pyproject
additional_dependencies:
- validate-pyproject[all]
- validate-pyproject-schema-store==2024.1.29
vs.
- repo: https://github.com/henryiii/validate-pyproject-schema-store
rev: "2024.01.29"
hooks:
- id: validate-pyproject
I haven't done further research on how other date-based projects solve this. Maybe giving up the sortability of the tags? If nothing else, a bit of documentation will help.
- repo: https://github.com/abravalheri/validate-pyproject
rev: v0.16
hooks:
- id: validate-pyproject
additional_dependencies:
- validate-pyproject[all]
- validate-pyproject-schema-store==2024.01.29
Works, I think. You can always add leading zeros. I’ll check some other CalVer projects to see how they tag.
Also, we are fully date-based CalVer, unlike say black which is year.month.version. Not sure there are many fully CalVer projects, most are hybrid. But this is an automated (mostly) update of something where really only the date matters. ¯_(ツ)_/¯
Thanks for looking into that! I guess another option to avoid the whole issue would be a version number like 20240131
. But either way, I think I can deal with it without much problem.
I tend to look up the latest version on PyPi, and used the version number showed there in my pre-commit configuration (where it expected a git tag), which didn't work. That's what caused me filing this issue in the first place.
Nox does the same thing FYI - tags include 0's, but some places (like PyPI) normalize them out.
The latest tag is
2024.01.29
, but the PyPi release is named2024.1.29
(note the missing0
). Looks like something with the release scripts is wrong?