NVIDIA / NVIDIA/cuda-python

[FEA]: Add .pyi files so IDEs can provide autocompletion

Aperta
#928 8 commenti 3 reazioni 1 assegnatario Vedi su GitHub

@mdboom ci sta già lavorando.

Dal 29/8/2025.

cuda.bindings feature
Lingua principale
Cython
Stelle
3.4k
Fork
329
Merge medio
1g 23h
PR unite (30g)
116

Descrizione

Is this a duplicate?
Area

General cuda-python

Is your feature request related to a problem? Please describe.

Python language servers and type checkers (e.g. pylance, ruff-lsp, pyre, mypy) generally don't import code, so extension modules, such as those from Cython, are opaque to them.

Describe the solution you'd like

If we provided .pyi files alongside our extension modules, these tools would do a better job at type-checking and providing autocompletions etc.

While I have no direct experience with it, cythonbuilder claims to automatically generate them. Other options may include mypy's stubgen or pyright's --create-stub feature.

If that doesn't work, we may be able to generate .pyi alongside most of the generated code by modifying our generator.

We will also need some way (through CI or the pre-commit hook, if possible) to ensure that the .pyi files are staying in-sync with the .pyx files.

We probably don't need to check in the .pyi files into the repo if we can generate them at build time (alongside the .cpp files).

Describe alternatives you've considered

No response

Additional context

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Valutazione

Questa issue non è ancora stata valutata.

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.