@@ -22,17 +22,40 @@ def _py_common_api_impl(ctx):
22
22
23
23
py_common_api = rule (
24
24
implementation = _py_common_api_impl ,
25
- doc = "Rule implementing py_common API." ,
25
+ doc = "Internal Rule implementing py_common API." ,
26
26
)
27
27
28
+ def _py_common_api_typedef ():
29
+ """The py_common API implementation.
30
+
31
+ An instance of this object is obtained using {obj}`py_common.get()`
32
+ """
33
+
28
34
def _merge_py_infos (transitive , * , direct = []):
29
- builder = PyInfoBuilder ()
35
+ """Merge PyInfo objects into a single PyInfo.
36
+
37
+ This is a convenience wrapper around {obj}`PyInfoBuilder.merge_all`. For
38
+ more control over merging PyInfo objects, use {obj}`PyInfoBuilder`.
39
+
40
+ Args:
41
+ transitive: {type}`list[PyInfo]` The PyInfo objects with info
42
+ considered indirectly provided by something (e.g. via
43
+ its deps attribute).
44
+ direct: {type}`list[PyInfo]` The PyInfo objects that are
45
+ considered directly provided by something (e.g. via
46
+ the srcs attribute).
47
+
48
+ Returns:
49
+ {type}`PyInfo` A PyInfo containing the merged values.
50
+ """
51
+ builder = PyInfoBuilder .new ()
30
52
builder .merge_all (transitive , direct = direct )
31
53
return builder .build ()
32
54
33
55
# Exposed for doc generation, not directly used.
34
56
# buildifier: disable=name-conventions
35
57
PyCommonApi = struct (
58
+ TYPEDEF = _py_common_api_typedef ,
36
59
merge_py_infos = _merge_py_infos ,
37
- PyInfoBuilder = PyInfoBuilder ,
60
+ PyInfoBuilder = PyInfoBuilder . new ,
38
61
)
0 commit comments