Skip to content

Map common import names to their package names - #531

Open
bubaizhanshen wants to merge 1 commit into
bndr:masterfrom
bubaizhanshen:map-hyphenated-packages
Open

Map common import names to their package names#531
bubaizhanshen wants to merge 1 commit into
bndr:masterfrom
bubaizhanshen:map-hyphenated-packages

Conversation

@bubaizhanshen

@bubaizhanshen bubaizhanshen commented Jun 1, 2026

Copy link
Copy Markdown

Fixes #491. Addresses part of #360.

This maps common import names to their package names for kafka, janitor, skimage, and sklearn, and adds regression coverage for those aliases.

Checks:

  • python -m unittest tests.test_pipreqs.TestPipreqs.test_get_pkg_names tests.test_pipreqs.TestPipreqs.test_get_pkg_names_maps_common_import_aliases
  • python -m py_compile pipreqs/pipreqs.py tests/test_pipreqs.py
  • flake8 tests/test_pipreqs.py
  • git diff --check

@StantonMatt StantonMatt 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.

I checked this branch locally. The mapping changes are consistent with the existing import-to-distribution override path, and the new test covers the four aliases directly.

Validation from a project-local Python 3.9 venv:

  • PYTHONPATH=. python -m unittest tests.test_pipreqs.TestPipreqs.test_get_pkg_names tests.test_pipreqs.TestPipreqs.test_get_pkg_names_maps_common_import_aliases -> 2 tests, OK
  • PYTHONPATH=. python -m py_compile pipreqs/pipreqs.py tests/test_pipreqs.py -> OK
  • python -m flake8 tests/test_pipreqs.py -> OK
  • git diff --check origin/master...HEAD -> OK

Only local note: the unittest command emitted urllib3's LibreSSL warning from this macOS Python; it was not from this patch.

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.

Issue with libraries with hyphens "-" in the name

2 participants