Skip to content

Commit f3790af

Browse files
committed
Enable pybind11 modules to be used with free-threaded Python
Raise minimum required version for dependencies that added support for free-threaded Python when using Python 3.14 or later.
1 parent dcc6384 commit f3790af

3 files changed

Lines changed: 6 additions & 3 deletions

File tree

pyproject.toml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[build-system]
2-
requires = ["scikit-build-core", "pybind11>=2.13"]
2+
requires = ["scikit-build-core", "pybind11>=3.0.0"]
33
build-backend = "scikit_build_core.build"
44

55
[project]
@@ -20,9 +20,12 @@ authors = [
2020
dependencies = [
2121
"jinja2",
2222
"numpy>=1.7",
23+
"numpy>=2.1.0; python_version >= '3.14'",
2324
"scipy>=0.13.2",
25+
"scipy>=1.15.2; python_version >= '3.14'",
2426
"setuptools",
2527
"joblib",
28+
"joblib>=1.4.2; python_version >= '3.14'",
2629
]
2730

2831
[project.urls]

src/bindings.cpp.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -313,7 +313,7 @@ OSQPInt PyOSQPSolver::codegen(const char *output_dir, const char *file_prefix, O
313313
return osqp_codegen(this->_solver, output_dir, file_prefix, &defines);
314314
}
315315

316-
PYBIND11_MODULE(@OSQP_EXT_MODULE_NAME@, m) {
316+
PYBIND11_MODULE(@OSQP_EXT_MODULE_NAME@, m, py::mod_gil_not_used()) {
317317

318318
#ifdef OSQP_USE_FLOAT
319319
m.attr("OSQP_USE_FLOAT") = 1;

src/osqp/codegen/pywrapper/bindings.cpp.jinja

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ OSQPInt update_data_mat(py::object P_x, py::object P_i, py::object A_x, py::obje
9090
}
9191
#endif
9292

93-
PYBIND11_MODULE({{extension_name}}, m) {
93+
PYBIND11_MODULE({{extension_name}}, m, py::mod_gil_not_used()) {
9494
m.def("solve", &solve);
9595
m.def("update_data_vec", &update_data_vec, "Update q/l/u", py::arg("q") = py::none(), py::arg("l") = py::none(), py::arg("u") = py::none());
9696
#if OSQP_EMBEDDED_MODE == 2

0 commit comments

Comments
 (0)