@@ -80,12 +80,12 @@ def is_standalone_interpreter(rctx, python_interpreter_path, *, logger = None):
80
80
"""Query a python interpreter target for whether or not it's a rules_rust provided toolchain
81
81
82
82
Args:
83
- rctx ( repository_ctx): The repository rule's context object.
84
- python_interpreter_path ( path): A path representing the interpreter.
83
+ rctx: {type}` repository_ctx` The repository rule's context object.
84
+ python_interpreter_path: {type}` path` A path representing the interpreter.
85
85
logger: Optional logger to use for operations.
86
86
87
87
Returns:
88
- bool: Whether or not the target is from a rules_python generated toolchain.
88
+ {type}` bool` Whether or not the target is from a rules_python generated toolchain.
89
89
"""
90
90
91
91
# Only update the location when using a hermetic toolchain.
@@ -563,42 +563,43 @@ For more information see the official bazel docs
563
563
def python_register_toolchains (
564
564
name ,
565
565
python_version ,
566
- distutils = None ,
567
- distutils_content = None ,
568
566
register_toolchains = True ,
569
567
register_coverage_tool = False ,
570
568
set_python_version_constraint = False ,
571
- tool_versions = TOOL_VERSIONS ,
569
+ tool_versions = None ,
572
570
** kwargs ):
573
571
"""Convenience macro for users which does typical setup.
574
572
575
- - Create a repository for each built-in platform like "python_linux_amd64 " -
573
+ - Create a repository for each built-in platform like "python_3_8_linux_amd64 " -
576
574
this repository is lazily fetched when Python is needed for that platform.
577
575
- Create a repository exposing toolchains for each platform like
578
576
"python_platforms".
579
577
- Register a toolchain pointing at each platform.
578
+
580
579
Users can avoid this macro and do these steps themselves, if they want more
581
580
control.
581
+
582
582
Args:
583
- name: base name for all created repos, like "python38 ".
584
- python_version: the Python version.
585
- distutils: see the distutils attribute in the python_repository repository rule .
586
- distutils_content: see the distutils_content attribute in the python_repository repository rule.
587
- register_toolchains: Whether or not to register the downloaded toolchains.
588
- register_coverage_tool: Whether or not to register the downloaded coverage tool to the toolchains.
589
- NOTE: Coverage support using the toolchain is only supported in Bazel 6 and higher.
590
-
591
- set_python_version_constraint: When set to true, target_compatible_with for the toolchains will include a version constraint.
592
- tool_versions: a dict containing a mapping of version with SHASUM and platform info. If not supplied, the defaults
593
- in python/versions.bzl will be used.
594
- **kwargs: passed to each python_repositories call.
583
+ name: {type}`str` base name for all created repos, e.g. "python_3_8 ".
584
+ python_version: {type}`str` the Python version.
585
+ register_toolchains: {type}`bool` Whether or not to register the downloaded toolchains .
586
+ register_coverage_tool: {type}`bool` Whether or not to register the
587
+ downloaded coverage tool to the toolchains.
588
+ set_python_version_constraint: {type}`bool` When set to `True`,
589
+ `target_compatible_with` for the toolchains will include a version
590
+ constraint.
591
+ tool_versions: {type}`dict` contains a mapping of version with SHASUM
592
+ and platform info. If not supplied, the defaults in
593
+ python/versions.bzl will be used.
594
+ **kwargs: passed to each {obj}`python_repository` call.
595
595
"""
596
596
597
597
if BZLMOD_ENABLED :
598
598
# you cannot used native.register_toolchains when using bzlmod.
599
599
register_toolchains = False
600
600
601
601
base_url = kwargs .pop ("base_url" , DEFAULT_RELEASE_BASE_URL )
602
+ tool_versions = tool_versions or TOOL_VERSIONS
602
603
603
604
python_version = full_version (python_version )
604
605
@@ -656,8 +657,6 @@ def python_register_toolchains(
656
657
python_version = python_version ,
657
658
release_filename = release_filename ,
658
659
urls = urls ,
659
- distutils = distutils ,
660
- distutils_content = distutils_content ,
661
660
strip_prefix = strip_prefix ,
662
661
coverage_tool = coverage_tool ,
663
662
** kwargs
@@ -709,11 +708,11 @@ def python_register_multi_toolchains(
709
708
"""Convenience macro for registering multiple Python toolchains.
710
709
711
710
Args:
712
- name: base name for each name in python_register_toolchains call.
713
- python_versions: the Python version .
714
- default_version: the default Python version. If not set, the first version in
715
- python_versions is used.
716
- **kwargs: passed to each python_register_toolchains call.
711
+ name: {type}`str` base name for each name in {obj}` python_register_toolchains` call.
712
+ python_versions: {type}`list[str]` the Python versions .
713
+ default_version: {type}`str` the default Python version. If not set,
714
+ the first version in python_versions is used.
715
+ **kwargs: passed to each {obj}` python_register_toolchains` call.
717
716
"""
718
717
if len (python_versions ) == 0 :
719
718
fail ("python_versions must not be empty" )
0 commit comments