-
-
Notifications
You must be signed in to change notification settings - Fork 626
Evaluate PEP 508 environment markers for package dependencies #50
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
Evaluate PEP 508 environment markers for package dependencies #50
Conversation
Can one of the admins verify this patch? |
Thanks for your pull request. It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA). 📝 Please visit https://cla.developers.google.com/ to sign. Once you've signed, please reply here (e.g.
|
Two concerns that I still have with this change:
|
25d1649
to
3c2e6ad
Compare
CLAs look good, thanks! |
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.
This generally looks good to me. Can you rebase?
rules_python/whl_test.py
Outdated
if VERSION_TUPLE < (3, 3): | ||
expected_deps = ['funcsigs', 'pbr', 'six'] | ||
else: | ||
expected_deps = ['pbr', 'six'] |
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.
@duggelz Do you have any tricks to get coverage of both paths?
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.
Good point. I think it can be done by mocking platform.python_version()
. I could add this to this PR or send a separate change after.
Previously any wheel dependencies that had an environment marker (such as 'python_version>3.3') were simply ignored, leading to missing packages in the Python environment constructed by bazel. Fixes bazel-contrib#49
Required after making changes to whl.py
d60c037
to
7398169
Compare
@mattmoor rebased |
Test this please (For Bazel CI) |
About the CI failure (https://ci.bazel.io/blue/organizations/jenkins/PR%2Frules_python/detail/rules_python/67/pipeline): It seems the linux-x86_64 environment on Jenkins has a somewhat old setuptools version which does not yet support some common syntax in version markers. It's failing on '<='. This appears to be supported from setuptools 17.1 onwards. I added another commit which pins the version of setuptools in piptool to the latest (38.2.4). I think this is a good idea in any case as it should make builds more predictable in general. It does mean that the piptool.par executable is now 1.8M instead of 1.3M as setuptools is embedded in it. |
Test this please |
Ugh, this is painful. piptool does use the provided setuptools now, but the whl_library rules generated by piptools do not. Unclear to me if it's possible to pull in the correct setuptools in the whl_library rules. I'll need more time to investigate, any ideas appreciated in the meantime. |
@nikhaldi This is because we are actually using two different scripts to do this, So why are these (checked in
|
@mattmoor thanks for the explanation. It makes somewhat sense, though it feels like there is a lot of duct tape holding this thing together. I can see how to do a separate I won't have time to look at this further until late December/early January but I can spend some more time on it then. I'm not unhappy either if somebody else takes over in the meantime. |
@nikhaldi You cannot vendor the FWIW, I agree with your characterization (re: duct tape), but I think it's largely working around some limitations of Bazel that aren't easily fixed (though I've been trying!). For things that aren't, I'm certainly open to discussing the trade-offs and making improvements.
Defer to @duggelz wisdom, but superficially this SGTM.
No worries, everything slows down this time of year :) I really appreciate you taking the time to send us this PR. |
6a67037
to
cf58abc
Compare
Test this please |
1 similar comment
Test this please |
Some common operators in version markers (e.g., <=) are only supported in setuptools>=17.1. Rather than risk failing because the environment has an old setuptools version it's better to include it. Pinning to an exact version (currently the latest) to make things as predictable as possible. In addition, whl.py used during workspace setup also now depends on setuptools. We package this in a separate whltool.par to make this predictable as well.
cf58abc
to
6a8e4ef
Compare
This appears to be working now with a separate whltool.par. Also refactored the tests to not use ugly branching based on Python versions. I opted to leave the |
Test this please |
Previously any wheel dependencies that had an environment marker
(such as 'python_version>3.3') were simply ignored, leading to
missing packages in the Python environment constructed by bazel.
Fixes #49