Skip to content

Commit df80ed8

Browse files
committed
improve docs
1 parent c4c8105 commit df80ed8

File tree

1 file changed

+49
-43
lines changed

1 file changed

+49
-43
lines changed

python/uv/private/uv.bzl

Lines changed: 49 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -41,31 +41,48 @@ Since this is only for locking the requirements files, it should be always
4141
marked as a `dev_dependency`.
4242
"""
4343

44+
_DEFAULT_ATTRS = {
45+
"base_url": attr.string(
46+
doc = """\
47+
Base URL to download metadata about the binaries and the binaries themselves.
48+
""",
49+
),
50+
"compatible_with": attr.label_list(
51+
doc = """\
52+
The compatible with constraint values for toolchain resolution.
53+
""",
54+
),
55+
"manifest_filename": attr.string(
56+
doc = """\
57+
The distribution manifest filename to use for the metadata fetching from GH. The
58+
defaults for this are set in `rules_python` MODULE.bazel file that one can override
59+
for a specific version.
60+
""",
61+
default = "dist-manifest.json",
62+
),
63+
"platform": attr.string(
64+
doc = """\
65+
The platform string used in the UV repository to denote the platform triple.
66+
""",
67+
),
68+
"target_settings": attr.label_list(
69+
doc = """\
70+
The `target_settings` to add to platform definitions that then get used in `toolchain`
71+
definitions.
72+
""",
73+
),
74+
"version": attr.string(
75+
doc = """\
76+
The version of uv to configure the sources for.
77+
""",
78+
),
79+
}
80+
4481
default = tag_class(
4582
doc = """\
4683
Set the uv configuration defaults.
4784
""",
48-
attrs = {
49-
"base_url": attr.string(
50-
doc = "Base URL to download metadata about the binaries and the binaries themselves.",
51-
),
52-
"compatible_with": attr.label_list(
53-
doc = "The compatible with constraint values for toolchain resolution",
54-
),
55-
"manifest_filename": attr.string(
56-
doc = "The manifest filename to for the metadata fetching.",
57-
default = "dist-manifest.json",
58-
),
59-
"platform": attr.string(
60-
doc = "The platform string used in the UV repository to denote the platform triple.",
61-
),
62-
"target_settings": attr.label_list(
63-
doc = "The `target_settings` to add to platform definitions.",
64-
),
65-
"version": attr.string(
66-
doc = "The version of uv to use.",
67-
),
68-
},
85+
attrs = _DEFAULT_ATTRS,
6986
)
7087

7188
configure = tag_class(
@@ -100,31 +117,20 @@ defaults for all versions, use the {attr}`default` for all of the configuration,
100117
similarly how `rules_python` is doing it itself.
101118
::::
102119
""",
103-
attrs = {
104-
"base_url": attr.string(
105-
doc = "Base URL to download metadata about the binaries and the binaries themselves.",
106-
),
107-
"compatible_with": attr.label_list(
108-
doc = "The compatible with constraint values for toolchain resolution",
109-
),
110-
"manifest_filename": attr.string(
111-
doc = "The manifest filename to for the metadata fetching.",
112-
default = "dist-manifest.json",
113-
),
114-
"platform": attr.string(
115-
doc = "The platform string used in the UV repository to denote the platform triple.",
116-
),
120+
attrs = _DEFAULT_ATTRS | {
117121
"sha256": attr.string(
118-
doc = "The sha256 of the downloaded artifact.",
119-
),
120-
"target_settings": attr.label_list(
121-
doc = "The `target_settings` to add to platform definitions.",
122+
doc = "The sha256 of the downloaded artifact if the {attr}`urls` is specified.",
122123
),
123124
"urls": attr.string_list(
124-
doc = "The urls to download the binary from. If this is used, {attr}`base_url` is ignored. If the `urls` are specified, they need to be specified for all of the platforms for a particular version.",
125-
),
126-
"version": attr.string(
127-
doc = "The version of uv to use.",
125+
doc = """\
126+
The urls to download the binary from. If this is used, {attr}`base_url` and
127+
{attr}`manifest_name` are ignored for the given version.
128+
129+
::::note
130+
If the `urls` are specified, they need to be specified for all of the platforms
131+
for a particular version.
132+
::::
133+
""",
128134
),
129135
},
130136
)

0 commit comments

Comments
 (0)