NVIDIA / NVIDIA/cudf

[FEA] Some level of automation in pylibcudf type stub generation

Open
#17,300 1 comment 0 reactions 0 assignees View on GitHub
feature request Python
Dominant language
C++
Stars
9.8k
Forks
1.1k
Avg merge
3d 6m
Merged PRs (30d)
278

Description

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

Pylibcudf now has type stubs. However, because the translation from cython types to python types needs a certain amount of thought to be applied, we have implemented them manually.

It would be nice if we had some automation so that some simple things can be checked and validated.

For example:

- Does the type stub advertise all the public members of a module?
- For a function, does the type stub have the same the same number of arguments? Are they named the same (nice to have)
- For anything that has defaults in the type stub that are not `...`, do they match up with the actual implementation? I put the defaults in the type stub because it's useful for LSP to see what the defaulted arguments are.
- For classes, are all the methods stubbed out, are properties actually properties, etc...
- automatically copy docstrings over so that they show up in LSP

**Describe the solution you'd like**

In a perfect world, cython would be able to do this for us, but we're not in a perfect world. So we can do something with introspection of the runtime module and some concrete syntax tree (libcst is quite nice) for parsing and regenerating the type stubs.

**Alternatives**

Reviewers must be very diligent/type stubs go out of date.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.