-
Notifications
You must be signed in to change notification settings - Fork 542
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
feat(pip_repository): Support pip parse cycles #1166
feat(pip_repository): Support pip parse cycles #1166
Conversation
a3f2800
to
a03018d
Compare
Hrm. Maybe I'm missing something here but it looks like bazel-under-bazel for the tests isn't happy with the two new templates. Not sure how to proceed with a fix. |
@arrdem The change you made is causing
I'm seeing it here: https://buildkite.com/bazel/rules-python-python/builds/4591#018776ef-c472-4122-8b4b-2e30c38bee88 |
1b46a33
to
3a3b0f5
Compare
Okay - I think this is ready for a review. Includes test updates, passes the test updates. The bzlmod story for this is ... there isn't one yet. If there's a way to map this strategy onto bzlmod I'm all ears, I'm just not familiar with that machinery and opted to partition it and retain current |
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.
I appreciate your work! We are having problems on windows with this PR. Please take a look at CI - https://buildkite.com/bazel/rules-python-python/builds/4896#01882c9e-c77f-4596-bfbc-8ca5b5c2931a
@arrdem please rebase. |
3a3b0f5
to
bad3c20
Compare
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.
First, thank you for the work. Second, I need your thoughts about how we will do multiple pip support in bzlmod. With these changes, you did you have knowledge that I need to learn about this code.
My overall comments:
- I love to see over-documented code. You can blame Tim Hockin for this. He taught me we cannot remember why we wrote code changes three months ago.
- Have we tested this with Gazelle? How does Gazelle interact with this new code? Hopefully, it ignores it, but we may want to document that Gazelle does not support this and file an issue.
- We have to have test coverage with bzlmod. Please update the existing examples to use this new code.
Kudos on the PR description. That is awesome.
Will this address #1188? |
If we are not addressing this problem, do we have an open issue? |
@aignas, do you mind taking a look? |
I believe it will.
I'll edit the PR description a bit to clarify. This problem was present in the original PR I submitted and was fixed yesterday. Note that |
6324e15
to
addc079
Compare
Tightened this up a bunch. Removed all unneeded changes that impacted the bzlmod machinery. Backed out some of the formatting changes. Eliminated the generated As far as I can determine at this point the bzlmod CI failures on windows are unrelated. I don't have a windows test environment available and I've eliminated all the parts of this changeset which impact bzlmod machinery. Guidance on getting to green there would be appreciated. |
Simplify inline formatting machinery
Co-authored-by: Ignas Anikevicius <[email protected]>
4db046a
to
4284fe0
Compare
This is some pretty solid work. Thanks, @arrdem! |
In the last wave of providers #31416 we bumped min-airlfow-version to 2.4 and added mechanism to verify min-airflow version is ok while importing, but it turned out that there are cases where installing just old version of airflow (with no constraints) brings the latest version of those providers and causes new installation of airflow to fail. This is far too common to ignore or require to use constraints, unfortunately We do not have min-airlfow-version in the preinstalled providers for one reason only. For some tools that are NOT conforming to standards (such as bazel), having min-airflow-version for those providers causes circular dependency (even though technically dependencies in PyPI can - and often are - circular, because dependencies in Python are not DAG and can contain cycles. This was in response to this issue in 2021 #17795. However, this is really bazel issue, and on top of it - it's recognized as such and being fixed very recently in bazelbuild/rules_python#1188 because there are other packages that have similar problems (pytorch and triton being popular couple). Also Bazel is not that popular in the Python world. Therefore, rather than trying to workaround the problem of bazel, we encourage them to merge and release the fix bazelbuild/rules_python#1166 (comment) and call it out in our installation instructions, that bazel installation might lead to problems like that. If bazel does not fix it, this will only be a problem for Future installations of airflow in a few months most likely. It will not impact current bazel users installing old versions of Airflow (actually they might start having problems now if we do not fix it and yank the 5 providers released yesterday) GitOrigin-RevId: 547e352578fac92f072b269dc257d21cdc279d97
In the last wave of providers #31416 we bumped min-airlfow-version to 2.4 and added mechanism to verify min-airflow version is ok while importing, but it turned out that there are cases where installing just old version of airflow (with no constraints) brings the latest version of those providers and causes new installation of airflow to fail. This is far too common to ignore or require to use constraints, unfortunately We do not have min-airlfow-version in the preinstalled providers for one reason only. For some tools that are NOT conforming to standards (such as bazel), having min-airflow-version for those providers causes circular dependency (even though technically dependencies in PyPI can - and often are - circular, because dependencies in Python are not DAG and can contain cycles. This was in response to this issue in 2021 #17795. However, this is really bazel issue, and on top of it - it's recognized as such and being fixed very recently in bazelbuild/rules_python#1188 because there are other packages that have similar problems (pytorch and triton being popular couple). Also Bazel is not that popular in the Python world. Therefore, rather than trying to workaround the problem of bazel, we encourage them to merge and release the fix bazelbuild/rules_python#1166 (comment) and call it out in our installation instructions, that bazel installation might lead to problems like that. If bazel does not fix it, this will only be a problem for Future installations of airflow in a few months most likely. It will not impact current bazel users installing old versions of Airflow (actually they might start having problems now if we do not fix it and yank the 5 providers released yesterday) GitOrigin-RevId: 547e352578fac92f072b269dc257d21cdc279d97
In the last wave of providers #31416 we bumped min-airlfow-version to 2.4 and added mechanism to verify min-airflow version is ok while importing, but it turned out that there are cases where installing just old version of airflow (with no constraints) brings the latest version of those providers and causes new installation of airflow to fail. This is far too common to ignore or require to use constraints, unfortunately We do not have min-airlfow-version in the preinstalled providers for one reason only. For some tools that are NOT conforming to standards (such as bazel), having min-airflow-version for those providers causes circular dependency (even though technically dependencies in PyPI can - and often are - circular, because dependencies in Python are not DAG and can contain cycles. This was in response to this issue in 2021 #17795. However, this is really bazel issue, and on top of it - it's recognized as such and being fixed very recently in bazelbuild/rules_python#1188 because there are other packages that have similar problems (pytorch and triton being popular couple). Also Bazel is not that popular in the Python world. Therefore, rather than trying to workaround the problem of bazel, we encourage them to merge and release the fix bazelbuild/rules_python#1166 (comment) and call it out in our installation instructions, that bazel installation might lead to problems like that. If bazel does not fix it, this will only be a problem for Future installations of airflow in a few months most likely. It will not impact current bazel users installing old versions of Airflow (actually they might start having problems now if we do not fix it and yank the 5 providers released yesterday) GitOrigin-RevId: 547e352578fac92f072b269dc257d21cdc279d97
This patch reworks the
pip_repository
machinery to allow users to manually annotate groups of libraries which form packaging cycles in PyPi and must be simultaneously installed.The strategy here is to transform any dependencies
A
andB
which have dependencies and are mutually dependentinto a new "dependency group"
C
which hasA*
andB*
as dependencies, defined asA
andB
less any direct dependencies which are members of the group. This is viable for python because Python files just need to be emplaced into a runfiles directory for the interpreter. We don't actually have a true hard dependency between the build definition ofA
requiring the build productB
be available which requires that the build product ofA
be available.This gets us most of the way there, as a user can now safely write
requirement("A")
and we can provide them withC
, which has the desired effect of pulling inA
,B
and their respective transitives.There is one remaining problem - a user writing
deps = [requirement("A"), requirement("B")]
will take a double direct dependency onC
. So we need to insert a layer of indirection, generatingC_A
andC_B
which serve only as unique aliases forC
so that we can support the double dependency. Our final dependency graph then is as followsAddresses #1076, #1188
To do