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
4 changes: 2 additions & 2 deletions .bazelrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,8 @@ build --test_size_filters=-enormous
# corresponds to small,medium,large,enormous tests (medium is default)
build --test_timeout=3,15,60,240

# We're only using bzlmod in a nominal capacity so far
common --enable_workspace
# opt-in for Bazel 9
common --noenable_workspace

# As part of starlarkification, Bazel 8 removes a number of rules which now need to be imported from
# other repositories. In the long term, load() statements will be needed to import these rules. For
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/_bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/bazel-disk-cache
key: bazel-disk-cache${{ inputs.phase}}-${{ inputs.os_name }}-${{ runner.arch }}${{ inputs.suffix }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}
key: bazel-disk-cache${{ inputs.phase}}-${{ inputs.os_name }}-${{ runner.arch }}${{ inputs.suffix }}-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel') }}
# Intentionally not reusing an older cache entry using a key prefix, bazel frequently
# ends up with a larger cache at the end when starting with an available cache entry,
# resulting in a snowballing cache size and cache download/upload times.
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codspeed.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
uses: actions/cache@v4
with:
path: ~/bazel-disk-cache
key: bazel-disk-cache-benchmarks-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}
key: bazel-disk-cache-benchmarks-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel') }}

- name: Setup Runner
uses: ./.github/actions/setup-runner
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ jobs:
# sizes small and generate types with optimization enabled, should be slightly faster.
with:
path: ~/bazel-disk-cache
key: bazel-disk-cache-release-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'WORKSPACE') }}
key: bazel-disk-cache-release-${{ runner.os }}-${{ runner.arch }}-${{ hashFiles('.bazelversion', '.bazelrc', 'MODULE.bazel') }}
- name: Setup Runner
uses: ./.github/actions/setup-runner
- name: build types
Expand Down
19 changes: 0 additions & 19 deletions WORKSPACE

This file was deleted.

