Python API overview¶
pyTheia is a normal Python package with a compiled extension. After building, import the public namespace as usual:
The top-level package re-exports everything from the native submodule pytheia.pytheia. You normally do not import pytheia.pytheia in application code; use import pytheia (or import pytheia as pt) instead.
Submodules correspond to the same areas as in the C++ library (see the API Reference). They are exposed as attributes of pt:
| Submodule | Role (short) |
|---|---|
pt.io |
Reading and writing reconstructions and related data. |
pt.math |
Math helpers and Sophus Lie-group bindings. |
pt.matching |
Feature matching and correspondence utilities. |
pt.mvs |
Multi-view stereo oriented helpers. |
pt.sfm |
Reconstruction, BA, cameras, tracks, pipelines. |
pt.solvers |
Geometric estimation and solvers. |
Type information (PEP 561)¶
The wheel ships py.typed and .pyi stubs next to the extension so editors and mypy/pyright can resolve symbols without loading the binary.
-
Stubs are generated with
pybind11-stubgenduring development (seepip install ".[dev]"in the rootpyproject.toml). -
Regenerate after changing bindings:
The project build (
python setup.py bdist_wheel) runs the same step whenpybind11-stubgenis installed andGENERATE_STUBSis not0.
Examples in the repo¶
pyexamples/— small, self-contained scripts (OpenCV features, classic matchers, NeRFStudio export helpers). Fewer optional dependencies.examples/— showcase workflows: vismatch matchers, Rerun visualization, and Gaussian splatting export notes. Install optional deps withpip install ".[examples]"(see repositoryexamples/requirements.txt).pytests/— unit and integration tests.
See Examples showcase for a map of both trees.
Python versus C++ (tabbed snippets)¶
The HTML manual can show the same workflow in both languages. Use the pattern from chapter-contributing (dual-language examples). For instance:
Relationship to the C++ reference¶
Chapters under api are written in the C++ domain and describe the underlying Theia types. Python names and signatures follow the bindings in src/pytheia/ (pybind11). Where names match, the C++ chapter is the conceptual reference; use the stubs or help() on the Python objects for the exact wrapper surface.