Skip to content

Comments

Add wheel info subcommand#669

Merged
agronholm merged 10 commits intopypa:mainfrom
killerdevildog:feature/wheel-info-subcommand
Feb 15, 2026
Merged

Add wheel info subcommand#669
agronholm merged 10 commits intopypa:mainfrom
killerdevildog:feature/wheel-info-subcommand

Conversation

@killerdevildog
Copy link
Contributor

Implements GitHub issue #639: Add wheel info subcommand to display metadata about wheel files without unpacking them.

Features:

  • Shows package name, version, and build information
  • Displays wheel format version and generator
  • Lists supported Python versions, ABI, and platform tags
  • Shows package metadata (summary, author, license, classifiers)
  • Displays dependencies and file count/size information
  • Optional verbose mode with detailed file listing
  • Comprehensive error handling for missing files

Changes:

  • Add src/wheel/_commands/info.py with main implementation
  • Update src/wheel/_commands/init.py to register new command
  • Add tests/commands/test_info.py with comprehensive test coverage
  • Add docs/reference/wheel_info.rst with usage documentation
  • Update docs/reference/index.rst to include new command docs
  • Update docs/user_guide.rst with info command examples
  • Update docs/manpages/wheel.rst with info command reference

Addresses #639
See #639

killerdevildog and others added 2 commits July 19, 2025 00:44
Implements GitHub issue pypa#639: Add wheel info subcommand to display
metadata about wheel files without unpacking them.

Features:
- Shows package name, version, and build information
- Displays wheel format version and generator
- Lists supported Python versions, ABI, and platform tags
- Shows package metadata (summary, author, license, classifiers)
- Displays dependencies and file count/size information
- Optional verbose mode with detailed file listing
- Comprehensive error handling for missing files

Changes:
- Add src/wheel/_commands/info.py with main implementation
- Update src/wheel/_commands/__init__.py to register new command
- Add tests/commands/test_info.py with comprehensive test coverage
- Add docs/reference/wheel_info.rst with usage documentation
- Update docs/reference/index.rst to include new command docs
- Update docs/user_guide.rst with info command examples
- Update docs/manpages/wheel.rst with info command reference
@codecov
Copy link

codecov bot commented Jul 19, 2025

Codecov Report

❌ Patch coverage is 88.23529% with 10 lines in your changes missing coverage. Please review.
✅ Project coverage is 55.14%. Comparing base (39039c0) to head (e048716).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
src/wheel/_commands/info.py 89.33% 8 Missing ⚠️
src/wheel/_commands/__init__.py 80.00% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #669      +/-   ##
==========================================
+ Coverage   52.63%   55.14%   +2.50%     
==========================================
  Files          14       15       +1     
  Lines        1121     1206      +85     
==========================================
+ Hits          590      665      +75     
- Misses        531      541      +10     

☔ View full report in Codecov by Sentry.
📢 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.

@agronholm
Copy link
Contributor

Did you no longer need this, or why did you close the PR?

@killerdevildog
Copy link
Contributor Author

I've faced criticism and harassment on previous pull requests that involved assistance from LLMs. Given that this PR exceeds 330 lines of code, I decided to close it to avoid burdening reviewers with such a large review—even though I'm confident it provides a valid fix for the issue. If you'd like me to reopen it, please let me know. I'm just trying to contribute without being harassed, intimidated, or bullied. Professional criticism is acceptable, but following people around to get PRs closed simply because AI was used to make it function is not.

@agronholm
Copy link
Contributor

Have you faced such criticism in this project, or another PyPA project, or from me? What matters to me is that you can explain what your code does and why. I have rejected AI generated patches in the past because the authors could not explain them to me, and the quality of AI code generated as of today tends to be subpar. But I certainly don't follow people around harassing them for this.

@killerdevildog killerdevildog reopened this Aug 7, 2025
@killerdevildog
Copy link
Contributor Author

Thanks for clarifying. The issues were in other PyPA projects, not this one or from you. I'm able to explain the code fully—it's my work with some LLM aid for initial drafting, but I understand and tested it thoroughly. Happy to address any questions.

The PR directly implements the feature requested in Issue #639, which asks for a new wheel info subcommand to display metadata (e.g., package name, version, dependencies) for a .whl file or PyPI package without unpacking it. The changes add a new command module, tests, and documentation to achieve this, reading data straight from the wheel's zip structure for efficiency.

@agronholm
Copy link
Contributor

Thanks for the explanation. I'm not currently working on wheel, and I had to yank the last couple releases which makes me apprehensive about any changes I make to the repo. This PR, however, doesn't have such issues as it's completely new functionality, so I will get back to this once I resume work here.

Copy link
Contributor

@agronholm agronholm left a comment

Choose a reason for hiding this comment

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

