Skip to content

[BUG] --tag-date and --tag-build have no effect when building in PEP 517 mode #2955

Closed
@Thf772

Description

@Thf772

setuptools version

60.0.3

Python version

3.9.0

OS

Windows 10

Additional environment information

Other possibly relevant packages:

build==0.7.0
pip==21.3.1
wheel==0.37.0

Description

According to the Setuptools documentation, it is possible to specify a version tag from the command line. The typical usecase is a project with automated builds, in ordere to avoid modifying the setup files everytime to change the version (this is my usecase).

When building a PEP 518 project that has no setup.py, it is impossible to use --tag-build and --tag-date to add a version suffix from the command line.

All of the following commands will produce a distribution with no version tag:

python -m build --config-setting=--tag-date myproject
python -m build --config-setting=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
python -m build --config-setting=global-options=tag-date myproject

(I have tried the latter 4 after reading issue #2491)

The following command simply fails (which is normal):

python -m build --tag-date myproject

Expected behavior

The source and wheel distribution are produced with the version number from setup.cfg suffixed by the build tag or date tag (depending to the option used).

For instance, if the version number in setup.cfg is 0.0.0 and tag-build=nightly is used, the expected output is a source and wheel distribution with version 0.0.0.nightly.

How to Reproduce

  1. Create a valid PEP 518 project using setuptools.build_meta as the build backend
  2. Ensure there is a setup.cfg file but no setup.py
  3. Run any of the following commands:
python -m build --config-setting=--tag-date myproject
python -m build --config-setting=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
python -m build --config-setting=global-options=tag-date myproject

Output

Assuming the version number in setup.cfg is 0.0.0:

(myvenv) PS D:\myproject> python -m build --config-setting=tag-date myproject
[Redacted the build output for brievity]
Successfully built myproject-0.0.0.tar.gz and myproject-0.0.0-py3-none-any.whl

The source dist and wheel in the dist directory both have the version number 0.0.0.

Code of Conduct

  • I agree to follow the PSF Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions