Contributing to robotsix-llmio
robotsix-llmio is a provider-agnostic LLM I/O layer for
pydantic-ai agents. Contributions are welcome —
please open a GitHub PR against main.
1. Local development setup
Python ≥ 3.14 is required — the stack runtime baseline (see the robotsix stack standards). CI tests 3.14 only.
This project uses uv for dependency management.
# Install uv (one-time — see https://docs.astral.sh/uv/#installation)
curl -LsSf https://astral.sh/uv/install.sh | sh
# Clone and set up
git clone <repo>
cd <repo>
uv sync --frozen
# Activate the virtual environment
source .venv/bin/activate
The claude_sdk extra additionally requires Node.js and a logged-in claude
CLI at runtime (see the README's "Alternative transport — Claude Agent SDK"
section). Tests that need the Claude CLI are skipped when it's absent —
contributors without Node can still run the rest of the suite.
Copy tests/.env.example to tests/.env and set OPENROUTER_API_KEY only
if you intend to run live API tests (see "Running tests" below). tests/.env
holds credentials for the opt-in live suite only — the library's runtime
environment variables are documented in the README's "Configuration" section.
2. Pre-commit hooks
The pre-commit tool is not included in the dev dependency group —
install it separately:
uv tool install pre-commit
pre-commit install
Optionally run every hook across the whole tree once:
pre-commit run --all-files
.secrets.baseline records known/audited dummy values (placeholder API keys in
tests/.env.example and literal test fixtures) so the detect-secrets hook doesn't
block on them; regenerate it via detect-secrets scan when needed.
Hooks pinned in .pre-commit-config.yaml:
| hook id | description |
|---|---|
| trailing-whitespace | removes trailing whitespace |
| end-of-file-fixer | ensures files end with a single newline |
| check-yaml | validates YAML syntax |
| check-toml | validates TOML syntax |
| check-json | validates JSON syntax |
| check-merge-conflict | rejects files with unresolved merge markers |
| check-added-large-files | rejects files over 1 MB (lockfile/baseline exempt) |
| detect-private-key | rejects committed private keys |
| ruff | linter (auto-fix on commit) |
| ruff-format | formatter (auto-applied on commit) |
| codespell | spell-checks source files |
| mypy | type-checks src/ |
| vulture | dead-code check over src/ |
| deptry | dependency hygiene check |
| robotsix-modules | validates module registration in docs/modules.yaml |
| detect-secrets | scans staged changes for plaintext secrets, audited against .secrets.baseline |
| actionlint-docker | lints GitHub Actions workflow files |
3. Running tests
# Default suite — what CI runs, no network:
pytest
# Live API tests (opt-in, require OPENROUTER_API_KEY in the environment):
pytest -m live
# With coverage (as CI does):
pytest --cov=src/robotsix_llmio --cov-report=term-missing
pyproject.toml sets addopts = "-m 'not live'", so plain pytest never hits
the network. Running -m live overrides that filter; individual live tests
still self-skip when OPENROUTER_API_KEY is unset.
3.1 Fixtures and mock factories
Before writing a new inline mock, check whether a shared helper already
exists — tests/FIXTURES.md is the map of every shared
pytest fixture (defined in the per-area conftest.py files) and mock
factory (centralized under tests/fixtures/):
tests/fixtures/responses.py—httpx.Response/MockTransporthandler builders for the HTTP-backed layers (Langfuse cost, knowledge, refdocs).tests/fixtures/builders.py—SimpleNamespace/ mock-object builders for the pydantic-ai response shapes the cost helpers read (e.g. OpenRouter).
The testing rules in AGENT.md are normative. In particular, when
patching httpx.Client via MockTransport, use install_transport from
tests/core/conftest.py with an explicit module= parameter — do not
define a private duplicate helper.
4. Linting, type-checking, and security checks
Reproduce CI locally before pushing:
ruff check . # lint
ruff format --check . # format verification (hook auto-formats)
mypy src/ # type-check
uv audit # dependency vulnerability audit
robotsix-modules check-registration docs/modules.yaml --root . # modules registration check
ruff format --check . mirrors what the ruff-format pre-commit hook enforces;
it reports formatting issues without modifying files.
CI also runs pip-audit (via the shared security job in
.github/workflows/ci.yml) in addition to uv audit. When a dependency
vulnerability needs to be ignored, you must update both ignore
mechanisms — [tool.uv.audit].ignore in pyproject.toml and
pip-audit-ignore-vulns in .github/workflows/ci.yml — so that the
two scans stay in sync.
5. Code style
- Line length: 88 characters —
ruff formatenforces this (matches[tool.ruff] line-length = 88inpyproject.toml). - Type hints are required on public APIs.
mypy src/runs in CI under a strict-ish config (ignore_missing_imports = false,warn_unused_configs = true). The only relaxed area isrobotsix_llmio.openrouter.*, where a mypy override silences errors that come from subclassing pydantic-ai'sOpenAIChatModel. - Module layering: core → openrouter (DeepSeek derived classes live inside
openrouter);claude_sdkis a sibling of openrouter (see the README for the architectural narrative). Don't introduce new top-level tunable knobs — timeout, retry, and backoff values are baked constants by design. - Subpackage file layout: when adding a new transport or provider
subpackage, follow the three-file layout that
openrouter/andclaude_sdk/use: model.py— the pydantic-aiModelsubclass with cost recording and any wire-level quirks.provider.py— theLLMProvidersubclass exposing the construction hooks (_model_class()/_post_build_model()) or concrete construction.transient.py— the provider-specific transient predicate layered oncore.retry.is_transient.
See ARCHITECTURE.md's "File conventions inside each subpackage" section for the full rationale.
6. Pull request expectations
- Target
main. - Branch naming: short, kebab-case, topic-prefixed — e.g.
feat/…,fix/…,docs/…,chore/…. This is a convention, not a CI gate. - CI must pass — the test suite on Python 3.14, ruff, mypy, and uv audit. CI also runs a TruffleHog secret scan on pull requests to catch leaked credentials in the PR diff.
- Use a conventional-commit PR title — the changelog is generated by
release-please from commit types, so write a title prefixed with
feat:,fix:,break:, orchore:. No hand-editedCHANGELOG.mdorchangelog.d/newsfragment is expected or required. Achore:title (changes with nothing to release) needs no special label. - Pre-commit hooks must pass locally before pushing.
- New behaviour should ship with tests; bug fixes should ship with a regression
test. Tests that depend on a live API must be decorated
@pytest.mark.liveso they remain opt-in. - Keep the dependency surface minimal. Prefer
pydantic-ai-slimextras over the full meta-package (see the comment inpyproject.toml). Don't add a new top-level dependency unless it's genuinely required. - Keep ARCHITECTURE.md in sync. Update
ARCHITECTURE.mdin the same PR whenever you change the project structure or module boundaries — adding, splitting, renaming, or removing a subpackage or module, moving responsibilities between modules, or adding/splitting/removing test files (refresh thetests/tree in its "Test coverage strategy" section). This is part of the PR checklist; don't defer it to a follow-up doc-only PR. - Keep the README configuration table in sync. If you add, rename, or remove an environment variable read at runtime, update the README's "Configuration" table (purpose and default) in the same PR.
Deprecations
Legacy shapes kept for backward compatibility emit a DeprecationWarning
instead of being accepted silently — currently the two-slot tier config
(top-level default / fallback keys, accepted by both load_tier_config
and TierConfig validation) and the TierConfig.default /
TierConfig.fallback accessors (use TierConfig.slot(0) / slot(1) or
chain). Use warnings.deprecated (PEP 702) for callables and
warnings.warn(..., DeprecationWarning, stacklevel=2) for non-callable forms
such as config keys. A deprecated shape keeps working until the next major
version, where it may be removed. Introducing a deprecation needs no
hand-written changelog entry — a conventional-commit title (feat:/fix:)
is enough; the removal itself must ship as a break: change so release-please
records it.
7. Reporting issues
Open a GitHub issue with:
- a minimal reproducer,
- your Python version (
python --version), - the installed extras (
uv pip show robotsix-llmio), - and — for provider-specific bugs — which transport you're using (OpenRouter / Claude SDK).
8. Releasing
The stack publishes to no package index — consumers depend on this library directly from git, pinned to a commit SHA (see the repo baseline). Releases are automated by release-please; nothing is published anywhere:
- On every push to
main, release-please opens (or updates) a release PR that accumulates the version bump and the auto-generatedCHANGELOG.mdfrom the merged conventional-commit titles. - Merging that release PR cuts the release: it bumps the version, updates
CHANGELOG.md, and creates thev0.X.Ytag. - As a fallback, the scheduled weekly
auto-release.ymlworkflow triggers the same release-please flow if a release PR is pending.
CHANGELOG.md is never edited by hand — release-please generates it from the
conventional-commit types on main
(see changelog & releases).