@@ -22,17 +22,37 @@ 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+ Args:
38+ transitive: {type}`list[PyInfo]` The PyInfo objects with info
39+ considered indirectly provided by something (e.g. via
40+ its deps attribute).
41+ direct: {type}`list[PyInfo]` The PyInfo objects that are
42+ considered directly provided by something (e.g. via
43+ the srcs attribute).
44+
45+ Returns:
46+ {type}`PyInfo` A PyInfo containing the merged values.
47+ """
48+ builder = PyInfoBuilder .new ()
3049 builder .merge_all (transitive , direct = direct )
3150 return builder .build ()
3251
3352# Exposed for doc generation, not directly used.
3453# buildifier: disable=name-conventions
3554PyCommonApi = struct (
55+ TYPEDEF = _py_common_api_typedef ,
3656 merge_py_infos = _merge_py_infos ,
37- PyInfoBuilder = PyInfoBuilder ,
57+ PyInfoBuilder = PyInfoBuilder . new ,
3858)
0 commit comments