I am trying to create a snapshot/daily build of my Python package, using Setuptools and Build (the PEP 517 build module).
I have tried adapting this section of the Setuptools documentation: https://setuptools.pypa.io/en/latest/userguide/distribution.html#tagging-and-daily-build-or-snapshot-releases
However, none of the following commands worked:
python -m build --config-setting=--tag-date myproject
python -m build --config-setting=tag-date myproject
python -m build --tag-date myproject
The first two build the package without the version tag, while the third is an error. The results are the same when I use --tag-build
instead of --tag-date
.
How can I tell Setuptools to add the version tag, if none of the above options work?
I do not have a setup.py
, only a setup.cfg
. I cannot use setup.py bdist_wheel --tag-date
, this command will say "File not found" because setup.py
does not exist in my project.
EDIT after searching through Setuptools issue tracker, I also tried the following commands, with no success:
python -m build --config-setting=--global-options=--tag-date myproject
python -m build --config-setting=--global-options=tag-date myproject
python -m build --config-setting=global-options=--tag-date myproject
python -m build --config-setting=global-options=tag-date myproject
Digging through the setuptools
code, it looks like the --tag-date
and the --tag-build
options are available if passed to egg_info
.
Example:
python setup.py egg_info --tag-date --tag-build=dev bdist_wheel
As for combining setuptools
with build
, you were almost there, it's just that you had to chain egg_info
and --tag-date
together:
python -m build -C--global-option=egg_info -C--global-option=--tag-date --wheel
Note that --tag-date
doesn't take any value, it will just add date stamp (e.g. 20050528) to version number
Resources:
Source code for setuptools: https://github.com/pypa/setuptools/blob/00fbad0f93ffdba0a4d5c3f2012fd7c3de9af04d/setuptools/command/egg_info.py#L159
Package version:
build 0.7.0
setuptools 60.10.0