Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,6 @@ examples export-ignore

# Substitution for the _VERSION_PRIVATE placeholder
py/private/release/version.bzl export-subst

# Custom UV binaries — track with Git LFS when available
tools/uv/bin/**/uv filter=lfs diff=lfs merge=lfs -text
2 changes: 1 addition & 1 deletion BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@buildifier_prebuilt//:rules.bzl", "buildifier")
load("@gazelle//:def.bzl", "gazelle")
load("@rules_python//python/pip_install:requirements.bzl", "compile_pip_requirements")
load("//uv/unstable:defs.bzl", "gazelle_python_manifest")
load("//uv/private/gazelle_manifest:defs.bzl", "gazelle_python_manifest")

# gazelle:exclude internal_python_deps.bzl
# gazelle:exclude internal_deps.bzl
Expand Down
48 changes: 10 additions & 38 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ use_repo(host, "aspect_rules_py_uv_host")

# PBS interpreters — used at repo-rule time for sdist inspection (needs >= 3.11
# for tomllib) and available as build-time toolchains.
interpreters = use_extension("//py/unstable:extension.bzl", "python_interpreters")
interpreters = use_extension("//py:extensions.bzl", "python_interpreters")
interpreters.configure(
releases = [
"20260303",
Expand Down Expand Up @@ -223,17 +223,13 @@ python.toolchain(
python_version = "3.12",
)

# We still use pip for testing the virtual deps machinery
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = IS_RELEASE)
pip.parse(
hub_name = "django",
python_version = "3.9",
requirements_lock = "//py/tests/virtual/django:requirements.txt",
)
use_repo(pip, "django")

# For everything else, we use our own uv machinery
uv = use_extension("//uv/unstable:extension.bzl", "uv", dev_dependency = IS_RELEASE)

# For everything else, we use our own uv machinery.
# The wrapper extension auto-resolves bundled UV binaries from tools/uv/bin/
# so builds work portably in CI without absolute paths.
uv = use_extension("//tools/uv:extension.bzl", "uv", dev_dependency = IS_RELEASE)
uv.toolchain(version = "0.11.6")
uv.declare_hub(
hub_name = "pypi",
)
Expand All @@ -247,38 +243,14 @@ uv.project(
hub_name = "pypi",
lock = "//:uv.lock",
pyproject = "//:pyproject.toml",
python_version = "3.13",
)
uv.unstable_annotate_packages(
src = "//:annotations.toml",
lock = "//:uv.lock",
)
use_repo(uv, "pypi")

http_file = use_repo_rule(
"@bazel_tools//tools/build_defs/repo:http.bzl",
"http_file",
)
use_repo(uv, "pypi", "uv", "uv_toolchains")

http_file(
name = "django_4_2_4",
dev_dependency = IS_RELEASE,
downloaded_file_path = "Django-4.2.4-py3-none-any.whl",
sha256 = "860ae6a138a238fc4f22c99b52f3ead982bb4b1aad8c0122bcd8c8a3a02e409d",
urls = ["https://files.pythonhosted.org/packages/7f/9e/fc6bab255ae10bc57fa2f65646eace3d5405fbb7f5678b90140052d1db0f/Django-4.2.4-py3-none-any.whl"],
)
register_toolchains("@uv_toolchains//:all")

http_file(
name = "django_4_1_10",
dev_dependency = IS_RELEASE,
downloaded_file_path = "Django-4.1.10-py3-none-any.whl",
sha256 = "26d0260c2fb8121009e62ffc548b2398dea2522b6454208a852fb0ef264c206c",
urls = ["https://files.pythonhosted.org/packages/34/25/8a218de57fc9853297a1a8e4927688eff8107d5bc6dcf6c964c59801f036/Django-4.1.10-py3-none-any.whl"],
)

http_file(
name = "sqlparse_0_4_0",
dev_dependency = IS_RELEASE,
downloaded_file_path = "sqlparse-0.4.0-py3-none-any.whl",
sha256 = "0523026398aea9c8b5f7a4a6d5c0829c285b4fbd960c17b5967a369342e21e01",
urls = ["https://files.pythonhosted.org/packages/10/96/36c136013c4a6ecb8c6aa3eed66e6dcea838f85fd80e1446499f1dabfac7/sqlparse-0.4.0-py3-none-any.whl"],
)
6 changes: 3 additions & 3 deletions bazel/BUILD.bazel
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@bazelrc-preset.bzl", "bazelrc_preset")
load(":defs.bzl", "incompatible_with")

exports_files(["defs.bzl"])

Expand All @@ -9,9 +10,8 @@ bazelrc_preset(
# USE_BAZEL_VERSION for testing.
doc_link_template = "https://registry.build/flag/bazel?filter={flag}",
strict = True,
# The output is specific to the version in .bazelversion
tags = [
"skip-on-bazel7",
"skip-on-bazel9",
"manual",
],
target_compatible_with = incompatible_with("9.0.0"),
)
22 changes: 1 addition & 21 deletions bazel/defaults.bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -96,33 +96,13 @@ startup --host_jvm_args="-DBAZEL_TRACK_SOURCE_DIRECTORIES=1"
common --incompatible_default_to_explicit_init_py
# Docs: https://registry.build/flag/bazel?filter=incompatible_default_to_explicit_init_py

# Fail if Starlark files are not UTF-8 encoded.
# Introduced in Bazel 8.1, see https://github.com/bazelbuild/bazel/pull/24944
# Recommended to enable since Bazel 8.5, see https://github.com/bazel-contrib/bazelrc-preset.bzl/issues/95
common --incompatible_enforce_starlark_utf8="error"
# Docs: https://registry.build/flag/bazel?filter=incompatible_enforce_starlark_utf8

# Accept multiple --modify_execution_info flags, rather than the last flag overwriting earlier ones.
common --incompatible_modify_execution_info_additive
# Docs: https://registry.build/flag/bazel?filter=incompatible_modify_execution_info_additive

# Make builds more reproducible by using a static value for PATH and not inheriting LD_LIBRARY_PATH.
# Use `--action_env=ENV_VARIABLE` if you want to inherit specific variables from the environment where Bazel runs.
# Note that doing so can prevent cross-user caching if a shared cache is used.
# See https://github.com/bazelbuild/bazel/issues/2574 for more details.
common --incompatible_strict_action_env
# Docs: https://registry.build/flag/bazel?filter=incompatible_strict_action_env

# Fail the build if the MODULE.bazel.lock file is out of date.
# Using this mode in ci prevents the lockfile from being out of date.
common:ci --lockfile_mode="error"
# Docs: https://registry.build/flag/bazel?filter=lockfile_mode

# Add the CloudFlare mirror of BCR-referenced downloads.
# Improves reliability of Bazel when CDNs are flaky, for example issues with ftp.gnu.org in 2025.
common --module_mirrors="https://bcr.cloudflaremirrors.com"
# Docs: https://registry.build/flag/bazel?filter=module_mirrors

# On CI, don't download remote outputs to the local machine.
# Most CI pipelines don't need to access the files and they can remain at rest on the remote cache.
# Significant time can be spent on needless downloads, which is especially noticeable on fully-cached builds.
Expand Down Expand Up @@ -229,7 +209,7 @@ common:debug --test_timeout=9999
# Migration requires setting a toolchain parameter inside ctx.actions.{run, run_shell} for actions which use tool or executable from a toolchain.
#
# See https://github.com/bazelbuild/bazel/issues/17134
common --incompatible_auto_exec_groups
# common --incompatible_auto_exec_groups
# Docs: https://registry.build/flag/bazel?filter=incompatible_auto_exec_groups

# Language specific rules (Protos, Java, C++, Android) are being rewritten to Starlark and moved from Bazel into their rules repositories
Expand Down
22 changes: 22 additions & 0 deletions bazel/defs.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,28 @@ Mostly for working around Bazel migration issues.
load("@bazel_features_version//:version.bzl", bazel_version = "version")
load("@bazel_skylib//lib:versions.bzl", "versions")

# Quick and dirty way to render the bazelrc preset generation just incompatible
# on Bazel other than our baseline (7.X).
def incompatible_with(version, default = []):
"""Incompatibility with Bazel.

A hacky way to mark a target (or toolchain) as incompatible with the Bazel
engine itself.

Args:
version (str): The version Bazle to decide incompatibility with.
default (list): The default compatibility list.

Returns:
The default compatibility list, or incompatible.

"""

if versions.is_at_least(version, bazel_version):
return ["@platforms//:incompatible"]
else:
return default

def munge(label):
"""Munge external labels from 7->8.

Expand Down
27 changes: 27 additions & 0 deletions bazel/patches/llvm_darwin_sysroot.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
diff --git a/MODULE.bazel b/MODULE.bazel
index b631904..31042c1 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -103,18 +103,12 @@ use_repo(musl, "musl_libc")
mingw = use_extension("//runtimes/mingw/extension:mingw.bzl", "mingw")
use_repo(mingw, "mingw")

-http_pkg_archive = use_repo_rule("//:http_pkg_archive.bzl", "http_pkg_archive")
-
-http_pkg_archive(
+http_archive(
name = "macosx15.4.sdk",
+ urls = ["https://github.com/hexops-graveyard/sdk-macos-11.3/archive/ccbaae84cc39469a6792108b24480a4806e09d59.tar.gz"],
+ integrity = "sha256-EYcKSj04K3g0mGEIEmSSG7iDRAp+Cz3UoAc3PYcySjg=",
build_file = "//third_party/macosx.sdk:BUILD.MacOSX15.4.sdk.tpl",
- sha256 = "ba3453d62b3d2babf67f3a4a44e8073d6555c85f114856f4390a1f53bd76e24a",
- strip_files = [
- "Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk/System/Library/Frameworks/Ruby.framework/Versions/Current/Headers/ruby",
- ],
- strip_prefix = "Library/Developer/CommandLineTools/SDKs/MacOSX15.5.sdk",
- # urls = ["https://swcdn.apple.com/content/downloads/10/32/082-12052-A_AHPGDY76PT/1a419zaf3vh8o9t3c0usblyr8eystpnsh5/CLTools_macOSNMOS_SDK.pkg"],
- urls = ["https://swcdn.apple.com/content/downloads/52/01/082-41241-A_0747ZN8FHV/dectd075r63pppkkzsb75qk61s0lfee22j/CLTools_macOSNMOS_SDK.pkg"],
+ strip_prefix = "sdk-macos-11.3-ccbaae84cc39469a6792108b24480a4806e09d59/root",
)

glibc = use_extension("//runtimes/glibc/extension:glibc.bzl", "glibc")
Loading