|
| 1 | +# Copilot Instructions |
| 2 | + |
| 3 | +## Repository Overview |
| 4 | + |
| 5 | +This repository provides Python bindings for the [easySBA](https://users.ics.forth.gr/~lourakis/sba/) sparse bundle adjustment C library, using [pybind11](https://pybind11.readthedocs.io/). |
| 6 | + |
| 7 | +## Repository Layout |
| 8 | + |
| 9 | +- `src/` – Original C/C++ sources for the easySBA library and the license. |
| 10 | +- `easysba/` – Python package: `__init__.py` re-exports `easy_sba` from the compiled pybind11 extension (`_easysba.cpp`). |
| 11 | +- `tests/` – `unittest`-based test suite run with `pytest`. |
| 12 | +- `docs/` – Usage documentation (`USAGE.md`). |
| 13 | +- `pyproject.toml` / `setup.py` – Build configuration (setuptools + pybind11 C extension, cibuildwheel for wheels). |
| 14 | + |
| 15 | +## Build Requirements |
| 16 | + |
| 17 | +- Python 3.11+ |
| 18 | +- C/C++ toolchain |
| 19 | +- BLAS/LAPACK development libraries (e.g. `libblas-dev`, `liblapack-dev`, `liblapacke-dev`) |
| 20 | +- Python packages: `numpy`, `pybind11`, `setuptools`, `wheel` |
| 21 | + |
| 22 | +On Ubuntu/Debian: |
| 23 | + |
| 24 | +```bash |
| 25 | +sudo apt-get install -y build-essential libblas-dev liblapack-dev liblapacke-dev gfortran |
| 26 | +``` |
| 27 | + |
| 28 | +Install the package locally (editable or regular): |
| 29 | + |
| 30 | +```bash |
| 31 | +pip install -v . |
| 32 | +# or with uv |
| 33 | +uv pip install -v . |
| 34 | +``` |
| 35 | + |
| 36 | +## Running Tests |
| 37 | + |
| 38 | +```bash |
| 39 | +pytest |
| 40 | +``` |
| 41 | + |
| 42 | +Tests that actually run the SBA solver require the environment variable `EASYSBA_RUN_SOLVER=1`: |
| 43 | + |
| 44 | +```bash |
| 45 | +EASYSBA_RUN_SOLVER=1 pytest |
| 46 | +``` |
| 47 | + |
| 48 | +## Code Style and Conventions |
| 49 | + |
| 50 | +- Python code follows standard PEP 8 conventions. |
| 51 | +- C/C++ code in `src/` and `easysba/_easysba.cpp` follows the style of the existing sources. |
| 52 | +- Tests live in `tests/` and use `unittest.TestCase` classes, discovered and run via `pytest`. |
| 53 | +- Keep the public Python API minimal: `easysba.easy_sba(...)` is the single entry point. |
| 54 | + |
| 55 | +## Key Files |
| 56 | + |
| 57 | +| File | Purpose | |
| 58 | +|---|---| |
| 59 | +| `easysba/_easysba.cpp` | pybind11 binding: wraps the C `easy_sba` function | |
| 60 | +| `easysba/__init__.py` | Re-exports `easy_sba` for the public package API | |
| 61 | +| `src/sba_levmar.c` | Core Levenberg-Marquardt SBA implementation | |
| 62 | +| `tests/test_smoke.py` | Smoke tests (import check + optional solver run) | |
| 63 | +| `tests/test_sba_steps.py` | Step-by-step SBA tests | |
| 64 | +| `pyproject.toml` | Build system and cibuildwheel configuration | |
0 commit comments