diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md index fbdf075f03..a09b630a21 100644 --- a/.github/CONTRIBUTING.md +++ b/.github/CONTRIBUTING.md @@ -165,7 +165,7 @@ The valid options are: * Use `cmake --build build -j12` to build with 12 cores (for example). * Use `-G` and the name of a generator to use something different. `cmake --help` lists the generators available. - - On Unix, setting `CMAKE_GENERATER=Ninja` in your environment will give + - On Unix, setting `CMAKE_GENERATOR=Ninja` in your environment will give you automatic multithreading on all your CMake projects! * Open the `CMakeLists.txt` with QtCreator to generate for that IDE. * You can use `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` to generate the `.json` file diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba6f3829ae..aa7b58cc40 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -115,9 +115,16 @@ repos: rev: "v2.4.1" hooks: - id: codespell - exclude: ".supp$" + exclude: "(.supp|^pyproject.toml)$" args: ["-x.codespell-ignore-lines", "-Lccompiler,intstruct"] +# Also check spelling +- repo: https://github.com/crate-ci/typos + rev: v1.40.0 + hooks: + - id: typos + args: [] + # Check for common shell mistakes - repo: https://github.com/shellcheck-py/shellcheck-py rev: "v0.11.0.1" diff --git a/docs/advanced/embedding.rst b/docs/advanced/embedding.rst index 3ac0579385..7d770faa21 100644 --- a/docs/advanced/embedding.rst +++ b/docs/advanced/embedding.rst @@ -302,7 +302,7 @@ Activating a Sub-interpreter Once a sub-interpreter is created, you can "activate" it on a thread (and acquire its GIL) by creating a :class:`subinterpreter_scoped_activate` -instance and passing it the sub-intepreter to be activated. The function +instance and passing it the sub-interpreter to be activated. The function will acquire the sub-interpreter's GIL and make the sub-interpreter the current active interpreter on the current thread for the lifetime of the instance. When the :class:`subinterpreter_scoped_activate` instance goes out diff --git a/docs/changelog.md b/docs/changelog.md index c8d631879f..4bf23a697f 100644 --- a/docs/changelog.md +++ b/docs/changelog.md @@ -167,7 +167,7 @@ New Features: [#5665](https://github.com/pybind/pybind11/pull/5665) and consolidate code [#5670](https://github.com/pybind/pybind11/pull/5670). -- Added API in `pybind11/subinterpreter.h` for embedding sub-intepreters (requires Python 3.12+). +- Added API in `pybind11/subinterpreter.h` for embedding sub-interpreters (requires Python 3.12+). [#5666](https://github.com/pybind/pybind11/pull/5666) - `py::native_enum` was added, for conversions between Python's native @@ -1213,7 +1213,7 @@ Performance and style: - Optimize Eigen sparse matrix casting by removing unnecessary temporary. [#4064](https://github.com/pybind/pybind11/pull/4064) - Avoid potential implicit copy/assignment constructors causing double - free in `strdup_gaurd`. + free in `strdup_guard`. [#3905](https://github.com/pybind/pybind11/pull/3905) - Enable clang-tidy checks `misc-definitions-in-headers`, `modernize-loop-convert`, and `modernize-use-nullptr`. diff --git a/pyproject.toml b/pyproject.toml index 274de222af..7a12eed1ac 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -184,3 +184,26 @@ isort.required-imports = ["from __future__ import annotations"] [tool.repo-review] ignore = ["PP"] + +[tool.typos] +files.extend-exclude = ["/cpython"] + +[tool.typos.default.extend-identifiers] +ser_no = "ser_no" +SerNo = "SerNo" +StrLits = "StrLits" + +[tool.typos.default.extend-words] +nd = "nd" +valu = "valu" +fo = "fo" +quater = "quater" +optin = "optin" +othr = "othr" + +#[tool.typos.type.cpp.extend-words] +setp = "setp" +ot = "ot" + +[tool.typos.type.json.extend-words] +ba = "ba" diff --git a/tests/conftest.py b/tests/conftest.py index 39de4e1381..9d9815b88c 100644 --- a/tests/conftest.py +++ b/tests/conftest.py @@ -304,10 +304,10 @@ def backport_typehints() -> Callable[[SanitizedString], SanitizedString]: if sys.version_info < (3, 10): d["typing_extensions.TypeGuard"] = "typing.TypeGuard" - def backport(sanatized_string: SanitizedString) -> SanitizedString: + def backport(sanitized_string: SanitizedString) -> SanitizedString: for old, new in d.items(): - sanatized_string.string = sanatized_string.string.replace(old, new) + sanitized_string.string = sanitized_string.string.replace(old, new) - return sanatized_string + return sanitized_string return backport diff --git a/tests/test_docstring_options.py b/tests/test_docstring_options.py index 802a1ec9e5..ffd1a739d6 100644 --- a/tests/test_docstring_options.py +++ b/tests/test_docstring_options.py @@ -48,7 +48,7 @@ def test_docstring_options(): assert not m.DocstringTestFoo.__doc__ assert not m.DocstringTestFoo.value_prop.__doc__ - # Check existig behaviour of enum docstings + # Check existing behaviour of enum docstings assert ( m.DocstringTestEnum1.__doc__ == "Enum docstring\n\nMembers:\n\n Member1\n\n Member2"