You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add automatically-generated .pyi files to cuda_core (#2061)
* Add infrastructure for type-checking cuda_core
* Update all type annotations so they pass type-checking
* Add new .pyi files
* Pin Cython version
* Address feedback in the PR
* Fix tests
* Complete type annotations for public APIs
* Fix type annotations
* Fix previous merge
* Remove pre-cuda.bindings imports
* Fix isinstance check
* Add CONTRIBUTING docs
* More type annotations
* Fix build
* Fix types
`cuda.core` is a PEP 561-compliant package: it ships a `py.typed` marker and
39
+
`.pyi` stub files alongside the Cython extensions. The stubs
40
+
are checked into the repository.
41
+
42
+
**You do not need to run stubgen-pyx manually.** A pre-commit hook
43
+
regenerates the corresponding `.pyi` files automatically when you commit.
44
+
The results are then also tested with `mypy`.
45
+
46
+
A few things to keep in mind:
47
+
48
+
-**Do not edit `.pyi` files by hand.** They are regenerated from the Cython
49
+
sources on every commit that touches those sources; manual edits will be
50
+
overwritten.
51
+
-**Type annotations belong in the `.pyx`/`.pxd` source.** stubgen-pyx reads
52
+
Cython type annotations and docstrings to build the stubs, so keeping the
53
+
source well-annotated is the right way to improve stub quality.
54
+
-**To run mypy manually (outside of pre-commit)**: `python -m mypy
55
+
--config-file cuda_core/pyproject.toml
25
56
26
57
## Pre-commit
27
58
This project uses [pre-commit.ci](https://pre-commit.ci/) with GitHub Actions. All pull requests are automatically checked for pre-commit compliance, and any pre-commit failures will block merging until resolved.
0 commit comments