@@ -297,18 +297,14 @@ def _get_bazel_version_specific_kwargs():
297
297
298
298
return kwargs
299
299
300
- python = module_extension (
301
- doc = """Bzlmod extension that is used to register Python toolchains.
302
- """ ,
303
- implementation = _python_impl ,
304
- tag_classes = {
305
- "rules_python_private_testing" : tag_class (
306
- attrs = {
307
- "register_all_versions" : attr .bool (default = False ),
308
- },
309
- ),
310
- "toolchain" : tag_class (
311
- doc = """Tag class used to register Python toolchains.
300
+ _rules_python_private_testing = tag_class (
301
+ attrs = {
302
+ "register_all_versions" : attr .bool (default = False ),
303
+ },
304
+ )
305
+
306
+ _toolchain = tag_class (
307
+ doc = """Tag class used to register Python toolchains.
312
308
Use this tag class to register one or more Python toolchains. This class
313
309
is also potentially called by sub modules. The following covers different
314
310
business rules and use cases.
@@ -338,14 +334,14 @@ A toolchain's repository name uses the format `python_{major}_{minor}`, e.g.
338
334
`python_3_10`. The `major` and `minor` components are
339
335
`major` and `minor` are the Python version from the `python_version` attribute.
340
336
""" ,
341
- attrs = {
342
- "configure_coverage_tool" : attr .bool (
343
- mandatory = False ,
344
- doc = "Whether or not to configure the default coverage tool for the toolchains." ,
345
- ),
346
- "ignore_root_user_error" : attr .bool (
347
- default = False ,
348
- doc = """\
337
+ attrs = {
338
+ "configure_coverage_tool" : attr .bool (
339
+ mandatory = False ,
340
+ doc = "Whether or not to configure the default coverage tool for the toolchains." ,
341
+ ),
342
+ "ignore_root_user_error" : attr .bool (
343
+ default = False ,
344
+ doc = """\
349
345
If False, the Python runtime installation will be made read only. This improves
350
346
the ability for Bazel to cache it, but prevents the interpreter from creating
351
347
pyc files for the standard library dynamically at runtime as they are loaded.
@@ -355,21 +351,29 @@ interpreter to create pyc files for the standard library, but, because they are
355
351
created as needed, it adversely affects Bazel's ability to cache the runtime and
356
352
can result in spurious build failures.
357
353
""" ,
358
- mandatory = False ,
359
- ),
360
- "is_default" : attr .bool (
361
- mandatory = False ,
362
- doc = "Whether the toolchain is the default version" ,
363
- ),
364
- "python_version" : attr .string (
365
- mandatory = True ,
366
- doc = "The Python version, in `major.minor` format, e.g " +
367
- "'3.12', to create a toolchain for. Patch level " +
368
- "granularity (e.g. '3.12.1') is not supported." ,
369
- ),
370
- },
354
+ mandatory = False ,
355
+ ),
356
+ "is_default" : attr .bool (
357
+ mandatory = False ,
358
+ doc = "Whether the toolchain is the default version" ,
359
+ ),
360
+ "python_version" : attr .string (
361
+ mandatory = True ,
362
+ doc = "The Python version, in `major.minor` format, e.g " +
363
+ "'3.12', to create a toolchain for. Patch level " +
364
+ "granularity (e.g. '3.12.1') is not supported." ,
371
365
),
372
366
},
367
+ )
368
+
369
+ python = module_extension (
370
+ doc = """Bzlmod extension that is used to register Python toolchains.
371
+ """ ,
372
+ implementation = _python_impl ,
373
+ tag_classes = {
374
+ "rules_python_private_testing" : _rules_python_private_testing ,
375
+ "toolchain" : _toolchain ,
376
+ },
373
377
** _get_bazel_version_specific_kwargs ()
374
378
)
375
379
0 commit comments