Skip to content

chore(deps): update pre-commit hooks #5605

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Apr 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions .github/workflows/configure.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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"

Expand Down
8 changes: 4 additions & 4 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
Expand Down Expand Up @@ -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
Expand Down
10 changes: 5 additions & 5 deletions include/pybind11/pybind11.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<Arg>(args)...); },
(Return(*)(Class *, Arg...)) nullptr,
(Return (*)(Class *, Arg...)) nullptr,
extra...);
}

Expand All @@ -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<Arg>(args)...); },
(Return(*)(Class *, Arg...)) nullptr,
(Return (*)(Class *, Arg...)) nullptr,
extra...);
}

Expand All @@ -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<Arg>(args)...); },
(Return(*)(const Class *, Arg...)) nullptr,
(Return (*)(const Class *, Arg...)) nullptr,
extra...);
}

Expand All @@ -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<Arg>(args)...); },
(Return(*)(const Class *, Arg...)) nullptr,
(Return (*)(const Class *, Arg...)) nullptr,
extra...);
}

Expand Down Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down
4 changes: 2 additions & 2 deletions tests/test_buffers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
16 changes: 7 additions & 9 deletions tests/test_enum.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion tests/test_opaque_types.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down