Skip to content
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

wip: feat: support resolving dependencies for a different python version #1692

Conversation

aignas
Copy link
Collaborator

@aignas aignas commented Jan 14, 2024

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 correct
BUILD.bazel files for whl distributions when passing /usr/bin/python3 as
the interpreter to the pip_parse repository rule or its bzlmod equivalent.
This means that users would only need to fetch a single _host toolchain repo
or 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 Python
toolchain ABI and the platform and selecting the right dependencies based on
that, which would be useful in downloading the tomli library only for Python
versions that don't have the native toml support. This could allow us to
download a pure python package once for all python interpreter versions making
the repository fetching faster.

Work towards #1643.

TODO:

  • Discuss on how we could expose the desired version of the python interpreter.
    Should we add an optional python_version argument to the whl_library rules? Should
    it be a string_list? Or should we have the experimental_target_platforms extended
    to accept strings like cp_3_9_0_linux_aarch64?

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.
@aignas aignas force-pushed the feat/python-impl-independent-2 branch from 3e32f4b to 168fb5f Compare January 14, 2024 04:20
@aignas aignas deleted the branch bazelbuild:feat/python-impl-independent-1 January 14, 2024 09:58
@aignas aignas closed this Jan 14, 2024
@aignas
Copy link
Collaborator Author

aignas commented Jan 14, 2024

Tried doing a stacked PR and this got auto-closed when the upstream PR's branch got merged in #1691. I'll reopen this as a separate PR, because I don't seem to be able to reopen this one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant