Contributing#
How to set up sidescanpy for development, run its checks, and where things go. Bug reports and proposals are welcome as GitHub issues; for a reader problem see Reporting a problem. To add a reader for a new sonar format, see Adding a source format.
Setup#
You need Python 3.12 or newer, uv and git.
git clone https://github.com/rshomberg-research/sidescanpy.git
cd sidescanpy
uv sync --all-extras
make test
uv sync --all-extras builds .venv/ with every optional dependency,
so the plotting, GeoTIFF and docs code is tested too.
Command |
Runs |
|---|---|
|
the unit tests, with |
|
ruff |
|
this site in |
|
the same without running the example scripts (no figures) |
|
runs the Python blocks of Getting started and the quickstart on the home page, and checks the output Getting started shows (downloads the 41 MB recording they use if needed; CI runs it after |
|
builds the site, then serves it at http://127.0.0.1:8000 |
|
removes the build and the generated API and example pages |
uv run pytest tests/integration --slow runs the integration tests,
which need real survey files that are not in the repository and skip
without them: put a JSF file at tests/data/jsf/sample.jsf and a Klein
SDF file at tests/data/sdf/sample.sdf. A local data/ folder for
survey files is ignored by git; the library never reads from it. The public test fixtures are listed in
tests/data/public/SOURCES.md; set SIDESCANPY_PUBLIC_DATA to the
folder holding them to run tests/unit/io/test_public_fixtures.py.
Layout#
Package |
Holds |
|---|---|
|
the data model, schema accessors, processing history |
|
the JSF, SDF and XTF readers, |
|
correction steps, slicing, bottom and noise detection, segments |
|
measurements that return result dataclasses |
|
gridding and GeoTIFF output |
|
target catalogs and matching targets to pings |
|
image windows, chips and COCO/YOLO datasets |
|
plotting helpers |
|
the |
Imports go one way, core ← io ← processing ← analysis ← grids ← targets ← export ← viz ← cli, and only viz imports matplotlib. A unit test
(tests/unit/test_layering.py) enforces this.
Conventions#
Library, not workflow. Library functions take and return datasets and do one thing. Orchestration, run-everything scripts and multi-panel figures belong in
examples/or in your own project.Tests first for new behaviour, on synthetic data with real shapes (three dimensions, two channels, realistic sample counts);
tests/unit/synthetic.pyhas the builders. Never commit survey data.Docstrings are numpydoc and are the API reference.
Logging. Every module has
logger = logging.getLogger(__name__)and logs only at DEBUG and WARNING. Noprint()in library code.New schema variables go in
core/schema.pybefore a step produces them.Commits follow Conventional Commits with the module path as scope:
feat(io/sdf): ...,fix(grids/resample): ...,docs(processing): ....Versions follow SemVer. Until 1.0, a minor release may break the API or the
.ss.h5format;CHANGELOG.mdlists every break.
Test data#
The repository holds code only, no survey data.
Examples. The worked examples download public recordings with
sidescanpy.datasets.fetch(); see Example data.examples/project_template/runs on synthetic data intests/examples. The gallery and Theory scripts run duringmake docs(locally and in CI), and the unit suite checks offline that every dataset name a script fetches is registered.Public fixtures.
tests/unit/io/test_public_fixtures.pyruns on small cuts of openly licensed recordings (EdgeTech JSF, and XTF from three writers), listed with source, licence and checksum intests/data/public/SOURCES.md. They are kept outside the repository; pointSIDESCANPY_PUBLIC_DATAat their folder to run those tests, which skip without it.