wip: feat: support resolving dependencies for a different python version #1692
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.
With this PR we prepare the dependency resolution machinery to support other
than host python versions. This may make it possible to generate select
statements based on the version but we target this usecase as it requires
little code to be changed and once wired to the starlark code could be of use.
Creating this PR for discussion so that we can decide on a suitable interface.
If this change was wired to
whl_library
, we could generate correctBUILD.bazel
files forwhl
distributions when passing/usr/bin/python3
asthe interpreter to the
pip_parse
repository rule or itsbzlmod
equivalent.This means that users would only need to fetch a single
_host
toolchain repoor none at all if they are using the system interpreter for the
whl_library
generation.
I also see this useful for eventual
select
statements involving the Pythontoolchain ABI and the platform and selecting the right dependencies based on
that, which would be useful in downloading the
tomli
library only for Pythonversions that don't have the native
toml
support. This could allow us todownload a pure python package once for all python interpreter versions making
the repository fetching faster.
Work towards #1643.
TODO:
Should we add an optional
python_version
argument to thewhl_library
rules? Shouldit be a
string_list
? Or should we have theexperimental_target_platforms
extendedto accept strings like
cp_3_9_0_linux_aarch64
?