Skip to content

Development

git clone https://github.com/Abrinca/omnitax
cd omnitax
uv sync
uv run pytest

Check Python 3.12 too (the minimum), for example with uv run --python 3.12 --isolated --with-editable . --with pytest --with starlette --with uvicorn --with anyio pytest. The repository has three GitHub Actions workflows in .github/workflows/:

Workflow When Does
ci.yml push to main, pull requests ruff check src tests, omnitax --version and --help, and the test suite on Python 3.12, 3.13 and 3.14; and the documentation build (zensical build --clean --strict)
pages.yml changes under docs/ or to zensical.toml (pull requests build only; main deploys) builds the documentation and publishes it to GitHub Pages
release.yml a tag v* checks that the tag is the package version, runs the tests, builds the wheel and the sdist, installs the wheel in a clean environment, and publishes to PyPI

Linux is the only platform that is tested.

Making a release

  1. Set __version__ in src/omnitax/__init__.py (hatchling reads the version from there).
  2. Move the [Unreleased] entries of CHANGELOG.md under a new ## [X.Y.Z] - DATE heading and copy the file to docs/project/changelog.md.
  3. Run the checks (uv run pytest -q, uvx ruff check src tests, uvx zensical build --clean --strict) and commit.
  4. Tag the commit vX.Y.Z and push the tag. The Release workflow stops if the tag and __version__ differ, runs the tests, builds, and publishes to PyPI through Trusted Publishing: there is no token; PyPI trusts the workflow file release.yml in the pypi environment of the repository.

A version that is on PyPI cannot be replaced, so check the built files first with uv build and a look at dist/ if anything about the packaging changed.

Documentation

uvx zensical serve                    # live preview
uvx zensical build --clean --strict   # what CI and the Pages workflow run: broken links fail the build

docs/project/changelog.md is a copy of CHANGELOG.md; update both.

Tests

The tests use small files in the real formats (tests/data/): a hand-written NCBI taxdump and GTDB taxonomy and metadata, a custom table, trees taken from multitax's tests (MIT; tests/data/multitax/README.md), and real subsets of NCBI, GTDB, SILVA, Greengenes2, Open Tree and ictv-taxdump in tests/data/real/ (cut by scripts/make_test_data.py; sources, checksums and licences are in the README there). Nothing is downloaded by default.

File Covers
test_core.py Taxonomy and Taxon: lineage, ranks, consensus, translation, copies, export, search. The tests that take the backend fixture (conftest.backend) run on the SQLite store and the remote store, which must answer identically
test_stores.py the conformance test: one adversarial Rows (alias chains and cycles, parent == id, names and genomes of unknown nodes, versioned accessions, repeats) into a SqliteStore and a RemoteStore over it; every primitive must answer alike
test_loaders.py every file format
test_overlay.py, test_taxdump.py overlays (the rules, the errors with file and line, applying twice) and taxdump export and import (ids, collisions, round trips)
test_sqlite.py several taxonomies in one file, replacing, failed writes, other layouts, threads
test_server.py the endpoints and the standalone app in process: errors, mounting, the API version; RemoteStore batching
test_build.py taxonomies built into files: temporary files are owned and cleaned up, path= keeps them, apply takes Python data
test_connect.py connect(prefix=) against routes mounted under a path on a real Unix socket, and LayoutError
test_client.py the transport: base URLs, path prefixes, retries, connection errors
test_address_cases.py address resolution from a table of cases
test_cli.py every command in process; serve as a real subprocess on a Unix socket and TCP
test_annotate.py the columns added to a table, on every store, and the command (header, delimiter, standard input)
test_download.py the resumable download, checksums, and the provenance and dates of NCBI dumps (the current one, the monthly archive, local files), against a local HTTP server
test_real_data.py every loader on real data: the subsets of tests/data/real/ (NCBI with merged and deleted ids, homonyms, informal species and the assembly summaries' columns; GTDB 232 and 226; SILVA; Greengenes2; Open Tree; ICTV; the real gtdb-taxdump ids), offline, and the translations of named clades (Arenimonas, Ruminococcoides, Thiolapillus, Aenigmatarchaeales, ...) with and without abstention
test_imports.py reading a file or talking to a server needs no server packages (the base install is httpx only, imported lazily)
test_network.py opt-in: loads each real default source (uv run pytest -m network)

Source layout

Module Holds
core.py Taxonomy, Taxon: every algorithm, against the store protocol
consensus.py the voting: votes_of, decide, Placement, the per-conversion DEFAULTS (pure functions over lineages)
store.py Rec, Rows, Link, the Store protocol, the wire codec
links.py, names.py the key rules and match_link; name normalisation
sqlite.py, remote.py the two stores (sqlite.py: SqliteStore with an internal _View of one taxonomy of one file and its pool of idle read-only connections, LayoutError, FileChanged, and listing taxonomies of a file)
schema.py, dbwrite.py the DDL and the layout number derived from it; write_taxonomy (and name ranking, tree numbering)
loaders.py file formats, default versions and URLs, load
api.py open, connect, taxonomies, address resolution
client.py the httpx transport
server.py the endpoints, taxonomy_routes(catalog), create_app()
_serve.py, paths.py the sockets and the uvicorn process; socket and HOST:PORT helpers
_download.py the resumable download
cli.py the omnitax command