feat(bzlmod): Allow bzlmod pip.parse to reference the default python toolchain and interpreter#1303
Merged
rickeylev merged 1 commit intobazel-contrib:mainfrom Jul 10, 2023
Conversation
aab6209 to
b7c83ed
Compare
This commit defaults the python_version attribute to the default version of Python. This allows a user to use the version we define in rules_python MODULE.bazel. Also, a user can now not set the python_version attribute on a pip tag_class and we automatically set the interpreter.
b7c83ed to
b66fce0
Compare
rickeylev
approved these changes
Jul 10, 2023
github-merge-queue bot
pushed a commit
that referenced
this pull request
Jul 26, 2023
…hon version (#1341) Reverts #1303 The main issue is that `pip.parse()` accepts a locked requirements file -- this means the requirements are specific to a particular Python version[1]. Because the default Python version can arbitrarily change, the lock file may not be valid for the Python version that is used at runtime. The net result is a module will use dependencies for e.g. Python 3.8, but will use 3.9 at runtime. Additionally, the dependencies resolved for 3.8 will be created under names such as `@foo_39` (because that's the python_version pip.parse sees), which is just more confusing. BREAKING CHANGE: * pip.parse() must have `python_version` explicitly set. Set it to the Python version used to resolve the requirements file. [1] Lock files aren't necessarily version specific, but we don't currently support the environment markers in lock files to make them cross-python-version compatible.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This commit defaults
the pip.parsepython_versionattribute to the default version ofPython, as configured by the
python.toolchainextension. This allows a user to use thePython version set by rules_python or the root module. Also, this makes setting the
attribute optional (as it has a default) and we automatically select the interpreter.
Closes #1267