77 changes: 45 additions & 32 deletions build/deps/dep_pyodide.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -44,38 +44,6 @@ filegroup(

SNAPSHOT_R2 = "https://pyodide-capnp-bin.edgeworker.net/"

def _snapshot_http_file(bundle_name, folder, snapshot, integrity, hash, r2_base = SNAPSHOT_R2):
if not snapshot:
return
if not integrity:
fail("Snapshot %s from bundle %s has missing integrity" % (snapshot, bundle_name))
if folder == "baseline-snapshot/":
key = hash
else:
key = snapshot
http_file(
name = "pyodide-snapshot-" + snapshot,
integrity = integrity,
url = r2_base + folder + key,
)

def _snapshot_http_files(
name,
baseline_snapshot = None,
baseline_snapshot_hash = None,
baseline_snapshot_integrity = None,
numpy_snapshot = None,
numpy_snapshot_integrity = None,
fastapi_snapshot = None,
fastapi_snapshot_integrity = None,
dedicated_fastapi_snapshot = None,
dedicated_fastapi_snapshot_integrity = None,
**_kwds):
_snapshot_http_file(name, "baseline-snapshot/", baseline_snapshot, baseline_snapshot_integrity, baseline_snapshot_hash)
_snapshot_http_file(name, "test-snapshot/", numpy_snapshot, numpy_snapshot_integrity, None)
_snapshot_http_file(name, "test-snapshot/", fastapi_snapshot, fastapi_snapshot_integrity, None)
_snapshot_http_file(name, "", dedicated_fastapi_snapshot, dedicated_fastapi_snapshot_integrity, None, VENDOR_R2)

def dep_pyodide():
for info in PYODIDE_VERSIONS:
_pyodide_core(**info)
Expand All @@ -87,5 +55,50 @@ def dep_pyodide():
for info in PYTHON_LOCKFILES:
_pyodide_packages(**info)

# Accumulator to de-duplicate generated http_file rules.
gen_http_file = {}

def _snapshot_http_files(
name,
baseline_snapshot = None,
baseline_snapshot_hash = None,
baseline_snapshot_integrity = None,
numpy_snapshot = None,
numpy_snapshot_integrity = None,
fastapi_snapshot = None,
fastapi_snapshot_integrity = None,
dedicated_fastapi_snapshot = None,
dedicated_fastapi_snapshot_integrity = None,
**_kwds):
def _snapshot_http_file(bundle_name, folder, snapshot, integrity, hash, r2_base = SNAPSHOT_R2):
if not snapshot:
return
if not integrity:
fail("Snapshot %s from bundle %s has missing integrity" % (snapshot, bundle_name))
if folder == "baseline-snapshot/":
key = hash
else:
key = snapshot
gen_http_file[snapshot] = struct(
integrity = integrity,
url = r2_base + folder + key,
)

_snapshot_http_file(name, "baseline-snapshot/", baseline_snapshot, baseline_snapshot_integrity, baseline_snapshot_hash)
_snapshot_http_file(name, "test-snapshot/", numpy_snapshot, numpy_snapshot_integrity, None)
_snapshot_http_file(name, "test-snapshot/", fastapi_snapshot, fastapi_snapshot_integrity, None)
_snapshot_http_file(name, "", dedicated_fastapi_snapshot, dedicated_fastapi_snapshot_integrity, None, VENDOR_R2)

for ver in BUNDLE_VERSION_INFO.values():
_snapshot_http_files(**ver)
for snapshot, info in gen_http_file.items():
http_file(
name = "pyodide-snapshot-" + snapshot,
integrity = info.integrity,
url = info.url,
)

def _impl(module_ctx):
dep_pyodide()

pyodide = module_extension(implementation = _impl)
52 changes: 52 additions & 0 deletions build/deps/python.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -18,3 +18,55 @@ pip.parse(
requirements_lock = "//build/deps:requirements.txt",
)
use_repo(pip, "py_deps", "v8_python_deps")

pyodide = use_extension("//build/deps:dep_pyodide.bzl", "pyodide")

[
use_repo(
pyodide,
repo.format(version = version),
)
for repo in [
"beautifulsoup4_src_{version}",
"fastapi_src_{version}",
"pyodide-{version}",
"python-workers-runtime-sdk_src_{version}",
"shapely_src_{version}",
]
for version in [
"0.26.0a2",
"0.28.2",
"development",
]
# Exclusions: some packages are absent in some versions
if repo.format(version = version) not in [
"pyodide-development",
"shapely_src_0.26.0a2",
]
]

[
use_repo(
pyodide,
repo.format(version = version),
)
for repo in [
"all_pyodide_wheels_{version}",
"pyodide-lock_{version}.json",
]
for version in [
"20240829.4",
"20250808",
]
]

use_repo(
pyodide,
"pyodide-snapshot-baseline-4569679fb.bin",
"pyodide-snapshot-baseline-61eedf943.bin",
"pyodide-snapshot-ew-py-package-snapshot_fastapi-v2.bin",
"pyodide-snapshot-ew-py-package-snapshot_numpy-v2.bin",
"pyodide-snapshot-package_snapshot_fastapi-a6ccb56fe.bin",
"pyodide-snapshot-package_snapshot_numpy-60c9cb28e.bin",
"pyodide-snapshot-snapshot_a6b652a95810783f5078b9a5dbd4a07c30718acb4ff724e82c25db7353dd7f2d.bin",
)
12 changes: 12 additions & 0 deletions build/deps/rust.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -53,3 +53,15 @@ new_local_repository(
build_file = "@workerd//deps/rust:BUILD.lolhtml",
path = "empty",
)

http_archive = use_repo_rule("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
name = "workerd-cxx",
patch_args = ["-p1"],
patches = ["//:patches/workerd-cxx.patch"],
sha256 = "7ddce8e81d0b81adf6f07f18376a6fea9dca42e6b03b2fcf703c62196c270ad0",
strip_prefix = "cloudflare-workerd-cxx-916f0e7",
type = "tgz",
url = "https://github.com/cloudflare/workerd-cxx/tarball/916f0e7be8f1d43fe5ece1b72edd3c5844243d7b",
)
Loading
Loading