Skip to content

Commit 9675671

Browse files
committed
Pre-commit changes
1 parent 517392f commit 9675671

File tree

14 files changed

+57
-46
lines changed

14 files changed

+57
-46
lines changed

.bcr/patches/remove_dev_deps.patch

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
--- a/MODULE.bazel 2025-11-05 22:01:56.213559506 -0700
2-
+++ b/MODULE.bazel 2025-11-05 22:01:56.213619467 -0700
3-
@@ -40,563 +40,5 @@
1+
--- a/MODULE.bazel 2025-11-06 05:53:18.137728401 +0000
2+
+++ b/MODULE.bazel 2025-11-06 05:53:18.137728401 +0000
3+
@@ -40,568 +40,5 @@
44
# HACK: In prod the includer's patch inserts the use_repo for multitool. This
55
# solves the problem of needing a use_repo here in prod and below in dev.
66

@@ -504,19 +504,24 @@
504504
- venv_name = "default",
505505
-)
506506
-uv.lockfile(
507+
- src = "//:uv.lock",
507508
- hub_name = "pypi",
508509
- venv_name = "default",
509-
- src = "//:uv.lock",
510510
-)
511511
-uv.declare_entrypoint(
512-
- requirement = "pytest",
513512
- name = "pytest",
514513
- entrypoint = "pytest:console_main",
514+
- requirement = "pytest",
515515
-)
516516
-uv.declare_entrypoint(
517-
- requirement = "pytest",
518517
- name = "py.test",
519518
- entrypoint = "pytest:console_main",
519+
- requirement = "pytest",
520+
-)
521+
-uv.annotate_requirements(
522+
- src = "//:annotations.toml",
523+
- hub_name = "pypi",
524+
- venv_name = "default",
520525
-)
521526
-use_repo(uv, "pypi")
522527
-
@@ -553,8 +558,8 @@
553558
-
554559
-# Multitool is a prod dep (for now) so we don't need this
555560
-bazel_dep(name = "rules_multitool", version = "1.9.0")
556-
-multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
557561
-
562+
-multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
558563
-multitool.hub(lockfile = "//tools:tools.lock.json")
559564
use_repo(multitool, "multitool")
560565
-

BUILD.bazel

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,5 @@
11
load("@gazelle//:def.bzl", "gazelle")
22
load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements")
3-
load("@rules_python_gazelle_plugin//manifest:defs.bzl", "gazelle_python_manifest")
4-
load("@rules_python_gazelle_plugin//modules_mapping:def.bzl", "modules_mapping")
53

64
# gazelle:exclude internal_python_deps.bzl
75
# gazelle:exclude internal_deps.bzl

MODULE.bazel

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -540,19 +540,24 @@ uv.declare_venv(
540540
venv_name = "default",
541541
)
542542
uv.lockfile(
543+
src = "//:uv.lock",
543544
hub_name = "pypi",
544545
venv_name = "default",
545-
src = "//:uv.lock",
546546
)
547547
uv.declare_entrypoint(
548-
requirement = "pytest",
549548
name = "pytest",
550549
entrypoint = "pytest:console_main",
550+
requirement = "pytest",
551551
)
552552
uv.declare_entrypoint(
553-
requirement = "pytest",
554553
name = "py.test",
555554
entrypoint = "pytest:console_main",
555+
requirement = "pytest",
556+
)
557+
uv.annotate_requirements(
558+
src = "//:annotations.toml",
559+
hub_name = "pypi",
560+
venv_name = "default",
556561
)
557562
use_repo(uv, "pypi")
558563

@@ -589,8 +594,8 @@ bazel_dep(name = "rules_pkg", version = "1.1.0")
589594

590595
# Multitool is a prod dep (for now) so we don't need this
591596
bazel_dep(name = "rules_multitool", version = "1.9.0")
592-
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
593597

598+
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
594599
multitool.hub(lockfile = "//tools:tools.lock.json")
595600
use_repo(multitool, "multitool")
596601

annotations.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
## Annotations.toml
22
#
33
# This is an aspect_rules_py//uv specific configuration file which allows
4-
# packages to be annoted with their build time dependencies. This fills a gap in
4+
# packages to be annotated with their build time dependencies. This fills a gap in
55
# both the pylock and uv lockfile formats, neither of which allow for build
66
# requirements to be specified.
77
#

bazel/include/multitool.MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22

33
# Multitool is a prod dep (for now) so we don't need this
44
bazel_dep(name = "rules_multitool", version = "1.9.0")
5-
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
65

6+
multitool = use_extension("@rules_multitool//multitool:extension.bzl", "multitool")
77
multitool.hub(lockfile = "//tools:tools.lock.json")
88
use_repo(multitool, "multitool")

bazel/include/python.MODULE.bazel

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -31,24 +31,24 @@ uv.declare_venv(
3131
venv_name = "default",
3232
)
3333
uv.lockfile(
34+
src = "//:uv.lock",
3435
hub_name = "pypi",
3536
venv_name = "default",
36-
src = "//:uv.lock",
3737
)
3838
uv.declare_entrypoint(
39-
requirement = "pytest",
4039
name = "pytest",
4140
entrypoint = "pytest:console_main",
41+
requirement = "pytest",
4242
)
4343
uv.declare_entrypoint(
44-
requirement = "pytest",
4544
name = "py.test",
4645
entrypoint = "pytest:console_main",
46+
requirement = "pytest",
4747
)
4848
uv.annotate_requirements(
49+
src = "//:annotations.toml",
4950
hub_name = "pypi",
5051
venv_name = "default",
51-
src = "//:annotations.toml"
5252
)
5353
use_repo(uv, "pypi")
5454

