Fixes #58 Implement egg-info version parsing#529
Open
arnowaschk wants to merge 1 commit into
Open
Conversation
…nfo and enhance tests for package name extraction
StantonMatt
reviewed
Jun 2, 2026
StantonMatt
left a comment
There was a problem hiding this comment.
I checked this locally against #58. The branch fixes the original no-version <package>.egg-info case in a way that keeps the package name usable instead of splitting the suffix as a bogus version.
Direct reproduction:
origin/master: [{'name': 'mypackage.egg', 'version': 'info', 'exports': ['mypackage']}]
pr-529: [{'name': 'mypackage', 'version': None, 'exports': ['mypackage']}]
I also checked the metadata path and the old directory-name fallback through the new tests. Local verification on Python 3.9.6:
python -m unittest tests.test_pipreqs.TestPipreqs.test_get_locally_installed_packages_ignores_egg_info_suffix tests.test_pipreqs.TestPipreqs.test_get_package_name_and_version_preserves_regular_version tests.test_pipreqs.TestPipreqs.test_get_package_name_and_version_keeps_hyphenated_name_without_version tests.test_pipreqs.TestPipreqs.test_get_locally_installed_packages_prefers_metadata_name
python -m unittest discover
python -m py_compile pipreqs/pipreqs.py tests/test_pipreqs.py
python -m flake8 pipreqs/pipreqs.py tests/test_pipreqs.py
git diff --check origin/master...HEAD
The focused tests passed, full discovery passed 33 tests, and lint/compile/diff checks passed. GitHub reports no check runs for this PR, so there is no upstream CI result to claim, but I do not see a blocking issue from this pass.
Author
|
@StantonMatt Thank you for your efforts! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #58
pipreqscould misparse<package>.egg-infometadata directories and emit malformed package/version pairs. This patch:METADATA/PKG-INFOwhen availableI verified the focused regression tests locally.
Greetings Arno