Description
There are times where external tooling needs access to the version number of the package/application during the build step.
As is the case during the build step, the application is not yet installed at that point. Nor do you necessarily want to do that on the build environment (think: building in a remote pipeline).
I currently resorted to storing the version number in a <package>/version.txt
file which I then read in the <package>/__init__.py
file. This has the advantage that the version is available in a predictable location and is easily readablo by any external tool. It has the downside that it confuses pyinstaller
.
flit
already manages to extract the version number from the build process. And there is no need to specify it in the ptproject.toml
file. Which is really nice.
But that means that there is no way to get to the version number from external tools. Before the pyproject.toml
file switch, one could also do python setup.py --version
which is also no longer possible.
It would be really nice if flit
had a command to do just that.
Tangentially, there are other useful setup.py
commands which help during build steps like --name
and --fullname
which I used to determine filenames of contents in the dist
folder. With those it was however not possible to get the filename of a generated whl
file. I think flit
would be in a good position to offer those as well.