@@ -25,16 +25,6 @@ PYBIND_DEPS = [
25
25
"@rules_python//python/cc:current_py_cc_headers" ,
26
26
]
27
27
28
- # Builds a Python extension module using pybind11.
29
- # This can be directly used in Python with the import statement.
30
- # Assuming the name NAME, the following targets will be defined:
31
- # 1. NAME.so - the shared/dynamic library for the extension module
32
- # 2. NAME.pyd - a copy of NAME.so named for Python on Windows; see
33
- # https://github.com/pybind/pybind11_bazel/issues/74
34
- # 3. NAME - an alias pointing to either NAME.so or NAME.pyd as per
35
- # the platform OS (not-Windows or Windows, respectively)
36
- # Generally, the user will "depend" on this extension module via the
37
- # data attribute of their py_* target; specifying NAME is preferred.
38
28
def pybind_extension (
39
29
name ,
40
30
copts = [],
@@ -43,6 +33,28 @@ def pybind_extension(
43
33
tags = [],
44
34
deps = [],
45
35
** kwargs ):
36
+ """Builds a Python extension module using pybind11.
37
+
38
+ Args:
39
+ name: The name of the extension module.
40
+ copts: Compiler options for building the module.
41
+ features: Features required for building the module.
42
+ linkopts: Linker options for building the module.
43
+ tags: Tags for the module.
44
+ deps: Dependencies required for building the module.
45
+ **kwargs: Additional keyword arguments.
46
+
47
+ This can be directly used in Python with the import statement.
48
+ Assuming the name NAME, the following targets will be defined:
49
+ 1. NAME.so - the shared/dynamic library for the extension module
50
+ 2. NAME.pyd - a copy of NAME.so named for Python on Windows; see
51
+ https://github.com/pybind/pybind11_bazel/issues/74
52
+ 3. NAME - an alias pointing to either NAME.so or NAME.pyd as per
53
+ the platform OS (not-Windows or Windows, respectively)
54
+ Generally, the user will "depend" on this extension module via the
55
+ data attribute of their py_* target; specifying NAME is preferred.
56
+ """
57
+
46
58
# Mark common dependencies as required for build_cleaner.
47
59
tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS ]
48
60
@@ -82,14 +94,15 @@ def pybind_extension(
82
94
visibility = kwargs .get ("visibility" ),
83
95
)
84
96
85
- # Builds a pybind11 compatible library. This can be linked to a pybind_extension.
86
97
def pybind_library (
87
98
name ,
88
99
copts = [],
89
100
features = [],
90
101
tags = [],
91
102
deps = [],
92
103
** kwargs ):
104
+ """Builds a pybind11 compatible library. This can be linked to a pybind_extension."""
105
+
93
106
# Mark common dependencies as required for build_cleaner.
94
107
tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS ]
95
108
@@ -102,14 +115,15 @@ def pybind_library(
102
115
** kwargs
103
116
)
104
117
105
- # Builds a C++ test for a pybind_library.
106
118
def pybind_library_test (
107
119
name ,
108
120
copts = [],
109
121
features = [],
110
122
tags = [],
111
123
deps = [],
112
124
** kwargs ):
125
+ """Builds a C++ test for a pybind_library."""
126
+
113
127
# Mark common dependencies as required for build_cleaner.
114
128
tags = tags + ["req_dep=%s" % dep for dep in PYBIND_DEPS ]
115
129
0 commit comments