A changelog entry needs to be added in docs/news.rst and the issues I pointed out need to be resolved.

@agronholm
Copy link
Contributor

Also, the test failure on Python 3.14 needs to be resolved, but that doesn't look like a major issue.

@agronholm
Copy link
Contributor

@henryiii What do you think of the feature in general?

@killerdevildog
Copy link
Contributor Author

@agronholm
I hadn't taken a look into this since August. Ill fix this pr in the next few days.

killerdevildog and others added 2 commits February 11, 2026 17:50
- Remove unused tmp_path_factory parameter from test_info_basic and test_info_verbose
- Use pytest.raises(FileNotFoundError, match=...) instead of try/except in test_info_nonexistent_file
- Fix test_info_help to not depend on argv[0] being 'wheel' (fixes Python 3.14 CI failure)
- Add changelog entry in docs/news.rst for the new wheel info subcommand
@killerdevildog
Copy link
Contributor Author

Hi @agronholm, thanks for the review feedback. I've pushed a commit addressing all your requested changes:

Removed unused tmp_path_factory — Removed the unnecessary TempPathFactory parameter from test_info_basic() and test_info_verbose().

Replaced try/except with pytest.raises — test_info_nonexistent_file now uses pytest.raises(FileNotFoundError, match="Wheel file not found: nonexistent.whl") to properly test the error case, calling info() directly since the CLI runner catches WheelError internally.

Fixed the Python 3.14 test failure — test_info_help was asserting "usage: wheel info" but sys.argv[0] differs depending on how the tests are invoked (e.g. python -m pytest instead of wheel). Updated the assertion to check for the help content without depending on the program name.

Added changelog entry — Added an entry under UNRELEASED in news.rst referencing issue #639.

All tests pass on both Python 3.12 and 3.14.

@agronholm
Copy link
Contributor

Alright, apart from the pre-commit check failing, the changes look good. Before I merge, I'd like someone else from the PyPA to weigh in on the output of the command.

Remove python_tag, abi_tag, and platform_tag assignments that were
extracted from the wheel filename but never used.
Copy link
Contributor

@agronholm agronholm left a comment

Choose a reason for hiding this comment

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

I'll solicit outside opinions on the output of the command before merging.

@pfmoore
Copy link
Member

pfmoore commented Feb 12, 2026

This feels like it is bound to get requests for JSON format output. Maybe add that now to avoid churn?

@agronholm
Copy link
Contributor

@killerdevildog The feedback sounds reasonable. Let me know your thoughts.

@killerdevildog
Copy link
Contributor Author

@pfmoore Thanks — agreed on both points.

Multiple Generator values: the Discourse thread makes it pretty clear the spec wording is ambiguous and historically probably assumed a single generator, but there’s a strong practical case for allowing multiple when a wheel is rewritten by tools like auditwheel/delocate (provenance + debugging regressions). In particular, treating repeated Generator: lines as an ordered history (original builder first, subsequent rewriters after) seems like a reasonable model. I’ll update the wheel info implementation to handle multiple Generator entries rather than assuming only one.

JSON output: I agree it’s likely people will ask for machine-readable output. If you’re happy with it in this PR, I can add a JSON output mode in a follow-up commit; otherwise I can leave it for a separate PR to keep this one narrowly focused.

Let me know if you have a preference on how multiple Generator values should be rendered in the human-readable output (e.g., repeated lines vs. a small “history” block).

@agronholm
Copy link
Contributor

The repeated-lines approach is what I would have assumed as well, so go with that. As for the JSON output, that can be deferred to a new PR.

killerdevildog and others added 3 commits February 12, 2026 20:44
- Move changelog entry to UNRELEASED section per project release process
  (was incorrectly placed under the already-released 0.46.2 heading)
- Add test for zero Generator values (test_info_no_generator)
- Add exact count assertion for multiple Generator lines
- Refactor test helpers: extract _build_wheel_with_modified_metadata()
  and _capture_info_output() for reusable wheel modification with
  proper RECORD hash updates
- Move all imports to module level (no more inline imports in tests)
- 8 tests now cover: basic info, single generator, multiple generators,
  zero generators, verbose output, nonexistent file, help, and -v flag
Updated warning messages to print to stderr.
@agronholm agronholm merged commit 0ce509e into pypa:main Feb 15, 2026
16 checks passed
@agronholm
Copy link
Contributor

Thanks. Looking forward to that JSON output PR.

@killerdevildog
Copy link
Contributor Author

@agronholm I will work on that this week. Thanks for letting me participate.

@agronholm
Copy link
Contributor

Sorry for taking this long to get around to this. My work on wheel had been paralyzed for a long time due to backlash from releases that attempted to shed obsolete parts such as bdist_wheel. But selectively backtracking on that seems to have worked, as the only issue that was posted since then was about the test dependencies.

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.

4 participants