diff --git a/docs/conf-stubs.py b/docs/conf-stubs.py new file mode 100644 index 0000000000..935992fe7e --- /dev/null +++ b/docs/conf-stubs.py @@ -0,0 +1,14 @@ +# Copyright (c) Meta Platforms, Inc. and its affiliates. +# This source code is licensed under the MIT license found in the +# LICENSE file in the root directory of this source tree. + +# Inherit everything from the base config +import os, sys + +sys.path.append(os.path.dirname(os.path.realpath(__file__))) +from conf import * + +# TODO: uncomment once m.sphinx can handle that +# OUTPUT = None + +OUTPUT_STUBS = "../habitat_sim" diff --git a/docs/m.css b/docs/m.css index 0e5161ff17..699abdd572 160000 --- a/docs/m.css +++ b/docs/m.css @@ -1 +1 @@ -Subproject commit 0e5161ff17ebf3550bbc0cc99ef81ad7b7d8f80e +Subproject commit 699abdd57242d33291a0ea4ee333c7d4de11a30c diff --git a/requirements.txt b/requirements.txt index 3985aaf148..212f481d50 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,7 +1,9 @@ attrs>=19.1.0 +docutils gitpython imageio imageio-ffmpeg +jinja2 matplotlib numba numpy==1.26.4 diff --git a/setup.py b/setup.py index f1434405ab..9f0eebc625 100644 --- a/setup.py +++ b/setup.py @@ -264,6 +264,12 @@ def run(self): for ext in self.extensions: self.build_extension(ext) + # Build stubs for all of 'habitat_sim' including bindings to provide + # type information. + subprocess.run( + subprocess.run(["docs/m.css/documentation/python.py", "docs/conf-stubs.py"]) + ) + def build_extension(self, ext): extdir = os.path.abspath(os.path.dirname(self.get_ext_fullpath(ext.name))) @@ -450,21 +456,28 @@ def load(filename): setup( name="habitat_sim", version=habitat_sim.__version__, - author="FAIR A-STAR", + author="Meta", description="A high performance simulator for training embodied agents", long_description="", packages=find_packages(where="src_python"), package_dir={"": "src_python"}, install_requires=requirements, tests_require=["hypothesis", "pytest-benchmark", "pytest"], + setup_requires=["pybind11-stubgen"], python_requires=">=3.9", # add extension module ext_modules=[CMakeExtension("habitat_sim._ext.habitat_sim_bindings", "src")], # add custom build_ext command - cmdclass=dict(build_ext=CMakeBuild), + cmdclass={ + "build_ext": CMakeBuild, + }, zip_safe=False, include_package_data=True, + package_data={ + "habitat_sim": ["py.typed", "**/*.pyi"], + }, ) + pymagnum_build_dir = osp.join( _cmake_build_dir, "deps", "magnum-bindings", "src", "python" ) diff --git a/src_python/habitat_sim/py.typed b/src_python/habitat_sim/py.typed new file mode 100644 index 0000000000..e69de29bb2