Pybind11 Stubgen Guide
1. Where to Set output_dir for pybind11-stubgen? The output_dir is where the generated .pyi file will be saved. It does not affect Python’s ability to import the module—the .pyi file is just for type hints and documentation (used by IDEs like VSCode/PyCharm). Example 1pybind11-stubgen my_module -o ./stubs This generates ./stubs/my_module.pyi. Python will still import my_module from wherever the .so file is located (e.g., build/lib.linux-x86_64-3.8/). 2. How to Specify .so Output Directory in CMake? In your CMakeLists.txt, you can control where the .so file is built using: ...