feat: typing support for helpers (#2588)
* feat: basic typing support
* docs: mention syncing as suggested by @rwgk
* docs: update changelog
* docs: copy of warning in limitations
diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml
index fae8f38..13ba4e3 100644
--- a/.pre-commit-config.yaml
+++ b/.pre-commit-config.yaml
@@ -34,8 +34,10 @@
rev: 20.8b1
hooks:
- id: black
+ # By default, this ignores pyi files, though black supports them
+ types: [text]
# Not all Python files are Blacked, yet
- files: ^(setup.py|pybind11|tests/extra)
+ files: ^(setup.py|pybind11|tests/extra|tools).*\.pyi?$
# Changes tabs to spaces
- repo: https://github.com/Lucas-C/pre-commit-hooks
@@ -60,6 +62,17 @@
types: [file]
files: (\.cmake|CMakeLists.txt)(.in)?$
+# Check static types with mypy
+- repo: https://github.com/pre-commit/mirrors-mypy
+ rev: v0.790
+ hooks:
+ - id: mypy
+ # The default Python type ignores .pyi files, so let's rerun if detected
+ types: [text]
+ files: ^pybind11.*\.pyi?$
+ # Running per-file misbehaves a bit, so just run on all files, it's fast
+ pass_filenames: false
+
# Checks the manifest for missing files (native support)
- repo: https://github.com/mgedmin/check-manifest
rev: "0.43"