Skip to content

Commit a6357b1

Browse files
committed
Provide alias to import pyodide wheels under WORKSPACE
1 parent 5f0cc40 commit a6357b1

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

build/deps/dep_pyodide.bzl

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive", "http_file")
2+
load("@bazel_tools//tools/build_defs/repo:local.bzl", "new_local_repository")
23
load("//:build/python_metadata.bzl", "BUNDLE_VERSION_INFO", "PYODIDE_VERSIONS", "PYTHON_LOCKFILES")
34

45
def _pyodide_core(*, version, sha256, **_kwds):
@@ -25,6 +26,15 @@ def _pyodide_packages(*, tag, lockfile_hash, all_wheels_hash, **_kwds):
2526
urls = ["https://github.com/cloudflare/pyodide-build-scripts/releases/download/%s/all_wheels.zip" % tag],
2627
)
2728

29+
# TODO(cleanup): Alias for importing pyodide via WORKSPACE while still having the mangled name,
30+
# remove once downstream imports workerd using bzlmod.
31+
http_archive(
32+
name = "+pyodide+all_pyodide_wheels_%s" % tag,
33+
build_file = "@workerd//:build/BUILD.all_pyodide_wheels",
34+
sha256 = all_wheels_hash,
35+
urls = ["https://github.com/cloudflare/pyodide-build-scripts/releases/download/%s/all_wheels.zip" % tag],
36+
)
37+
2838
VENDOR_R2 = "https://pub-25a5b2f2f1b84655b185a505c7a3ad23.r2.dev/"
2939

3040
def _py_vendor_test_deps(version, name, sha256, abi, **_kwds):

src/workerd/server/tests/python/import_tests.bzl

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,10 +45,12 @@ def _test(name, directory, wd_test, py_file, python_version, **kwds):
4545
python_flags = [python_version],
4646
use_snapshot = None,
4747
make_snapshot = False,
48-
# TODO: +pyodide+ is a bzlmod canonical repository name
48+
# +pyodide+ is a bzlmod canonical repository name
4949
args = ["--experimental", "--pyodide-package-disk-cache-dir", "../+pyodide+all_pyodide_wheels_%s" % pkg_tag],
5050
skip_default_data = True,
51-
data = [py_file, "@all_pyodide_wheels_%s//:whls" % pkg_tag],
51+
# TODO(cleanup): importing both bzlmod and non-bzlmod versions of wheels, clean up once
52+
# downstream repo fully uses bzlmod
53+
data = [py_file, "@+pyodide+all_pyodide_wheels_%s//:whls" % pkg_tag, "@all_pyodide_wheels_%s//:whls" % pkg_tag],
5254
**kwds
5355
)
5456

0 commit comments

Comments
 (0)