8000 Parse requirements files for global pip flags. by hrfuller · Pull Request #456 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content

Parse requirements files for global pip flags. #456

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

Merged
merged 5 commits into from
Apr 15, 2021

Conversation

hrfuller
Copy link
Contributor
@hrfuller hrfuller commented Apr 14, 2021

Follow up to #432
Parse requirements files for global pip flags, then add them to the extra_pip_args array.

Pass a copy of each cleaned up line (comments and line-breaks removed) to
each whl_library repo verbatim. Then link based requirements or requirement
lines with requirement specific flags work.

Due to the pip restriction on using requirement specific flags in
requirements.txt files only, write each requirement line to a temp file
before invoking pip in each whl_library repo.

Fixes #438
Fixes #447

PR Checklist

Please check if your PR fulfills the following requirements:

  • Does not include precompiled binaries, eg. .par files. See CONTRIBUTING.md for info
  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

PR Type

What kind of change does this PR introduce?

  • Bugfix
  • Feature (please, look at the "Scope of the project" section in the README.md file)
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Build related changes
  • CI related changes
  • Documentation content changes
  • Other... Please describe:

What is the current behavior?

All flags and url requirements in pip_parse are ignored.

Issue Number: N/A

What is the new behavior?

Global pip flags requirement specific pip flags, and url style requirement specs are respected in pip_parse

Does this PR introduce a breaking change?

  • Yes
  • No

Other information

Then add them to the extra_pip_args array.

Pass a copy of each cleaned up line (comments and line-breaks removed) to
each whl_library repo verbatim. Then link based requirements or requirement
lines with requirement specific flags work.

Due to the pip restriction on using requirement specific flags in
requirements.txt files only, write each requirement line to a temp file
before invoking pip in each whl_library repo.

Fixes #438 #447
@@ -2,15 +2,26 @@
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile --output-file=requirements_lock.txt requirements.txt
# pip-compile --generate-hashes --output-file=requirements_lock.txt requirements.txt
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised there isn't a second place in this example where the generate-hashes argument was supplied.
If the point of the PR is to allow users to give pip flags, shouldn't there be a source file where they do so? (as opposed to this generated file?)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would think of this file, which happens to be generated, as the only input from the user. The fact that there is also a requirements.txt in this directory is because we are using pip-compile to create the lock file. I can modify this file to add some pip arguments for the sake of demonstration.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adding this turned up a small bug, so yay.

@hrfuller hrfuller merged commit 37f04a4 into master Apr 15, 2021
@thundergolfer thundergolfer deleted the hrfuller/fix-pip-parse-follow-ups branch May 12, 2021 00:55
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

pip_parse ignores hashes and is incompatible with custom sources Parse pip flags from requirements_lock.txt
2 participants
0