Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Add example of different packages per python version #2529
base: main
Are you sure you want to change the base?
Add example of different packages per python version #2529
Changes from 1 commit
cfa4462
01bf6e0
ca91b54
1db3d69
4eeed13
02b38bf
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Just to write here what I wrote in a related thread on Slack. I think what is happening here is:
3.11
and if you build any target in the repo that is not using transitions,//python/version:python_version
will just use that.flask
here will be evaluated and will fail because there is no set of dependencies for3.11
in the deps list.There are ways to work around it:
target_compatible_with
for this target, see the suggestion below.tags = ["manual"]
and create a separate target that is transitioning themy_310_only_lib
to something a build configuration wherepython_version = 3.10
.pip.parse
entry for the default python toolchain version.3.10
the default toolchain version.The TCW snippet:
Not sure exactly how
rules_python
can help here best. The error allows to ensure that the packages are getting the versions that they expect, but I see how this might be adding unnecessary work on the consumer side.Maybe there should also be a transition
py_library
implementation?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 am not sure if it is the right choice but I did look for a version specific implementation of py_library to import when I first hit this and didn't see one. I also think just adding it in here at least for me as an adequate solution and is easy to point people to in the future. After I saw py_library didn't exist for the given version I looked through the examples here to see if someone had already shown how this could be done.
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.
The more I think about it the more I am convinced that users have one of 3 options available to them and this example should use that:
tags = ["manual"]
and create a separate target that is transitioning the my_310_only_lib to something a build configuration where python_version = 3.10.py_library
instances like this the default, or add a pip.parse entry for the default python toolchain version.I don't think there is anything wrong in this case with
rules_python
, so I am interested in hearing your feedback as to what makes the above options not feasible in your case.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.
Sorry for the miscommunication I think the use of
target_compatible_with
is a perfectly reasonable solution and I already made this change in our internal repo and things are working as expected.The only thing I am running into now is figuring out how to make this work with the WORKSPACE based build in this repo. We just use Bazel modules internally so I didn't have to mess with that.