1# Copyright 2023 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Python toolchain module extensions for use with bzlmod. 16 17:::{topic} Basic usage 18 19The simplest way to configure the toolchain with `rules_python` is as follows. 20 21```starlark 22python = use_extension("@rules_python//python/extensions:python.bzl", "python") 23python.toolchain( 24 is_default = True, 25 python_version = "3.11", 26) 27use_repo(python, "python_3_11") 28``` 29 30::::{seealso} 31For more in-depth documentation see the {obj}`python.toolchain`. 32:::: 33::: 34 35:::{topic} Overrides 36 37Overrides can be done at 3 different levels: 38* Overrides affecting all python toolchain versions on all platforms - {obj}`python.override`. 39* Overrides affecting a single toolchain versions on all platforms - {obj}`python.single_version_override`. 40* Overrides affecting a single toolchain versions on a single platforms - {obj}`python.single_version_platform_override`. 41 42::::{seealso} 43The main documentation page on registering [toolchains](/toolchains). 44:::: 45::: 46""" 47 48load("//python/private:python.bzl", _python = "python") 49 50python = _python 51