Skip to main content

inspect-evals-lint

Static checks for Inspect AI evaluations: file structure, test coverage conventions, best practices and sandbox image pinning.

These checks began life as the autolint tool inside inspect_evals. They are packaged here so any repository of Inspect evaluations can run the same checks, including standalone repos built from the inspect-evals-template and submitted to the inspect_evals register.

Nothing is imported or executed from the evaluation being checked. Every check is static analysis over Python source (via ast), eval.yaml, compose files and pyproject.toml.

Install

uv add --dev inspect-evals-lint
# or
pip install inspect-evals-lint

Usage

inspect-evals-lint <eval_name>            # one evaluation
inspect-evals-lint --all-evals            # every evaluation in the repo
inspect-evals-lint --all-evals --summary-only
inspect-evals-lint --check-summary        # per-check compliance across evals
inspect-evals-lint <eval_name> --check registry
inspect-evals-lint --all-evals --json > lint.json
inspect-evals-lint --list-checks

--json writes one document to stdout and sends progress to stderr, so the output can be piped straight into other tooling. It carries passed, run-wide summary counts and, per evaluation, every check's status, category (the CHECKS.md section: file_structure, code_quality, tests or best_practices), message, file (relative to the repository root when possible) and line.

The repository root is the nearest pyproject.toml carrying a [tool.inspect-evals-lint] table (falling back to the nearest pyproject.toml, then the current directory). Pass --root to override.

Exit codes: 0 all checks passed (warnings, skips and suppressions count as passing), 1 at least one check failed, 2 usage or configuration error.

Configuration

Configuration lives in pyproject.toml. Pick a layout preset and override any field:

[tool.inspect-evals-lint]
preset = "template"   # or "monorepo" / "register"
Key template preset monorepo preset register preset Meaning
source-root src src/inspect_evals src Directory with one sub-directory per evaluation
tests-root tests tests tests Directory holding <tests-root>/<eval>/
tests-layout per-eval per-eval flat flat also accepts test files directly under tests-root when <tests-root>/<eval>/ is absent
readme-location eval-dir eval-dir repo-root repo-root also accepts the repository's top-level README.md
eval-yaml-required true true false Whether a missing eval.yaml fails (a present one is always validated)
import-prefix "" inspect_evals "" Dotted prefix evaluations import under
registry entry-points module entry-points entry-points reads [project.entry-points.inspect_ai]; module greps a registry module; none skips
registry-module unset src/inspect_evals/_registry.py unset Required when registry = "module"
non-eval-dirs ["utils", "examples"] ["utils"] same as template Sub-directories of source-root that are not evaluations
eval-yaml-required-fields title, description, group, contributors, tasks same same Keys every eval.yaml must define
isolated-packages-dir unset packages unset Per-eval pyproject.toml directory for isolated dependency sets
disabled-checks [] [] [] Checks that never run
sandbox-image-allowlist {} {} {} { eval = ["image/ref"] } pairs allowed to stay unpinned (warn, not fail)

Without a [tool.inspect-evals-lint] table the template preset is used. --preset overrides the table for one run.

The register preset is for an upstream repository listed in the inspect_evals register: one evaluation, tests directly under tests/, the README at the repository root, and metadata held by the register entry rather than an eval.yaml in the repo. Run it from outside the repo with inspect-evals-lint --root <clone> --preset register --all-evals --json.

Suppressing a check

  • Line: # noautolint: <check_name> on the offending line (checks that report per-site results: private_api_imports, get_model_location).
  • File: # noautolint-file: <check_name> within the first ten lines of a file.
  • Directory: a .noautolint file in a sub-directory listing check names, one per line. Files under that directory are also excluded from AST-based checks.
  • Evaluation: a .noautolint file in the evaluation directory listing check names.

Checks

See docs/CHECKS.md for the full list with the reasoning behind each check.

Python API

from pathlib import Path
from inspect_evals_lint import lint_evaluation, load_config, get_all_eval_names

root = Path(".")
config = load_config(root)
for name in get_all_eval_names(root, config):
    report = lint_evaluation(root, name, config)
    print(name, report.passed(), report.summary())

Development

uv sync
uv run pre-commit install   # optional: run the lint stack on every commit
uv run pytest
uv run basedpyright src

Linting (ruff, zizmor, mdformat) runs via pre-commit; CI runs the same stack plus basedpyright and pytest via the shared python-ci reusable workflow.

Releasing

See RELEASING.md.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

inspect_evals_lint-0.1.0.tar.gz (78.2 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

inspect_evals_lint-0.1.0-py3-none-any.whl (35.0 kB view details)

Uploaded Python 3

File details

Details for the file inspect_evals_lint-0.1.0.tar.gz.

File metadata

  • Download URL: inspect_evals_lint-0.1.0.tar.gz
  • Upload date:
  • Size: 78.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/7.0.0 CPython/3.13.14

File hashes

Hashes for inspect_evals_lint-0.1.0.tar.gz
Algorithm Hash digest
SHA256 0be26782e6491218c033cc95bf107c564e4d5bdd5b11162bfa58233b18fa86d9
MD5 9d38e7ddb50151b796f92651d3bf9b18
BLAKE2b-256 2d0016bf13a9cab598be9742a158f5f5189c5ac7bb5fe4af330fff16954adafa

See more details on using hashes here.

Provenance

The following attestation bundles were made for inspect_evals_lint-0.1.0.tar.gz:

Publisher: publish.yml on Generality-Labs/inspect-evals-lint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file inspect_evals_lint-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for inspect_evals_lint-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 ea3a1cee5950a4d6ebec0eb91300e60205e30cf0d9d7d6b3fe06c1390e7076b2
MD5 41d40490689aa8e4f8d32716f3701b42
BLAKE2b-256 c679b734d07f41da3886aa45a021eb9cbb826cd359c3c8b667266becdeae8cea

See more details on using hashes here.

Provenance

The following attestation bundles were made for inspect_evals_lint-0.1.0-py3-none-any.whl:

Publisher: publish.yml on Generality-Labs/inspect-evals-lint

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page