revert(bzlmod)!: allow bzlmod pip.parse to implicitly use default python version #1341
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.
Reverts #1303
The main issue is that
pip.parse()
accepts a locked requirements file -- this meansthe 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:
python_version
explicitly set. Set it to the Python versionused 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.