You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+12Lines changed: 12 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -240,6 +240,18 @@ To compile and install the GTDynamics python library:
240
240
make && make python-install
241
241
```
242
242
243
+
To generate stubs explicitly (useful for IDEs/type checkers), run:
244
+
245
+
```sh
246
+
make python-stubs
247
+
```
248
+
249
+
On non-Windows platforms, `python-install` depends on `python-stubs`.
250
+
251
+
For VS Code / Pylance setup (including `python.analysis.extraPaths`), see `python/README.md`.
252
+
253
+
Important: use a `gtsam` Python package built from the same install/prefix as the GTSAM library linked into GTDynamics. Mixing a local GTDynamics build with an unrelated pip/conda `gtsam` wheel can cause runtime aborts.
Copy file name to clipboardExpand all lines: python/README.md
+45-5Lines changed: 45 additions & 5 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -11,7 +11,7 @@ This directory is where the Pybind11-generated GTDynamics package lives and wher
11
11
## Build prerequisites
12
12
13
13
1.**GTSAM** must be built with Python support (i.e., `-DGTSAM_BUILD_PYTHON=ON`) and installed to a prefix that GTDynamics can see via `GTSAM_DIR` or `CMAKE_PREFIX_PATH`.
14
-
2.**Python tooling**: the CI job installs `setuptools<70`, `wheel`, `numpy`, `pyparsing`, `pyyaml`, and `pybind11-stubgen` before configuring the project; matching this list locally avoids the same runtime issues.
14
+
2.**Python tooling**: the CI job installs `setuptools<70`, `wheel`, `numpy`, `pyparsing`, `pyyaml`, and `pybind11-stubgen` before configuring the project; matching this list locally avoids the same runtime issues.`pybind11-stubgen` is required for the `python-stubs` CMake target.
15
15
3. On macOS, the workflow creates and activates a virtual environment (`pythonX -m venv venv`) so that `pip install` and the tests run in the same interpreter that baked the bindings.
16
16
17
17
## Building and installing locally
@@ -30,7 +30,47 @@ This directory is where the Pybind11-generated GTDynamics package lives and wher
30
30
```sh
31
31
make python-install
32
32
```
33
-
This runs `${PYTHON_EXECUTABLE} -m pip install .` in `build/python`, which produces a wheel in `pip`'s cache before installing it.
33
+
This runs `${PYTHON_EXECUTABLE} -m pip install .` in `build/python`, which produces a wheel in `pip`'s cache before installing it. On non-Windows platforms, `python-install` depends on `python-stubs`, so `.pyi` files are generated first.
34
+
35
+
## GTSAM Python compatibility (important)
36
+
37
+
Use a `gtsam` Python package built from the same GTSAM install/prefix that GTDynamics links against.
38
+
Mixing a local GTDynamics build with an unrelated pip/conda `gtsam` wheel can cause hard runtime failures (for example, process aborts when adding factors to a graph).
39
+
40
+
If you built GTSAM from source in a sibling repo, prepend it before importing:
- Run `make python-stubs` to generate stubs with `pybind11-stubgen`.
49
+
- Stubs are generated in `build/python/gtdynamics/*.pyi`.
50
+
- The generated `gtdynamics.pyi` file is what tools like Pylance use for attribute completion/type checking on wrapped symbols.
51
+
52
+
### VS Code / Pylance configuration
53
+
54
+
If your runtime works but Pylance still reports unknown attributes (for example, `CreateRobotFromFile`), make sure VS Code analyzes the build package path.
@@ -40,9 +80,9 @@ This directory is where the Pybind11-generated GTDynamics package lives and wher
40
80
41
81
## Packaging tips
42
82
43
-
-`python/templates/setup.py.in`reads the CMake-generated `requirements.txt` and packages the shared library blobs (`.so` / `.pyd`) from `python/gtdynamics` so running `pip wheel .`in `build/python` yields a complete asset.
44
-
-Keep `python/requirements.txt` in sync with the requirements file copied to `build/python/requirements.txt` so that CI and a local `pip install` use the same dependency list.
45
-
- If you need to publish a wheel manually, the packaged wheel that `pip install .` writes to `~/.cache/pip` already encodes the GTDynamics version reported by `CMakeLists.txt`.
83
+
-`python/templates/pyproject.toml.in`drives packaging in `build/python`.
84
+
-`make python-install` runs `pip install .` from `build/python`, which installs the generated extension module and package files from `build/python/gtdynamics`.
85
+
- If you need to publish a wheel manually, the wheel produced by `pip` already encodes the GTDynamics version reported by CMake.
0 commit comments