Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PythonDeps: move cli_only handling logic to _parse_requirements #2547

Merged
merged 3 commits into from Nov 26, 2022

Conversation

masenf
Copy link
Collaborator

@masenf masenf commented Nov 25, 2022

  • Remove cli_only parameter from build_parser.
  • Remove special case handling for --hash option (only valid in requirements.txt files, not pip install).
  • Validate options in PythonDeps._parse_requirements:
    • Only check cli_only logic for ParsedRequirement objects that directly come from the PythonDeps.
    • Allow included requirements.txt lines to correctly parse --hash (Fix tox4: fails to process requirement files with --hash #2373).
    • Provides a more contextual error message to end users when --hash is used in the deps list.

#2373 [test case] tox4: fails to process requirement files with --hash

  • Specifying --hash in the deps list doesn't work (pip would reject this anyway).
  • Specifying --hash in a requirements.txt file named in the deps list should work, and recursive parsing should correctly extract the hash.

Contribution checklist:

(also see CONTRIBUTING.rst for details)

  • wrote descriptive pull request text
  • added/updated test(s)
  • updated/extended the documentation
  • added relevant issue keyword in message body
  • added news fragment in changelog folder: 2373.bugfix.rst
  • added yourself to CONTRIBUTORS (preserving alphabetical order)

Background

I just released a new plugin today, tox-pin-deps, and hit #2373 while trying to get it working on tox4.

Add a test case for issue tox-dev#2373

* Specifying `--hash` in the deps list doesn't work (pip would
  reject this anyway).
* Specifying `--hash` in a requirements.txt file named in the deps list
  should work, and recursive parsing should correctly extract the hash.
Remove `cli_only` parameter from `build_parser`.

Remove special case handling for `--hash` option (only valid in
requirements.txt files, not `pip install`).

Validate options in PythonDeps._parse_requirements:
  * Only check "cli_only" logic for ParsedRequirement objects that
    directly come from the PythonDeps.
  * Allow included requirements.txt lines to correctly parse `--hash` (Fix tox-dev#2373).
  * Provides a more contextual error message to end users when `--hash`
    is used in the deps list.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants