docs(cc): add py_extension to doc generation and update versionadded markup (#3989)
Add py_extension to Sphinx Stardoc generation in docs/BUILD.bazel and
resolve transitive bzl_library dependencies in
python/private/cc/BUILD.bazel
so API reference generation succeeds. Update py_extension docstrings in
python/cc/py_extension.bzl and python/private/cc/py_extension_macro.bzl
to
use `:::{versionadded} VERSION_NEXT_FEATURE` per CONTRIBUTING.md.
diff --git a/docs/BUILD.bazel b/docs/BUILD.bazel
index dd304c4..baa1a1e 100644
--- a/docs/BUILD.bazel
+++ b/docs/BUILD.bazel
@@ -128,6 +128,7 @@
"//python/api:rule_builders",
"//python/cc:py_cc_toolchain",
"//python/cc:py_cc_toolchain_info",
+ "//python/cc:py_extension",
"//python/entry_points:py_console_script_binary",
"//python/extensions:config",
"//python/extensions:python",
diff --git a/python/cc/py_extension.bzl b/python/cc/py_extension.bzl
index 2d5570b..d81877a 100644
--- a/python/cc/py_extension.bzl
+++ b/python/cc/py_extension.bzl
@@ -10,6 +10,9 @@
:::{include} /_includes/experimental_api.md
:::
+
+:::{versionadded} VERSION_NEXT_FEATURE
+:::
"""
load(
diff --git a/python/private/cc/BUILD.bazel b/python/private/cc/BUILD.bazel
index a89c47c..087d406 100644
--- a/python/private/cc/BUILD.bazel
+++ b/python/private/cc/BUILD.bazel
@@ -43,6 +43,7 @@
srcs = ["py_extension_macro.bzl"],
deps = [
":py_extension_rule",
+ "//python/private:common_labels",
"//python/private:util",
"@rules_cc//cc:core_rules",
],
@@ -55,11 +56,11 @@
"//python/private:attr_builders",
"//python/private:attributes",
"//python/private:builders",
+ "//python/private:common",
"//python/private:py_info",
"//python/private:reexports",
"//python/private:rule_builders",
"//python/private:toolchain_types",
"@bazel_skylib//lib:dicts",
- "@rules_cc//cc/common",
],
)
diff --git a/python/private/cc/py_extension_macro.bzl b/python/private/cc/py_extension_macro.bzl
index b57e9a4..6b697ab 100644
--- a/python/private/cc/py_extension_macro.bzl
+++ b/python/private/cc/py_extension_macro.bzl
@@ -50,6 +50,9 @@
- `module_name`: Pass `module_name = "custom_name"` to override the base
module filename.
+ :::{versionadded} VERSION_NEXT_FEATURE
+ :::
+
Args:
name: {type}`str` Target name.
srcs: {type}`list[Label | str] | None` C/C++ source files to compile
diff --git a/python/private/cc/py_extension_rule.bzl b/python/private/cc/py_extension_rule.bzl
index 2b3a828..dc5a5e0 100644
--- a/python/private/cc/py_extension_rule.bzl
+++ b/python/private/cc/py_extension_rule.bzl
@@ -5,7 +5,6 @@
"""
load("@bazel_skylib//lib:dicts.bzl", "dicts")
-load("@rules_cc//cc/common:cc_shared_library_info.bzl", "CcSharedLibraryInfo")
load("//python/private:attr_builders.bzl", "attrb")
load("//python/private:attributes.bzl", "COMMON_ATTRS", "IMPORTS_ATTRS", "WINDOWS_CONSTRAINTS_ATTRS")
load("//python/private:builders.bzl", "builders")
@@ -78,7 +77,6 @@
),
"src": lambda: attrb.Label(
mandatory = True,
- providers = [CcSharedLibraryInfo],
doc = "The cc_shared_library target to wrap.",
),
},
diff --git a/tests/BUILD.bazel b/tests/BUILD.bazel
index e7dbef6..927fc30 100644
--- a/tests/BUILD.bazel
+++ b/tests/BUILD.bazel
@@ -22,6 +22,7 @@
"//python:py_test_bzl",
"//python/cc:py_cc_toolchain_bzl",
"//python/cc:py_cc_toolchain_info_bzl",
+ "//python/cc:py_extension",
"//python/entry_points:py_console_script_binary_bzl",
],
)