(sec_development)=

# Development

Clone with `--recurse-submodules` to include the tskit C library.

## Python tests

```sh
uv sync --group test
uv run pytest -n 4
```

After changing C code, rebuild with `uv sync --group test --reinstall-package tsls`.

`tests/test_python_c.py` tests the C extension module (`_tslsmodule.c`)
through `_tsls`, without the classes in `tsls`. It runs every line of the
module apart from failures to allocate memory or to set up the module, and
the handling of a library error that is not one of those the library
returns. The "Python-C tests" job reports the coverage to Codecov with the
`c-python` flag. To see it:

```bash
CFLAGS=--coverage uv run python setup.py build_ext --inplace --force
uv run pytest tests/test_python_c.py
uvx gcovr -f _tslsmodule.c
```

Then rebuild the extension without the coverage, as above.

## C tests

With CUnit installed, run:

```sh
uvx meson setup build lib
ninja -C build
uvx meson test -C build
```

## Documentation

Run `make -C docs` to build the manual in `docs/_build/html`.
