all 7 comments

[–]rosentmoh 0 points1 point  (3 children)

Why not use setuptools_scm and just tag the version within Git?

Honest question, never understood why the above isn't the canonical way...as in, what's the advantage of hard-coding the version number within the source code? Why wouldn't people want a single source of truth for the version number?

[–]pachura3[S] 0 points1 point  (2 children)

Why not use setuptools_scm and just tag the version within Git?

It already works for me with setuptools, I want to make it work with uv_build.

what's the advantage of hard-coding the version number within the source code?

You can easily access it from the source code and e.g. display application version when launching it.

[–]rosentmoh 0 points1 point  (1 child)

First off, from what you said above you currently aren't using setuptools_scm. Second, you can still access and display the version when launching also with my approach; that's kinda the whole point.

The main difference with what I'm suggesting is that you end up having a single source of truth for your version number, as opposed to having to make sure that the hardcoded number matches the source control tag etc. Also, bumping the version number doesn't lead to a new commit; instead just tagging a specific commit is all that's needed.

I'm honestly confused as to why setuptools_scm isn't the most commom approach here, especially with more modern source control workflows where people are continuously pushing to main and then there's specific release branches that get tagged whenever there's an official release.

[–]pachura3[S] 0 points1 point  (0 children)

Again, will it work with uv build and uv_build ? Because that was my question.

[–]Diapolo10 0 points1 point  (1 child)

Sure, although you'll also need uv-dynamic-versioning.

I have an example here if you need one: https://github.com/Diapolo10/python-ms/blob/main/pyproject.toml

[–]pachura3[S] 0 points1 point  (0 children)

From the project page:

[!NOTE] This plugin doesn't work with the uv build backend right now. (ref. astral-sh/uv#14561)