Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@ option(BUILD_EXAMPLES "Build Open3D examples programs" ON
option(BUILD_UNIT_TESTS "Build Open3D unit tests" OFF)
option(BUILD_BENCHMARKS "Build the micro benchmarks" OFF)
option(BUILD_PYTHON_MODULE "Build the python module" ON )
option(WITH_STUBGEN "Use pybind11-stubgen to generate stubs" OFF)
option(IGNORE_STUBGEN_ERRORS "Ignore all errors during stub generation" ON )
option(BUILD_CUDA_MODULE "Build the CUDA module" OFF)
option(BUILD_WITH_CUDA_STATIC "Build with static CUDA libraries" ON )
option(BUILD_COMMON_CUDA_ARCHS "Build for common CUDA GPUs (for release)" OFF)
Expand Down
4 changes: 4 additions & 0 deletions cmake/Open3DPrintConfigurationSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ function(open3d_print_configuration_summary)
open3d_aligned_print("Build Unit Tests" "${BUILD_UNIT_TESTS}")
open3d_aligned_print("Build Examples" "${BUILD_EXAMPLES}")
open3d_aligned_print("Build Python Module" "${BUILD_PYTHON_MODULE}")
open3d_aligned_print("Generate Typing Stubs" "${WITH_STUBGEN}")
if(WITH_STUBGEN)
open3d_aligned_print("Ignore All Stubgen Errors" "${IGNORE_STUBGEN_ERRORS}")
endif()
open3d_aligned_print("Build Jupyter Extension" "${BUILD_JUPYTER_EXTENSION}")
open3d_aligned_print("Build TensorFlow Ops" "${BUILD_TENSORFLOW_OPS}")
open3d_aligned_print("Build PyTorch Ops" "${BUILD_PYTORCH_OPS}")
Expand Down
2 changes: 2 additions & 0 deletions cpp/pybind/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,8 @@ add_custom_target(python-package
-DPYTHON_VERSION=${PYTHON_VERSION}
"-DCOMPILED_MODULE_PATH_LIST=${COMPILED_MODULE_PATH_LIST}"
"-DPYTHON_EXTRA_LIBRARIES=${PYTHON_EXTRA_LIBRARIES}"
-DWITH_STUBGEN=${WITH_STUBGEN}
-DIGNORE_STUBGEN_ERRORS=${IGNORE_STUBGEN_ERRORS}
-DBUILD_JUPYTER_EXTENSION=${BUILD_JUPYTER_EXTENSION}
-DBUILD_TENSORFLOW_OPS=${BUILD_TENSORFLOW_OPS}
-DBUILD_PYTORCH_OPS=${BUILD_PYTORCH_OPS}
Expand Down
16 changes: 16 additions & 0 deletions cpp/pybind/make_python_package.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -139,3 +139,19 @@ file(COPY "${PYTHON_PACKAGE_SRC_DIR}/../examples/python/"
DESTINATION "${PYTHON_PACKAGE_DST_DIR}/open3d/examples")
file(COPY "${PYTHON_PACKAGE_SRC_DIR}/../examples/python/"
DESTINATION "${PYTHON_PACKAGE_DST_DIR}/open3d/examples")

# Generate typing stub files (.pyi) and py.typed marker file.
if(WITH_STUBGEN)
if(NOT IGNORE_STUBGEN_ERRORS)
list(APPEND PYBIND11_STUBGEN_FLAGS "--exit-code")
endif()
message(STATUS "Generating typing stubs...")
execute_process(
COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${PYTHON_PACKAGE_DST_DIR}
pybind11-stubgen open3d -o ${PYTHON_PACKAGE_DST_DIR}
${PYBIND11_STUBGEN_FLAGS}
COMMAND_ECHO STDOUT
COMMAND_ERROR_IS_FATAL ANY
)
file(WRITE "${PYTHON_PACKAGE_DST_DIR}/open3d/py.typed" "")
endif()
2 changes: 1 addition & 1 deletion python/open3d/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -211,4 +211,4 @@ def _jupyter_nbextension_paths():

if sys.platform == "win32":
_win32_dll_dir.close()
del os, sys, CDLL, find_library, Path, warnings, _insert_pybind_names
del os, sys, CDLL, find_library, Path, warnings, _insert_pybind_names, open3d
1 change: 1 addition & 0 deletions python/requirements_stubgen.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pybind11-stubgen==2.5.*
Loading