e2e/MODULE.bazel

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -79,33 +79,32 @@ uv.declare_venv(
7979
venv_name = "say",
8080
)
8181
uv.lockfile(
82+
src = "//cases/uv-deps-650/say:uv.lock",
8283
hub_name = "pypi",
8384
venv_name = "say",
84-
src = "//cases/uv-deps-650/say:uv.lock",
8585
)
8686
uv.override_requirement(
8787
hub_name = "pypi",
88-
venv_name = "say",
8988
requirement = "cowsay",
90-
target = "//cases/uv-deps-650/third_party/cowsay:cowsay",
89+
target = "//cases/uv-deps-650/third_party/cowsay",
90+
venv_name = "say",
9191
)
9292
uv.declare_venv(
9393
hub_name = "pypi",
9494
venv_name = "airflow",
9595
)
9696
uv.lockfile(
97-
hub_name = "pypi",
9897
src = "//cases/uv-deps-650/airflow:uv.lock",
98+
hub_name = "pypi",
9999
venv_name = "airflow",
100100
)
101101
uv.declare_venv(
102102
hub_name = "pypi",
103103
venv_name = "psql",
104104
)
105105
uv.lockfile(
106-
hub_name = "pypi",
107106
src = "//cases/uv-deps-650/crossbuild:uv.lock",
107+
hub_name = "pypi",
108108
venv_name = "psql",
109109
)
110-
111110
use_repo(uv, "pypi")

e2e/cases/uv-deps-650/third_party/cowsay/BUILD.bazel

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,10 @@ load("@aspect_rules_py//py:defs.bzl", "py_library")
33
py_library(
44
name = "cowsay",
55
srcs = glob(["**/*.py"]),
6-
data = glob(["**/*"], exclude=["**/*.py"]),
6+
data = glob(
7+
["**/*"],
8+
exclude = ["**/*.py"],
9+
),
710
imports = ["."],
811
visibility = ["//visibility:public"],
912
)

py/tests/py-binary/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
load("@aspect_bazel_lib//lib:run_binary.bzl", "run_binary")
22
load("@aspect_bazel_lib//lib:testing.bzl", "assert_contains")
33
load("@pypi//:requirements.bzl", "requirement")
4-
load("//bazel:defs.bzl", "munge")
54
load("//py:defs.bzl", "py_binary", "py_test")
65

76
genrule(

uv/private/extension.bzl

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ def _parse_locks(module_ctx, venv_specs):
130130
for mod in module_ctx.modules:
131131
for lock in mod.tags.lockfile:
132132
req_whls = {}
133-
133+
134134
if lock.hub_name not in venv_specs or lock.venv_name not in venv_specs[lock.hub_name]:
135135
problems.append("Lock {} in {} refers to hub {} which is not configured for that module".format(lock.src, mod.name, lock.hub_name))
136136

@@ -188,9 +188,11 @@ Please update your lockfile to provide build tools in order to enable sdist supp
188188
189189
Problems:
190190
{problems}""".format(
191-
lockfile=lock.src,
192-
problems="\n".join([" - " + it for it in problems]
193-
)))
191+
lockfile = lock.src,
192+
problems = "\n".join(
193+
[" - " + it for it in problems],
194+
),
195+
))
194196

195197
# FIXME: Should validate the lockfile but for now just stash it
196198
# Validating in starlark kinda rots anyway
@@ -202,8 +204,8 @@ Problems:
202204
return lock_specs
203205

204206
_default_annotations = struct(
205-
per_package={},
206-
default_build_deps=[
207+
per_package = {},
208+
default_build_deps = [
207209
{"name": "setuptools"},
208210
{"name": "build"},
209211
],
@@ -232,7 +234,7 @@ def _parse_annotations(module_ctx, hub_specs, venv_specs):
232234
annotations = toml.decode_file(module_ctx, ann.src)
233235
if annotations.get("version") != "0.0.0":
234236
fail("Annotations file %s doesn't specify a valid version= key" % ann.src)
235-
237+
236238
for package in annotations.get("package", []):
237239
if not "name" in package:
238240
fail("Annotations file %s is invalid; all [[package]] entries must have a name" % ann.src)
@@ -449,7 +451,8 @@ def _sbuild_repos(module_ctx, lock_specs, annotation_specs, override_specs):
449451

450452
# Per-package build deps, plus global defaults
451453
build_deps = {
452-
it["name"]: it for it in build_deps + venv_anns.default_build_deps
454+
it["name"]: it
455+
for it in build_deps + venv_anns.default_build_deps
453456
}
454457

455458
# print("Creating sdist repo", name)
@@ -532,7 +535,7 @@ def _collect_entrypoints(module_ctx, lock_specs):
532535
res = module_ctx.execute(
533536
[
534537
"tar", # FIXME: Use a hermetic tar here somehow?
535-
"-xzOif",
538+
"-xzOf",
536539
file,
537540
"*.dist-info/entry_points.txt",
538541
],
@@ -789,10 +792,11 @@ def _uv_impl(module_ctx):
789792
venv_specs = _parse_venvs(module_ctx, hub_specs)
790793

791794
lock_specs = _parse_locks(module_ctx, venv_specs)
792-
795+
793796
annotation_specs = _parse_annotations(module_ctx, hub_specs, venv_specs)
794797

795798
override_specs = _parse_overrides(module_ctx, venv_specs)
799+
796800
# Roll through all the configured wheels, collect & validate the unique
797801
# platform configurations so that we can go create an appropriate power set
798802
# of conditions.

0 commit comments

Comments
 (0)