huak icon indicating copy to clipboard operation
huak copied to clipboard

Improve `Version` implementation used for Python interpreter

Open cnpryer opened this issue 1 year ago • 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.

cnpryer avatar Apr 11 '23 02:04 cnpryer

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

Tomperez98 avatar Apr 20 '23 18:04 Tomperez98

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

Tomperez98 avatar Apr 20 '23 18:04 Tomperez98

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.

cnpryer avatar Apr 20 '23 20:04 cnpryer

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

cnpryer avatar Oct 29 '23 14:10 cnpryer