Skip to content

Support --output-file for usethis tool requirements.txt#1794

Merged
nathanjmcdougall merged 7 commits into
mainfrom
copilot/support-usethis-tool-requirements-file-name
Apr 4, 2026
Merged

Support --output-file for usethis tool requirements.txt#1794
nathanjmcdougall merged 7 commits into
mainfrom
copilot/support-usethis-tool-requirements-file-name

Conversation

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor
  • Add output_file parameter to RequirementsTxtToolSpec.__init__ and update meta, pre_commit_config to use it
  • Update RequirementsTxtTool.print_how_to_use to use self._output_file
  • Update use_requirements_txt in _core/tool.py to accept output_file parameter
  • Update _generate_requirements_txt to accept output_file parameter
  • Update write_simple_requirements_txt in _init.py to accept output_file parameter
  • Add requirements_txt_output_file_opt to _ui/options.py (--output-file only, no short form)
  • Update requirements_txt CLI command in _ui/interface/tool.py to pass output_file
  • Write tests for new functionality (core + interface tests)
  • Static checks passing (prek + basedpyright)
  • Dogfooding completed successfully
  • User testing completed successfully
  • Removed -o short flag per review feedback; filed lesson as issue agent: do not add abbreviated CLI flag forms unless explicitly requested #1797
  • Improved unit test coverage to 100% on requirements_txt base and spec modules
  • Fixed basedpyright reportOptionalSubscript error
  • Updated docs/cli/reference.md to document --output-file option; filed lesson as issue lesson: always update docs/cli/reference.md when adding new CLI flags #1811

Copilot AI and others added 2 commits April 4, 2026 00:21
Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title [WIP] Support usethis tool requirements.txt output file name Support --output-file/-o for usethis tool requirements.txt Apr 4, 2026
Copilot AI requested a review from nathanjmcdougall April 4, 2026 00:26
Comment thread src/usethis/_ui/options.py Outdated
Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/1133fc0b-56ca-4400-9288-3ee99d692d49

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>
Copilot AI changed the title Support --output-file/-o for usethis tool requirements.txt Support --output-file for usethis tool requirements.txt Apr 4, 2026
Copilot AI requested a review from nathanjmcdougall April 4, 2026 00:35
@nathanjmcdougall nathanjmcdougall marked this pull request as ready for review April 4, 2026 01:15
@codecov

codecov Bot commented Apr 4, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@codspeed-hq

codspeed-hq Bot commented Apr 4, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing copilot/support-usethis-tool-requirements-file-name (ee085dc) with main (b6feafa)1

Open in CodSpeed

Footnotes

  1. No successful run was found on main (476bfd1) during the generation of this report, so b6feafa was used instead as the comparison base. There might be some changes unrelated to this pull request in this report.

@nathanjmcdougall

Copy link
Copy Markdown
Collaborator

@copilot improve code coverage in the tests for this change, use the skill

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot improve code coverage in the tests for this change, use the skill

Done in 3a95c92. Added a TestRequirementsTxtToolSpec class with unit tests for meta, pre_commit_config (uv default, uv custom, non-uv, poetry), and config_spec (uv and non-uv). Also expanded TestPrintHowToUse to cover the uv+pre-commit branch, the non-uv+pre-commit branch (via mock), the uv+devdep branch, and the custom output-file path. Coverage on both base/requirements_txt.py and spec/requirements_txt.py is now 100%.

@nathanjmcdougall

Copy link
Copy Markdown
Collaborator

@copilot failing basedpyright, please fix

…Subscript

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/7845b976-228c-443b-be4d-84ff9739e479

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot failing basedpyright, please fix

Fixed in f3d9a4b — added assert repo.hooks is not None before subscripting repo.hooks[0], which satisfies basedpyright's reportOptionalSubscript check.

@nathanjmcdougall

Copy link
Copy Markdown
Collaborator

@copilot please update the docs. This oversight needs a lesson.

… in reference.md

Agent-Logs-Url: https://github.com/usethis-python/usethis-python/sessions/2dafdbc6-cd87-4d06-bcf4-ac95b89fd468

Co-authored-by: nathanjmcdougall <18602289+nathanjmcdougall@users.noreply.github.com>

Copilot AI commented Apr 4, 2026

Copy link
Copy Markdown
Contributor Author

@copilot please update the docs. This oversight needs a lesson.

Done in ee085dc — added --output-file documentation to docs/cli/reference.md, following the same pattern as the --linter/--formatter section for ruff. Also filed #1811 to track the lesson: always update docs/cli/reference.md when adding new CLI flags.

@nathanjmcdougall nathanjmcdougall merged commit c51c40a into main Apr 4, 2026
20 checks passed
@nathanjmcdougall nathanjmcdougall deleted the copilot/support-usethis-tool-requirements-file-name branch April 4, 2026 09:11
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.

Support usethis tool requirements.txt --name

2 participants