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

revert(bzlmod)!: allow bzlmod pip.parse to implicitly use default python version #1341

Merged
merged 1 commit into from
Jul 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions examples/bzlmod/MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,6 @@ local_path_override(
path = "../..",
)

# Setting python.toolchain is optional as rules_python
# sets a toolchain for you, using the latest supported version
# of Python. We do recomend that you set a version here.

# We next initialize the python toolchain using the extension.
# You can set different Python versions in this block.
python = use_extension("@rules_python//python/extensions:python.bzl", "python")
Expand Down Expand Up @@ -91,10 +87,9 @@ use_repo(pip, "whl_mods_hub")
# call.
# Alternatively, `python_interpreter_target` can be used to directly specify
# the Python interpreter to run to resolve dependencies.
# Because we do not have a python_version defined here
# pip.parse uses the python toolchain that is set as default.
pip.parse(
hub_name = "pip",
python_version = "3.9",
requirements_lock = "//:requirements_lock_3_9.txt",
requirements_windows = "//:requirements_windows_3_9.txt",
# These modifications were created above and we
Expand Down
6 changes: 2 additions & 4 deletions python/extensions/pip.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -348,16 +348,14 @@ Targets from different hubs should not be used together.
""",
),
"python_version": attr.string(
default = DEFAULT_PYTHON_VERSION,
mandatory = True,
doc = """
The Python version to use for resolving the pip dependencies. If not specified,
then the default Python version (as set by the root module or rules_python)
will be used.

The version specified here must have a corresponding `python.toolchain()`
configured. This attribute defaults to the version of the toolchain
that is set as the default Python version. Or if only one toolchain
is used, this attribute defaults to that version of Python.
configured.
""",
),
"whl_modifications": attr.label_keyed_string_dict(
Expand Down