Skip to content

Deduplicate generated requirements#537

Open
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:dedupe-generated-requirements
Open

Deduplicate generated requirements#537
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:dedupe-generated-requirements

Conversation

@StantonMatt

Copy link
Copy Markdown

Summary

  • Deduplicate generated requirement entries by normalized package name before writing output
  • Keep the first resolved versioned entry, while allowing a later versioned alias to replace an unpinned one
  • Leave --diff and --clean raw-name comparisons unchanged so existing requirement spellings are preserved

Context

Addresses the duplicate-output part of #504, including cases such as PyYAML/pyyaml and repeated local package records.

Verification

  • .venv/bin/python -m unittest tests.test_pipreqs.TestPipreqs.test_deduplicate_imports_uses_normalized_package_names tests.test_pipreqs.TestPipreqs.test_init_deduplicates_normalized_requirements tests.test_pipreqs.TestPipreqs.test_init_clean_keeps_normalized_alias_requirements
  • .venv/bin/python -m unittest discover
  • uv run --with flake8 flake8 pipreqs tests
  • git diff --check
  • review-fix-loop: no actionable correctness issues

Signed-off-by: Matthew Stanton <stantonmatthewj@gmail.com>
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.

1 participant