-
Notifications
You must be signed in to change notification settings - Fork 541
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
Support patch-level Python versions #1371
Comments
FYI, this is working:
So it means that #1340 can be closed. The defition of done for this ticket would be to document this behaviour. |
@aignas @rickeylev See this minimal example: bazel_dep(
name = "rules_python",
version = "0.27.0",
)
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(
python_version = "3.10.11",
)
# Uncommenting this has no effect on the error
# use_repo(python, "python_versions", python_3_10 = "python_3_10_11")
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
pip.parse(
hub_name = "pip",
python_version = "3.10.11",
requirements_lock = "//:requirements.txt", # content is irrelvant for reproducing error
)
use_repo(pip, "pip") BUILD load("@rules_python//python:defs.bzl", "py_binary")
load("@pip//:requirements.bzl", "requirement")
py_binary(
name = "foo",
srcs = ["foo.py"],
deps = [requirement("some_dep")], # concrete dep is irrelevant for error
) Executing
I am using rules_python 0.27.0 and Bazel 7.0.0 on Linux Mint 21.1 |
Before only X.Y would work and with this change users can also specify the exact python version. Fixes #1371
The basic feature request is to allow patch-level specificity of Python versions e.g.
python.toolchain(python_version="3.1.2")
.Supporting this allows builds to be a bit more reproducible, as it removes the variability of different rules_python versions selecting a different patch level. That said, it's also rather niche. Patch level differences are usually inconsequential.
aignas@ also points out:
Making this work cleanly requires addressing a few things, though:
//X.Y:defs.bzl
files.pip_38_foo
.cc @aignas
Few potential ideas:
projects to pin to specific versions if they want to. Submodules are not allowed to use patch-level specificity; not sure whether to silently ignore, ignore with warning, or error.
The text was updated successfully, but these errors were encountered: