-
Notifications
You must be signed in to change notification settings - Fork 543
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
fix(pypi): pass requirements without env markers to the whl_library #2488
fix(pypi): pass requirements without env markers to the whl_library #2488
Conversation
With this change the environment markers from the requirements.txt files no longer end up in the whl_library definitions. The alternative would be to fix this in the whl_library itself and do the string manipulation then. However, this means that we will be doing refetching of the repository when the markers change and the overall behaviour may be more complex. This solution also makes the MODULE.bazel.lock files simpler. That said, I am 50/50 on putting it in this way, so I can be easily convinced to put it in the whl_library if there is preference.
CHANGELOG.md
Outdated
* (pip.parse) The requirement argument parsed to `whl_library` will now not have | ||
env marker information allowing `bazel query` to work in cases where the `whl` | ||
is available for all of the platforms and the sdist can be built. | ||
Work towards [#2450](https://github.com/bazelbuild/rules_python/issues/2450). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Work towards [#2450](https://github.com/bazelbuild/rules_python/issues/2450). | |
Fixes [#2450](https://github.com/bazelbuild/rules_python/issues/2450). |
Actually, @keith, I think that this PR might fix the issue you were having. Let me know if it does in something else than #2450 as with this PR the command bazel query deps(...)
no longer fails.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like it does! 🎉
With this change the environment markers from the requirements.txt files
no longer end up in the whl_library definitions. I am reusing a function
that already is parsing each requirement line for
sha256
values and addedlogic to extract the
marker
at that point. This means that the change isalso trivial to backport to the
WORKSPACE
and the logic in the extensionbecomes simpler and we don't rely only on integration tests.
Expected changes to the users:
WORKSPACE
, those will bereformatted and the env markers will be removed.
MODULE.bazel.lock
file will be likewise reformatted if users arenot using
--experimental_index_url
. Also, the env markers will not bepassed in the
requirement
.bazel query 'deps("@pypi//foo")'
should start working in more cases.Fixes #2450.