Skip to content

Map google scholar package imports#535

Open
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:fix-google-scholar-import-mapping
Open

Map google scholar package imports#535
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:fix-google-scholar-import-mapping

Conversation

@StantonMatt

Copy link
Copy Markdown

Summary

  • map google_scholar_py imports to the scrape-google-scholar-py distribution
  • normalize local distribution-name comparisons so mapped hyphenated package names still match underscore-normalized installed dist-info names
  • keep serpapi unmapped because PyPI now has an official serpapi package; forcing it to google-search-results would break current import serpapi users

Addresses the google_scholar_py half of #370.

Verification

  • .venv/bin/python -m unittest tests.test_pipreqs.TestPipreqs.test_get_pkg_names_maps_google_scholar tests.test_pipreqs.TestPipreqs.test_get_import_local_matches_normalized_distribution_names tests.test_pipreqs.TestPipreqs.test_get_missing_imports_matches_normalized_distribution_names
  • .venv/bin/python -m unittest discover
  • uv run --with flake8 flake8 pipreqs tests
  • git diff --check
  • review-fix-loop: clean after fixing reviewer findings

Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
@bubaizhanshen

Copy link
Copy Markdown

I checked this locally on Python 3.10.

The google scholar mapping resolves as expected, and the normalized local-distribution comparison covers the scrape-google-scholar-py vs scrape_google_scholar_py spelling difference. With a local record named scrape_google_scholar_py exporting google_scholar_py, both the mapped distribution name and the import export are treated as present, not missing.

Checks I ran:

python -m unittest tests.test_pipreqs.TestPipreqs.test_get_pkg_names_maps_google_scholar tests.test_pipreqs.TestPipreqs.test_get_import_local_matches_normalized_distribution_names tests.test_pipreqs.TestPipreqs.test_get_missing_imports_matches_normalized_distribution_names
python -m py_compile pipreqs/pipreqs.py tests/test_pipreqs.py
python -m flake8 pipreqs tests
git diff --check upstream/master...HEAD

All passed.

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