Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Wheel tags does not remove existing build tags #587

Closed
ssabdb opened this issue Nov 22, 2023 · 3 comments
Closed

Wheel tags does not remove existing build tags #587

ssabdb opened this issue Nov 22, 2023 · 3 comments

Comments

@ssabdb
Copy link

ssabdb commented Nov 22, 2023

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

@ssabdb ssabdb changed the title Wheel tags does not remove build tags or modify them Wheel tags does not remove existing build tags Nov 22, 2023
@bgilbert
Copy link
Contributor

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.)

@henryiii
Copy link
Contributor

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.

@agronholm
Copy link
Contributor

The build tag can be removed with wheel tags --build="" mywheel-0.1.0-0.2.0-py3-none-any.whl.
This will result in mywheel-0.2.0-py3-none-any.whl with the Build: header removed from WHEEL.

@agronholm agronholm closed this as not planned Won't fix, can't repro, duplicate, stale Nov 8, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants