Skip to main content

Architecture linting for Python repositories

Project description

Strata

Keeping Python repos from turning into spaghetti.

Most linters catch bad code inside files. Strata catches architectural drift: code crossing the wrong boundary, living in the wrong module, or growing into the wrong shape.

As a repository grows, code moves, lessons get forgotten, and the mental map decays. Tests preserve behavior and types preserve interfaces. Strata makes the repository's architectural expectations executable.

Strata enforces:

  • which layers may import which;
  • what each module or role file may contain;
  • whether orchestrator functions stay small;
  • whether dataflow and mutation are explicit;
  • whether names such as validate_* mean what they claim.

It ships a coherent default architecture rather than a blank rule framework, then lets projects disable, extend, or replace parts deliberately.

Strata is functional and self-hosting, but remains pre-release.

Installation

pip install stratalint

The distribution name is stratalint; the installed command is strata.

Quick Start

Add strata.toml at the repository root:

roots = ["src/my_package"]
tests = ["tests"]
tooling = ["scripts"]

Then run:

strata check

All rule families are enabled by default. Product roots and tooling receive structural rules; tests receive test-convention and annotation rules.

Default Structure

Product code uses domain, subdomain, then role. Tests mirror the code they cover; tooling uses one ownership level because scripts/ already establishes the outer boundary.

src/my_package/
└── domain/
    └── subdomain/
        ├── main/
        │   └── run.py
        ├── helpers/
        ├── classes/
        ├── models.py
        ├── types.py
        ├── constants.py
        └── exceptions.py
tests/unit/src/my_package/domain/subdomain/
├── _test_types.py
└── test_run.py
scripts/
├── run_tool.py
└── tool_name/
    ├── main/
    ├── helpers/
    └── classes/

Direct scripts/*.py files are thin command adapters. Supporting logic belongs under scripts/<tool>/<role>/.

Core Commands

strata check
strata rule SFS131
strata map run_plan --depth 3

strata check enforces the configured architecture, strata rule explains one rule and its remediation, and strata map renders a conservative downstream call tree. Mapping does not require Strata configuration or rule adoption.

Philosophy

Strata is strict by default wherever it can make an honest deterministic claim. Following the rules should remove repeated architectural decisions from everyday work. Deliberate differences belong in selection, configuration, or custom rules, where they remain visible, rather than in scattered inline suppressions.

Agent Skills

Generate repository-aware guidance from the active ruleset:

strata skills update
strata skills update --global

The generated skill includes Strata usage, rule-supported architecture examples, navigation and work-handoff guidance, and every enabled core and custom rule. Existing user-authored skill files are preserved unless --force is supplied.

Custom Rules

Custom checks use X... codes and the same RuleContext as core rules. Once configured, they participate in strata check, strata rule, and generated agent skills. See the custom-rule guide for the complete API and configuration.

Documentation

The quickstart, architecture model, configuration reference, adoption guide, and CLI reference live in the Strata documentation repository.

Development

make verify

This runs formatting, static typing, Strata's self-check, and the full test suite.

Project details


Download files

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

Source Distribution

stratalint-0.1.1.tar.gz (552.6 kB view details)

Uploaded Source

Built Distribution

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

stratalint-0.1.1-py3-none-any.whl (132.2 kB view details)

Uploaded Python 3

File details

Details for the file stratalint-0.1.1.tar.gz.

File metadata

  • Download URL: stratalint-0.1.1.tar.gz
  • Upload date:
  • Size: 552.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stratalint-0.1.1.tar.gz
Algorithm Hash digest
SHA256 b2401634a0ba9b5eaaf6381aa90a1bc4edf420c5a54e1ac9da0bf0ad7b41dd68
MD5 968ced9bf2beb83effdf2ad58d16dab9
BLAKE2b-256 6a787a7e9ba1b37882b6a8a2e78bc413d1437e7075a5b476ed4ba2f45d690ea0

See more details on using hashes here.

Provenance

The following attestation bundles were made for stratalint-0.1.1.tar.gz:

Publisher: publish.yml on chio-labs/strata

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

File details

Details for the file stratalint-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: stratalint-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 132.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for stratalint-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 f8ca88368a8c12ecdb420efcfa85b378a2d44a36fb78946c9622e56fb0ce1ffb
MD5 37afc1c0de9be48f214d37085293b1d1
BLAKE2b-256 f309e10c03fda6a51e13734e3961372998e78ae39686b1d3e9f59ff2c456f83e

See more details on using hashes here.

Provenance

The following attestation bundles were made for stratalint-0.1.1-py3-none-any.whl:

Publisher: publish.yml on chio-labs/strata

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

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page