habitat-sim icon indicating copy to clipboard operation
habitat-sim copied to clipboard

Add stubs to python bindings to provide typing information.

Open 0mdc opened this issue 7 months ago • 0 comments

Motivation and Context

This changeset adds stubs to python bindings to provide typing information. Stub generation depends on pybind11-stubgen.

https://github.com/facebookresearch/habitat-sim/assets/110583667/86593700-7896-4dc5-9ca7-a6d077beaad9

How to test:

  • pip install pybind11-stubgen.
  • Build habitat-sim normally.
  • Import the package in another project, and explore types in your IDE.

WIP:

  • Stubs contain some errors, but they mostly work.
  • CI is not yet handled.
  • Ideally, creating a stub package would scale better, but I could not make it work with bindings. See PEP 561.

How Has This Been Tested

Tested by importing habitat_sim in an external Python file.

Types of changes

  • [x] New feature (non-breaking change which adds functionality)

Checklist

  • [x] My code follows the code style of this project.
  • [x] My change requires a change to the documentation.
  • [ ] I have updated the documentation accordingly.
  • [x] I have read the CONTRIBUTING document.
  • [x] I have completed my CLA (see CONTRIBUTING)
  • [ ] I have added tests to cover my changes.
  • [ ] All new and existing tests passed.

0mdc avatar Jun 25 '24 19:06 0mdc