pypa/wheel

Wheel tags does not remove existing build tags

Opened this issue · 2 comments

Running wheel tags whilst attempting to modify the the build tag results in some strange behavior. This might be a documentation problem but the behavior was not what I was expecting.

Command

wheel tags --build=0.2.0 dist/mywheel-0.1.0-py3-none-any.whl

Expectation:

Resultant filename: mywheel-0.2.0-py3-none-any.whl,
mywheel-0.2.0.dist-info/WHEEL: Tag updated to Build: 0.2.0

Instead:

Resultant filename: mywheel-0.1.0-0.2.0-py3-none-any.whl
mywheel-0.1.0.dist-info/WHEEL: Added tag Build: 0.2.0, and Build: 0.1.0 also retained.

Also attempted

I also attempted to remove the 0.1.0 build tag by prefixing with a - as per the documentation:

usage: wheel tags [-h] [--remove] [--python-tag TAG] [--abi-tag TAG] [--platform-tag TAG] [--build BUILD] [wheel ...]

Make a new wheel with given tags. Any tags unspecified will remain the same. Starting the tags with a "+" will append to the existing tags.
Starting with a "-" will remove a tag (use --option=-TAG syntax). Multiple tags can be separated by ".". The original file will remain unless
--remove is given.

wheel tags --build=-0.1.0 dist/mywheel-0.1.0-0.2.0-py3-none-any.whl
wheel tags: error: argument --build: build tag must begin with a digit

Usecase

My usecase for this is for my CI to be able to build and test a wheel prior to me tagging it ready for release, and so I will want to update the wheel from a prerelease to a release version.

wheel version
wheel 0.41.3

The build tag is not the same as the distribution version, and most wheels don't have a build tag at all. So, the behavior you're describing seems correct to me. Though the name "build tag" confusingly includes the word tag, the spec for compressed tag sets doesn't cover build tags, so I wouldn't expect the +/-/. syntax to work for those.

However, I'm surprised by the "Build: 0.1.0 also retained" part. I'm not seeing that locally, and wouldn't expect such a header to exist in the original wheel.

(I'm not affiliated with this project, just happened to notice your bug.)

You can’t change the version since often the version is hardcoded into the wheel in the source as a __version__ value. Maybe we should have added an option for that, but I think it would be very hard to use correctly.

The build tag is an optional thing that wheels don’t have by default. It’s called a tag and not a number since it can be anything.