Skip to content

chore(ci): configure ruff, mypy, pytest coverage and import-linter - #46

Merged
lucaosti merged 1 commit into
mainfrom
feat/3-tooling
Oct 22, 2026
Merged

lucaosti merged 1 commit into
mainfrom
feat/3-tooling

Conversation

@lucaosti

Copy link
Copy Markdown
Collaborator

What

Tool configuration in the root pyproject.toml:

  • ruff: py311, line length 100, rule sets E,F,W,I,B,UP,SIM,RUF,D with Google docstrings. D is ignored under tests/.
  • mypy: strict = true on packages/.
  • pytest: coverage for agentic_rag and agentic_rag_code, --cov-fail-under=80.
  • import-linter, three contracts:
    1. agentic_rag.types and agentic_rag.ports never import agentic_rag.adapters.
    2. agentic_rag never imports agentic_rag_code.
    3. Engine layers, from top to bottom: adapters, then ingest : retrieval : generation : agent : eval, then evidence, then ports, then types.

It also adds skeleton engine subpackages, each with a one-line docstring, so that the contracts resolve.

Why

M0-2 of the backlog, following spec section 9 and ADR-0001.

One deviation from the backlog text: the middle layer uses non-independent siblings (:) instead of independent ones (|). The agent runtime (E4) and the eval runner (M2-3) must be able to import retrieval.

Closes #3

How verified

uv run ruff check . && uv run ruff format --check .
uv run mypy
uv run lint-imports
uv run pytest -q

Results:

Check Result
ruff all checks passed
mypy no issues in 13 files
import-linter 3 contracts kept
pytest 2 passed, coverage 100%

Negative check: I added import agentic_rag.adapters to types/__init__.py locally. The result was Contracts: 1 kept, 2 broken. The change was then reverted.

Reviewer notes

This PR is stacked on #45. Its base becomes main automatically once #45 is merged.

Encode the quality rules from spec section 9 and the dependency rules from ADR-0001.

- ruff targets py311 with a line length of 100 and the rule sets E, F, W, I, B, UP, SIM, RUF and D (Google docstrings). Docstring rules are relaxed under tests.
- mypy runs in strict mode on packages/.
- pytest measures coverage for both packages, with an 80% floor.
- import-linter enforces three contracts:
  - types and ports never import adapters;
  - the engine never imports agentic_rag_code;
  - the engine follows the layer order from the spec.
- Skeleton engine subpackages exist so that the contracts resolve.

The middle layer lists ingest, retrieval, generation, agent and eval as non-independent siblings (`:`), because the agent runtime and the eval runner have to call retrieval.

Refs #3
@lucaosti

Copy link
Copy Markdown
Collaborator Author

Merged without an approving review by maintainer decision, to unblock contributors: this is the foundation chain everything else depends on. Verified locally on the combined chain (#1, #45, #46, #47, #49, #50 merged together, no conflicts): uv sync --locked, ruff check and format, mypy, import-linter (3 contracts kept), pytest with 100% coverage.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Configure ruff, mypy, pytest coverage and import-linter

1 participant