Skip to content

Add .pyi Stub Files #183

Closed
Closed
@ax3l

Description

@ax3l

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
https://github.com/MikePopoloski/pyslang/issues/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

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions