Skip to content

fix: reject empty components in wheel tags CLI - #700

Open
Pitchfork-and-Torch wants to merge 1 commit into
pypa:mainfrom
Pitchfork-and-Torch:cook/reject-empty-tag-components
Open

Pitchfork-and-Torch wants to merge 1 commit into
pypa:mainfrom
Pitchfork-and-Torch:cook/reject-empty-tag-components

Conversation

@Pitchfork-and-Torch

Copy link
Copy Markdown

Summary

  • _compute_tags accepted '', py3..py2, +, trailing dots, etc., producing empty tag strings.
  • That yields invalid wheel filenames such as pkg-1.0..none-any.whl and empty Tag: headers.
  • Raise ValueError when any split tag component is empty.

Test plan

  • Unit test test_compute_tags_rejects_empty_components
  • Valid tags (cp39, +py2, replace/remove) unchanged

`--python-tag ''`, `py3..py2`, `+`, and trailing dots produced empty
tag strings and invalid wheel names like `pkg-1.0..none-any.whl`.
Raise ValueError when any split tag component is empty.
@codecov

codecov Bot commented Sep 18, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 63.71%. Comparing base (b25c3c2) to head (cf1df12).

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #700      +/-   ##
==========================================
+ Coverage   63.45%   63.71%   +0.25%     
==========================================
  Files          15       15              
  Lines        1267     1276       +9     
==========================================
+ Hits          804      813       +9     
  Misses        463      463              

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@sylvesterkaczmarek sylvesterkaczmarek left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

-py3 can still leave the final tag set empty when py3 is the only original component. The input has no empty part, so this passes validation and later joins to an empty filename/tag component. Could _compute_tags() reject an empty result too, with a remove-last-tag test?

This branch has not been deployed

No deployments
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

Successfully merging this pull request may close these issues.

2 participants