Skip to content

Commit

Permalink
Merge branch 'bazel' into bazel-recursive-stubgen
Browse files Browse the repository at this point in the history
  • Loading branch information
nicholasjng authored Dec 9, 2024
2 parents 847d700 + 47dbfd8 commit 600a5d9
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 30 deletions.
3 changes: 1 addition & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ git_override(
remote = "https://github.com/hedronvision/bazel-compile-commands-extractor.git",
)

bazel_dep(name = "rules_python", version = "0.31.0")
bazel_dep(name = "rules_python", version = "1.0.0")

python = use_extension("@rules_python//python/extensions:python.bzl", "python")
python.toolchain(python_version = "3.8")
Expand All @@ -27,7 +27,6 @@ python.toolchain(
is_default = True,
python_version = "3.12",
)
python.toolchain(python_version = "3.13")

use_repo(
python,
Expand Down
23 changes: 4 additions & 19 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[build-system]
requires = ["setuptools<73"]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[project]
Expand All @@ -8,27 +8,12 @@ version = "0.0.1"
description = "An example minimal project that compiles bindings using nanobind and Bazel"
readme = "README.md"
requires-python = ">=3.8"
authors = [
{ name = "Wenzel Jakob", email = "[email protected]" },
]
classifiers = [
"License :: OSI Approved :: BSD License",
]
authors = [{ name = "Wenzel Jakob", email = "[email protected]" }]
classifiers = ["License :: OSI Approved :: BSD License"]

[project.urls]
Homepage = "https://github.com/wjakob/nanobind_example"


[tool.scikit-build]
# Protect the configuration against future changes in scikit-build-core
minimum-version = "0.4"

# Setuptools-style build caching in a local directory
build-dir = "build/{wheel_tag}"

# Build stable ABI wheels for CPython 3.12+
wheel.py-api = "cp312"

[tool.cibuildwheel]
# Necessary to see build output from the actual compilation
build-verbosity = 1
Expand All @@ -38,7 +23,7 @@ test-command = "pytest {project}/tests"
test-requires = "pytest"

# Don't test Python 3.8 wheels on macOS/arm64
test-skip="cp38-macosx_*:arm64"
test-skip = "cp38-macosx_*:arm64"

# Needed for full C++17 support
[tool.cibuildwheel.macos.environment]
Expand Down
10 changes: 1 addition & 9 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class BuildBazelExtension(build_ext.build_ext):
def run(self):
for ext in self.extensions:
self.bazel_build(ext)
super().run()

# explicitly call `bazel shutdown` for graceful exit
self.spawn(["bazel", "shutdown"])

Expand Down Expand Up @@ -64,14 +64,6 @@ def bazel_build(self, ext: BazelExtension) -> None:
if ext.py_limited_api:
bazel_argv += ["--py_limited_api=cp312"]

if IS_WINDOWS:
# Link with python*.lib.
# This technically breaks the hermeticity of rules_python,
# but its library target does not contain libs/python3.lib for SABI builds,
# so we source it from the build interpreter instead.
for library_dir in self.library_dirs:
bazel_argv.append("--linkopt=/LIBPATH:" + library_dir)

self.spawn(bazel_argv)

if IS_WINDOWS:
Expand Down

0 comments on commit 600a5d9

Please sign in to comment.