Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .pyi Stub Files #183

Closed
ax3l opened this issue Aug 31, 2023 · 0 comments · Fixed by #184
Closed

Add .pyi Stub Files #183

ax3l opened this issue Aug 31, 2023 · 0 comments · Fixed by #184
Assignees
Labels
component: documentation Improvements or additions to documentation enhancement New feature or request

Comments

@ax3l
Copy link
Member

ax3l commented Aug 31, 2023

Automate the generation of stub files with CI tools.

Sphinx

Automation

Generators

pybind11-stubgen

https://github.com/sizmailov/pybind11-stubgen

pybind11-stubgen amrex
pybind11-stubgen amrex.space1d
pybind11-stubgen amrex.space2d
pybind11-stubgen amrex.space3d

Creates files in stubs/. Does not automatically go recursive?

Pro:

  • doc strings preserved!

Cons:

  • Quote sensitive, errors on encountered C++ types in signatures (for non-bound types?).
    • --ignore-all-errors helps.
    • actually a good diagnostics to fix unbound types and init-order issues.

MyPy

https://mypy.readthedocs.io/en/stable/stubgen.html
MikePopoloski/pyslang#96

stubgen -p amrex
stubgen -p amrex.space2d
stubgen -p amrex.space3d
Processed 5 modules
Generated files under out/amrex/

Pro:

  • no errors

Con:

nanobind-stubgen

After #127 -> https://github.com/cansik/nanobind-stubgen

Other

@ax3l ax3l added the enhancement New feature or request label Aug 31, 2023
@ax3l ax3l self-assigned this Sep 1, 2023
@ax3l ax3l added the component: documentation Improvements or additions to documentation label Sep 1, 2023
@ax3l ax3l changed the title Add .pyi Sub Files Add .pyi Stub Files Sep 1, 2023
@ax3l ax3l closed this as completed in #184 Sep 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component: documentation Improvements or additions to documentation enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant