Skip to content

Add --output option alias - #539

Open
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:add-output-option-alias
Open

Add --output option alias#539
StantonMatt wants to merge 1 commit into
bndr:masterfrom
StantonMatt:add-output-option-alias

Conversation

@StantonMatt

Copy link
Copy Markdown

Summary

  • Add --output <file> as a conventional alias for the existing --savepath behavior.
  • Add --output - as a conventional alias for the existing --print stdout behavior.
  • Cover both aliases with focused init() tests.

This keeps the default behavior unchanged while addressing the discoverability suggestion from #90.

Tests

  • .venv/bin/python -m unittest tests.test_pipreqs.TestPipreqs.test_init_output_path tests.test_pipreqs.TestPipreqs.test_init_output_dash
  • .venv/bin/python -m unittest discover
  • .venv/bin/flake8 pipreqs tests
  • git diff --check
  • review-fix-loop: no actionable correctness issues

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

Copy link
Copy Markdown

I checked this locally on Python 3.10.

The alias behavior works in a direct probe with local package lookup mocked:

  • --output out.txt writes the generated requirements to that file
  • --output - writes to stdout and does not create the default requirements.txt

Static checks passed:

python -m py_compile pipreqs/pipreqs.py tests/test_pipreqs.py
python -m flake8 pipreqs tests
git diff --check upstream/master...HEAD

The focused unit command from the PR body waits on a live PyPI request in this environment through test_init_output_path, so I did not use it as the main signal here.

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