diff --git a/.github/workflows/configure.yml b/.github/workflows/configure.yml index 2031ec8236..5a64bb5e96 100644 --- a/.github/workflows/configure.yml +++ b/.github/workflows/configure.yml @@ -24,16 +24,16 @@ jobs: strategy: fail-fast: false matrix: - runs-on: [ubuntu-20.04, macos-13, windows-latest] + runs-on: [ubuntu-22.04, macos-13, windows-latest] arch: [x64] cmake: ["3.26"] include: - - runs-on: ubuntu-20.04 + - runs-on: ubuntu-22.04 arch: x64 cmake: "3.15" - - runs-on: ubuntu-20.04 + - runs-on: ubuntu-22.04 arch: x64 cmake: "3.29" diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index e5002e8fdd..34354898b6 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -25,14 +25,14 @@ repos: # Clang format the codebase automatically - repo: https://github.com/pre-commit/mirrors-clang-format - rev: "v19.1.7" + rev: "v20.1.0" hooks: - id: clang-format types_or: [c++, c, cuda] # Ruff, the Python auto-correcting linter/formatter written in Rust - repo: https://github.com/astral-sh/ruff-pre-commit - rev: v0.9.9 + rev: v0.11.4 hooks: - id: ruff args: ["--fix", "--show-fixes"] @@ -144,14 +144,14 @@ repos: # PyLint has native support - not always usable, but works for us - repo: https://github.com/PyCQA/pylint - rev: "v3.3.4" + rev: "v3.3.6" hooks: - id: pylint files: ^pybind11 # Check schemas on some of our YAML files - repo: https://github.com/python-jsonschema/check-jsonschema - rev: 0.31.2 + rev: 0.32.1 hooks: - id: check-readthedocs - id: check-github-workflows diff --git a/include/pybind11/pybind11.h b/include/pybind11/pybind11.h index 75a0b49695..2c7839c16f 100644 --- a/include/pybind11/pybind11.h +++ b/include/pybind11/pybind11.h @@ -277,7 +277,7 @@ class cpp_function : public function { cpp_function(Return (Class::*f)(Arg...), const Extra &...extra) { initialize( [f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward(args)...); }, - (Return(*)(Class *, Arg...)) nullptr, + (Return (*)(Class *, Arg...)) nullptr, extra...); } @@ -289,7 +289,7 @@ class cpp_function : public function { cpp_function(Return (Class::*f)(Arg...) &, const Extra &...extra) { initialize( [f](Class *c, Arg... args) -> Return { return (c->*f)(std::forward(args)...); }, - (Return(*)(Class *, Arg...)) nullptr, + (Return (*)(Class *, Arg...)) nullptr, extra...); } @@ -299,7 +299,7 @@ class cpp_function : public function { cpp_function(Return (Class::*f)(Arg...) const, const Extra &...extra) { initialize([f](const Class *c, Arg... args) -> Return { return (c->*f)(std::forward(args)...); }, - (Return(*)(const Class *, Arg...)) nullptr, + (Return (*)(const Class *, Arg...)) nullptr, extra...); } @@ -311,7 +311,7 @@ class cpp_function : public function { cpp_function(Return (Class::*f)(Arg...) const &, const Extra &...extra) { initialize([f](const Class *c, Arg... args) -> Return { return (c->*f)(std::forward(args)...); }, - (Return(*)(const Class *, Arg...)) nullptr, + (Return (*)(const Class *, Arg...)) nullptr, extra...); } @@ -874,7 +874,7 @@ class cpp_function : public function { function_call call(func, parent); // Protect std::min with parentheses - size_t args_to_copy = (std::min)(pos_args, n_args_in); + size_t args_to_copy = (std::min) (pos_args, n_args_in); size_t args_copied = 0; // 0. Inject new-style `self` argument diff --git a/setup.py b/setup.py index c65bbc6274..a5af04e18e 100644 --- a/setup.py +++ b/setup.py @@ -51,7 +51,7 @@ def build_expected_version_hex(matches: dict[str, str]) -> str: # PYBIND11_GLOBAL_SDIST will build a different sdist, with the python-headers # files, and the sys.prefix files (CMake and headers). -global_sdist = os.environ.get("PYBIND11_GLOBAL_SDIST", False) +global_sdist = os.environ.get("PYBIND11_GLOBAL_SDIST") setup_py = Path( "tools/setup_global.py.in" if global_sdist else "tools/setup_main.py.in" diff --git a/tests/test_buffers.cpp b/tests/test_buffers.cpp index ac4489f70c..a090c8745f 100644 --- a/tests/test_buffers.cpp +++ b/tests/test_buffers.cpp @@ -237,11 +237,11 @@ TEST_SUBMODULE(buffers, m) { } float operator()(py::ssize_t i, py::ssize_t j) const { - return Matrix::operator()(i * m_row_factor, j * m_col_factor); + return Matrix::operator()(i *m_row_factor, j *m_col_factor); } float &operator()(py::ssize_t i, py::ssize_t j) { - return Matrix::operator()(i * m_row_factor, j * m_col_factor); + return Matrix::operator()(i *m_row_factor, j *m_col_factor); } using Matrix::data; diff --git a/tests/test_enum.py b/tests/test_enum.py index 874dae0100..99d4a88c8a 100644 --- a/tests/test_enum.py +++ b/tests/test_enum.py @@ -59,15 +59,13 @@ def test_unscoped_enum(): "EThree": m.UnscopedEnum.EThree, } - for docstring_line in """An unscoped enumeration - -Members: - - EOne : Docstring for EOne - - ETwo : Docstring for ETwo - - EThree : Docstring for EThree""".split("\n"): + for docstring_line in [ + "An unscoped enumeration", + "Members:", + " EOne : Docstring for EOne", + " ETwo : Docstring for ETwo", + " EThree : Docstring for EThree", + ]: assert docstring_line in m.UnscopedEnum.__doc__ # Unscoped enums will accept ==/!= int comparisons diff --git a/tests/test_opaque_types.cpp b/tests/test_opaque_types.cpp index da3866cd00..2e972d0b88 100644 --- a/tests/test_opaque_types.cpp +++ b/tests/test_opaque_types.cpp @@ -28,7 +28,7 @@ TEST_SUBMODULE(opaque_types, m) { .def(py::init<>()) .def("pop_back", &StringList::pop_back) /* There are multiple versions of push_back(), etc. Select the right ones. */ - .def("push_back", (void(StringList::*)(const std::string &)) & StringList::push_back) + .def("push_back", (void (StringList::*)(const std::string &)) &StringList::push_back) .def("back", (std::string & (StringList::*) ()) & StringList::back) .def("__len__", [](const StringList &v) { return v.size(); }) .def(