Skip to content

Commit

Permalink
Use rules_python free-threading config settings (#50)
Browse files Browse the repository at this point in the history
Eliminates the need for custom settings, and another flag to set for consuming builds.

This requires a bump to rules_python v0.39.0, which introduced free-threading support.
  • Loading branch information
nicholasjng authored Dec 22, 2024
1 parent 7d1bb7c commit a601352
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 18 deletions.
15 changes: 0 additions & 15 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -30,21 +30,6 @@ config_setting(
flag_values = {":minsize": "False"},
)

bool_flag(
name = "free_threading",
build_setting_default = False,
)

config_setting(
name = "with_free_threading",
flag_values = {":free_threading": "True"},
)

config_setting(
name = "without_free_threading",
flag_values = {":free_threading": "False"},
)

string_flag(
name = "py-limited-api",
build_setting_default = "unset",
Expand Down
2 changes: 1 addition & 1 deletion MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module(

bazel_dep(name = "platforms", version = "0.0.10")
bazel_dep(name = "rules_cc", version = "0.0.9")
bazel_dep(name = "rules_python", version = "0.37.0")
bazel_dep(name = "rules_python", version = "0.39.0")
bazel_dep(name = "bazel_skylib", version = "1.7.1")

# Creates a `http_archive` for nanobind and robin-map.
Expand Down
4 changes: 2 additions & 2 deletions helpers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,6 @@ def extension_name(name):
# Optionally add a define for free-threaded nanobind builds.
def nb_free_threading():
return select({
"@nanobind_bazel//:with_free_threading": ["NB_FREE_THREADED"],
"@nanobind_bazel//:without_free_threading": [],
"@rules_python//python/config_settings:is_py_freethreaded": ["NB_FREE_THREADED"],
"//conditions:default": [],
})

0 comments on commit a601352

Please sign in to comment.