Skip to content

Commit 61955f2

Browse files
authored
docs(cc): clarify abi_tag is equivalent to SOABI and cite PEP 3149 (bazel-contrib#3985)
Clarify the documentation for `abi_tag` in C++ Python toolchains so that rule maintainers and users can easily map Bazel's toolchain attributes to standard Python distribution environment variables. Update docstrings in `python/private/py_cc_toolchain_info.bzl` and `python/private/py_cc_toolchain_rule.bzl` to explicitly note that `abi_tag` is the equivalent of the Python `sysconfig` variable `SOABI`, accompanied by a reference citation to PEP 3149. Also add `:::{versionadded} VERSION_NEXT_FEATURE` directives to all newly introduced toolchain fields and rule attributes.
1 parent 3c9423a commit 61955f2

2 files changed

Lines changed: 41 additions & 3 deletions

File tree

‎python/private/py_cc_toolchain_info.bzl‎

Lines changed: 18 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,19 @@ PyCcToolchainInfo = provider(
2121
:type: str
2222
2323
The runtime's ABI flags, i.e. `sys.abiflags` (e.g. 't' for free-threaded builds).
24+
25+
:::{versionadded} VERSION_NEXT_FEATURE
26+
:::
2427
""",
2528
"abi_tag": """\
2629
:type: str
2730
28-
The ABI tag for extension modules, e.g. 'cpython-311' or 'cpython-313t'.
31+
The ABI tag for extension modules, equivalent to the `SOABI` sysconfig var
32+
(see [PEP 3149](https://peps.python.org/pep-3149/)), e.g. 'cpython-311' or
33+
'cpython-313t'.
34+
35+
:::{versionadded} VERSION_NEXT_FEATURE
36+
:::
2937
""",
3038
"headers": """\
3139
:type: struct
@@ -107,12 +115,18 @@ If available, information about C libraries, struct with fields:
107115
108116
The {pep}`PEP 508` `platform_machine` marker
109117
value for the target architecture, e.g. 'x86_64', 'aarch64'.
118+
119+
:::{versionadded} VERSION_NEXT_FEATURE
120+
:::
110121
""",
111122
"platform_tag": """\
112123
:type: str | None
113124
114125
The PEP 3149 / PEP 425 platform tag for extension modules, e.g.
115126
'x86_64-linux-gnu', 'darwin', or 'win_amd64'.
127+
128+
:::{versionadded} VERSION_NEXT_FEATURE
129+
:::
116130
""",
117131
"python_version": """
118132
:type: str
@@ -124,6 +138,9 @@ The Python Major.Minor version.
124138
125139
The {pep}`0508` `sys_platform` marker value
126140
for the target OS, e.g. 'linux', 'darwin', 'win32'.
141+
142+
:::{versionadded} 2.2.0
143+
:::
127144
""",
128145
},
129146
)

‎python/private/py_cc_toolchain_rule.bzl‎

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -144,10 +144,20 @@ The runtime's ABI flags, i.e. `sys.abiflags`.
144144
If not set, or set to `<AUTO>`, the ABI flags are automatically derived
145145
from `--//python/config_settings:py_freethreaded` (e.g., `'t'` when
146146
free-threaded is enabled, or `''` otherwise).
147+
148+
:::{versionadded} VERSION_NEXT_FEATURE
149+
:::
147150
""",
148151
),
149152
"abi_tag": attr.string(
150-
doc = "The ABI tag for extension modules, e.g. 'cpython-311'",
153+
doc = """\
154+
The ABI tag for extension modules, equivalent to the `SOABI` sysconfig var
155+
(see [PEP 3149](https://peps.python.org/pep-3149/)), e.g. 'cpython-311' or
156+
'cpython-313t'.
157+
158+
:::{versionadded} VERSION_NEXT_FEATURE
159+
:::
160+
""",
151161
default = "",
152162
),
153163
"headers": attr.label(
@@ -171,7 +181,12 @@ attribute is available or not.
171181
providers = [[SentinelInfo], [CcInfo]],
172182
),
173183
"libc": attr.string(
174-
doc = "Target C library variant, e.g. 'glibc', 'musl'",
184+
doc = """\
185+
Target C library variant, e.g. 'glibc', 'musl'.
186+
187+
:::{versionadded} VERSION_NEXT_FEATURE
188+
:::
189+
""",
175190
default = "",
176191
),
177192
"libs": attr.label(
@@ -182,6 +197,9 @@ attribute is available or not.
182197
"platform_machine": attr.string(
183198
doc = """
184199
Target architecture as a PEP 508 `platform_machine` marker, e.g. 'x86_64', 'aarch64', 'x86_32'.
200+
201+
:::{versionadded} VERSION_NEXT_FEATURE
202+
:::
185203
""",
186204
default = "",
187205
),
@@ -192,6 +210,9 @@ Target architecture as a PEP 508 `platform_machine` marker, e.g. 'x86_64', 'aarc
192210
"sys_platform": attr.string(
193211
doc = """
194212
Target OS as a PEP 508 `sys_platform` marker, e.g. 'linux', 'darwin', 'win32'.
213+
214+
:::{versionadded} 2.2.0
215+
:::
195216
""",
196217
default = "",
197218
),

0 commit comments

Comments
 (0)