8000 (bzlmod): users have no way to opt out of hermetic toolchain downloads due to precompiling toolchain · Issue #1967 · bazel-contrib/rules_python · GitHub
[go: up one dir, main page]

Skip to content
(bzlmod): users have no way to opt out of hermetic toolchain downloads due to precompiling toolchain #1967
Closed
@aignas

Description

@aignas

It seems that users will download the automatically registered precompile toolchain using the hermetic interpreter even if they would like to use the autodetecting toolchain.

For analysis see comments below and the attached PR for a possible beginning of a fix.

Initial description: The logic change in python/private/py_toolchain_suite.bzl in #1837 probably results in the autodetecting toolchain not being selected.

The toolchain registration is based on the target_settings and constraint_values. If those are the same, then the last registered toolchain overwrites the previously added one. In bazelbuild/bazel#22718 there is usage of an extra toolchain via:

       --extra_toolchains=@bazel_tools//tools/python:autodetecting_toolchain \ 

This means that in the previous logic (which would be sometimes incorrect) the autodetecting toolchain would overwrite any of the default toolchain that was registered by rules_python in the default case.

With the change, we now have 2 toolchains that match the default case when the python_version config setting value is unset - the hermetic and the autodetecting one and the hermetic one is more specialized.

Fixing this without reverting idea 1

A likely fixed could be to auto-register the auto-detecting toolchain and have a config flag that allows the user to select the autodetecting toolchain explicitly over the hermetic toolchain and to fallback to the auto-detecting toolchain if allowed and if no toolchain matches.

Fixing this without reverting idea 2

Use the rules_python_config or the python extension to write data so that the default python_version setting can be set instead. That way all python toolchains would have a version and there would be no special case of a hermetic toolchain which matches "" config setting.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0