cnpryer/huak

Improve `Version` implementation used for Python interpreter

cnpryer opened this issue · 4 comments

All the struct implements right now is naive release data that expects vec![major,minor,micro/patch], doing things like defaulting to 0 for each if not provided. In general the struct has little surface area, one major use-case, and limited in behaviors. For those reasons I’ll tag this as a good first issue, but feel free to ping me if you have any questions.

Hatch has a simple but clean approach to versioning. Maybe something similar can be supported.

https://hatch.pypa.io/latest/version/

The __version__ attribute is compliant with PEP specification. https://peps.python.org/pep-0621/#version

This is what it would look like.

[project]
...
dynamic = ["version"]

[tool.hatch.version]
path = "{{pkg_name}}/__about__.py"

I guess a middle point can be found. I don't know how cargo manages lib or bin version. But something similar might be doable with the pyproject.toml if the approach hatch has is too different from the cargo experience.

I guess you would only need something like this

[project]
version = "0.0.1"

And then the command will update the field directly in the pyproject.toml

Hi! Thanks for sharing this. So maybe I can do a better job clarifying here. This issue is related to the Version struct Im using for the Python interpreter version numbers Huak finds.

If you want to create an issue for this idea that'd be great :) Could gather more feedback there.

I've added RequestedVersion to huak-python-manager. It'd be ideal to have some dynamic semver struct to use RequestedVersion throughout the project.