Skip to content

Development

Setup and checks

1
2
3
4
uv sync --group dev
uv run ruff check src tests examples
uv run ruff format --check src tests examples
uv run pytest --cov=src/notecast

CI runs these on Python 3.12 and 3.13, builds these docs with mkdocs build --strict (so a broken link or anchor fails), and checks that pyproject.toml, uv.lock and the release-please manifest agree on the version.

Tests

No test needs a model or network access beyond localhost. tests/conftest.py has two stand-ins for Ollama: FakeOllama, an in-process object with queued answers for unit tests, and ollama_stub, a real HTTP server on localhost (tests/ollama_stub.py) that answers notecast's prompts with valid, deterministic JSON, for running the CLI end to end.

File Covers
tests/test_db.py storage, schema migrations, search, config validation
tests/test_llm.py the Ollama client: requests, errors, model checks
tests/test_pipeline.py every stage, malformed model answers, outages
tests/test_cli.py every command
tests/test_examples.py every script in examples/, against the stub
tests/test_docs.py the README and docs/ (below)
tests/live/test_live.py all of it against a real Ollama (below)

Live tests against a real model

tests/live runs notecast against a real Ollama: every stage on the sample notes, obvious classifications, the similarity threshold, a missing model, and every script in examples/. They are skipped unless NOTECAST_LIVE_OLLAMA_URL is set, so CI and the usual pytest run don't need a model.

scripts/live/ollama.sh runs Ollama in Docker, on the CPU, with the default models. The first start downloads about 2.3 GB into the Docker volume notecast-ollama; the tests then take a few minutes.

1
2
3
scripts/live/ollama.sh start
NOTECAST_LIVE_OLLAMA_URL=http://127.0.0.1:11434 uv run pytest tests/live -m live
scripts/live/ollama.sh stop

NOTECAST_LIVE_GEN_MODEL and NOTECAST_LIVE_EMBED_MODEL test other models. The models are small, so the assertions check what any working model must get right (valid structure, obvious answers), not exact wording.

Docs and examples are tested

tests/test_docs.py checks two things in README.md and every page here:

  • each ```python block runs on its own, in a temporary directory with a fresh database and the Ollama stub, and must not raise, so examples should assert what they show;
  • each notecast … line in a ```bash block names a real command and real options, so the docs can't drift from the CLI.

To exclude a block (one that needs a real model, or isn't meant to run), put this on the line before it:

1
<!-- docs-test: skip -->

New scripts in examples/ are picked up by tests/test_examples.py. They should take Ollama's address from OLLAMA_URL, run notecast as ${NOTECAST:-notecast}, default to a temporary database, and exit 0.

The docs are published to https://muratcanozdemir.github.io/notecast-py/ by .github/workflows/docs.yml whenever docs/ or mkdocs.yml changes on main. Preview them locally:

1
uvx --with mkdocs-techdocs-core mkdocs serve

Releases

Releases are made by release-please from Conventional Commits: feat: bumps the minor version (before 1.0), fix: the patch. It keeps a release PR open with the next version and changelog; merging it tags the release, and then .github/workflows/release.yml:

  1. builds the wheel and sdist from the tag, checks the version matches, and runs the wheel's notecast --version;
  2. publishes them to PyPI by trusted publishing (no stored token), from the pypi environment, with attestations;
  3. attaches them to the GitHub release.

Use a conventional title when squash-merging a pull request: it becomes the commit release-please reads.