Skip to content

Commit

Permalink
Apply nanobind_bazel patch via git instead (#53)
Browse files Browse the repository at this point in the history
* Apply nanobind_bazel patch via git instead

This is way less complicated and not as error-prone.

Update `setup-uv` to v5 everywhere to incorporate caching into CI.
The example test could probably also be simplified, since venvs are automatically
created now, but this will happen in another PR.
  • Loading branch information
nicholasjng authored Jan 5, 2025
1 parent 62fa253 commit 3fdbc38
Show file tree
Hide file tree
Showing 4 changed files with 33 additions and 57 deletions.
11 changes: 4 additions & 7 deletions .github/workflows/lint-and-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
with:
fetch-depth: 0
- name: Install uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v5
- name: Run pre-commit checks
run: uvx pre-commit run --all-files --verbose --show-diff-on-failure
test:
Expand All @@ -31,7 +31,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Install uv
uses: astral-sh/setup-uv@v4
uses: astral-sh/setup-uv@v5
with:
python-version: ${{ matrix.python-version }}
- name: Check out nanobind example repo
Expand All @@ -40,12 +40,9 @@ jobs:
repository: wjakob/nanobind_example
path: nanobind_example
ref: bazel
- name: Patch nanobind_example stubgen target
run: git apply ${{github.workspace }}/stubgen.patch
- name: Override nanobind_bazel dep with local checkout in MODULE.bazel
run: git apply ${{github.workspace }}/nanobind_bazel_local_override.patch
working-directory: ${{ github.workspace }}/nanobind_example

- name: Override nanobind_bazel pin in MODULE.bazel
run: python fixup_module_bazel.py ${{ github.workspace}}/nanobind_example
- name: Build and test nanobind_example on ${{ matrix.os }}
# --no-sync is required so that uv does not remove the .so file again.
run: |
Expand Down
37 changes: 0 additions & 37 deletions fixup_module_bazel.py

This file was deleted.

29 changes: 29 additions & 0 deletions nanobind_bazel_local_override.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
diff --git a/MODULE.bazel b/MODULE.bazel
index 7723d4c..a15a36b 100644
--- a/MODULE.bazel
+++ b/MODULE.bazel
@@ -1,6 +1,10 @@
module(name = "nanobind_example", version = "0.1.0")

-bazel_dep(name = "nanobind_bazel", version = "2.4.0")
+bazel_dep(name = "nanobind_bazel", version = "")
+local_path_override(
+ module_name = "nanobind_bazel",
+ path = "../",
+)
bazel_dep(name = "rules_python", version = "1.0.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
diff --git a/src/BUILD b/src/BUILD
index 5562dca..95e210e 100644
--- a/src/BUILD
+++ b/src/BUILD
@@ -20,6 +20,6 @@ nanobind_stubgen(
name = "nanobind_example_ext_stubgen",
module = ":nanobind_example_ext",
marker_file = "src/py.typed",
- output_directory = "src",
- recursive = True,
+# output_directory = "src",
+# recursive = True,
)
13 changes: 0 additions & 13 deletions stubgen.patch

This file was deleted.

0 comments on commit 3fdbc38

Please sign in to comment.