@@ -22,17 +22,40 @@ def _py_common_api_impl(ctx):
2222
2323py_common_api = rule (
2424 implementation = _py_common_api_impl ,
25- doc = "Rule implementing py_common API." ,
25+ doc = "Internal Rule implementing py_common API." ,
2626)
2727
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+
2834def _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 ()
3052 builder .merge_all (transitive , direct = direct )
3153 return builder .build ()
3254
3355# Exposed for doc generation, not directly used.
3456# buildifier: disable=name-conventions
3557PyCommonApi = struct (
58+ TYPEDEF = _py_common_api_typedef ,
3659 merge_py_infos = _merge_py_infos ,
37- PyInfoBuilder = PyInfoBuilder ,
60+ PyInfoBuilder = PyInfoBuilder . new ,
3861)
0 commit comments