Development¶
Setup and checks¶
1 2 3 4 | |
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 | |
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
```pythonblock 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```bashblock 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 | |
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 | |
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:
- builds the wheel and sdist from the tag, checks the version matches,
and runs the wheel's
notecast --version; - publishes them to PyPI by trusted
publishing (no stored token), from the
pypienvironment, with attestations; - attaches them to the GitHub release.
Use a conventional title when squash-merging a pull request: it becomes the commit release-please reads.