Architecture-as-Code checks for Python projects.
Project description
klint
Architecture-as-Code checks for Python projects.
klint enforces architecture rules from a small klint.yaml file. Use it to
keep module boundaries explicit, block risky patterns in specific layers, and
pin important symbols to their intended owner file.
It installs as a Python package and runs as a native executable:
pip install klint
klint
For machine-readable output:
klint --json
python -m klint --json
By default, klint looks for klint.yaml or klint.config.json in the current
working directory. Use --config when the config lives somewhere else:
klint --config path/to/project
CLI
The Python package exposes both a console command and a module entrypoint:
klint
python -m klint
Supported options:
| Option | Description |
|---|---|
--config <dir> |
Directory containing klint.yaml or klint.config.json. Defaults to the current working directory. |
--json |
Emit structured JSON to stdout. Useful in CI and agentic lifecycle hooks. |
--help, -h, help, h |
Print CLI usage. |
Configuration
Create klint.yaml at the root of your project:
include: ["src"]
rules: {}
arch:
layers:
api: ["src/app/api/**"]
db: ["src/app/db/**"]
jobs: ["src/app/jobs/**"]
include controls which files are scanned. arch.layers gives names to file
groups so rules can talk about architecture instead of repeating globs.
Import Boundaries
Use arch.imports to block dependencies between layers.
include: ["src"]
rules: {}
arch:
layers:
api: ["src/app/api/**"]
db: ["src/app/db/**"]
imports:
- from: api
deny: db
message: "API code must not import database internals directly"
This flags Python imports such as:
from app.db.session import get_session
from files under src/app/api/**.
Forbidden Patterns
Use arch.forbidden to block text patterns inside a layer.
include: ["src"]
rules: {}
arch:
layers:
jobs: ["src/app/jobs/**"]
forbidden:
- in: jobs
pattern: "print("
message: "Jobs must not print directly"
This is useful for project-specific policies such as blocking direct logging, environment access, framework shortcuts, or unsafe helpers in the wrong layer.
Singleton Ownership
Use arch.singleton when a symbol or pattern must only appear in one file.
include: ["src"]
rules: {}
arch:
singleton:
- only: "src/app/config/settings.py"
pattern: "API_KEY"
message: "API_KEY must only live in settings.py"
This allows API_KEY in src/app/config/settings.py and flags the same pattern
anywhere else in scanned files.
Supported Python Rules
The Python package currently supports:
arch/importsarch/forbiddenarch/singleton
These rules are intentionally configuration-driven. They are for enforcing your project's architecture, not for replacing formatters or style linters.
CI
Run klint in CI after installing your Python dependencies:
pip install klint
klint --json
klint exits with:
0when no errors are found2when rule violations are found1for configuration or runtime errors
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distributions
Built Distributions
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file klint-0.1.1-py3-none-win_amd64.whl.
File metadata
- Download URL: klint-0.1.1-py3-none-win_amd64.whl
- Upload date:
- Size: 752.1 kB
- Tags: Python 3, Windows x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
77d200de15bcf3a9b84dabb0d70c5f5bbea1f2b98515759f8b6763ad6407a114
|
|
| MD5 |
f4e1a7ac4bd6a76a866f1958b671c026
|
|
| BLAKE2b-256 |
7073d5c230867a50b24f3a12370346a340985712ce334ca4efcf1ef1acb6aca1
|
Provenance
The following attestation bundles were made for klint-0.1.1-py3-none-win_amd64.whl:
Publisher:
python-release.yml on konvert7/klint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klint-0.1.1-py3-none-win_amd64.whl -
Subject digest:
77d200de15bcf3a9b84dabb0d70c5f5bbea1f2b98515759f8b6763ad6407a114 - Sigstore transparency entry: 1638854350
- Sigstore integration time:
-
Permalink:
konvert7/klint@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Branch / Tag:
refs/heads/main - Owner: https://github.com/konvert7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file klint-0.1.1-py3-none-manylinux_2_28_x86_64.whl.
File metadata
- Download URL: klint-0.1.1-py3-none-manylinux_2_28_x86_64.whl
- Upload date:
- Size: 944.2 kB
- Tags: Python 3, manylinux: glibc 2.28+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
edddeb3627d660f3410b327396546a53b2d1416a4ed4987201b5f74270877d75
|
|
| MD5 |
aa7339cff372cb4af1c4adc3c28e0cf1
|
|
| BLAKE2b-256 |
d2c9b4173b06fc3d9dce04219e67cb791a346abdda964526abd3279099f0b5a5
|
Provenance
The following attestation bundles were made for klint-0.1.1-py3-none-manylinux_2_28_x86_64.whl:
Publisher:
python-release.yml on konvert7/klint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klint-0.1.1-py3-none-manylinux_2_28_x86_64.whl -
Subject digest:
edddeb3627d660f3410b327396546a53b2d1416a4ed4987201b5f74270877d75 - Sigstore transparency entry: 1638854266
- Sigstore integration time:
-
Permalink:
konvert7/klint@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Branch / Tag:
refs/heads/main - Owner: https://github.com/konvert7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file klint-0.1.1-py3-none-macosx_11_0_arm64.whl.
File metadata
- Download URL: klint-0.1.1-py3-none-macosx_11_0_arm64.whl
- Upload date:
- Size: 875.9 kB
- Tags: Python 3, macOS 11.0+ ARM64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c844c2592857efba4dd9b7c60228d4cee78ca8c11d9021f812619d4828d13e80
|
|
| MD5 |
72615cdcd0697616d885ab71e214665b
|
|
| BLAKE2b-256 |
f4f0778a084511eb7c6167b15fb675392289cd8acb5ff72e028208b6a26d816c
|
Provenance
The following attestation bundles were made for klint-0.1.1-py3-none-macosx_11_0_arm64.whl:
Publisher:
python-release.yml on konvert7/klint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klint-0.1.1-py3-none-macosx_11_0_arm64.whl -
Subject digest:
c844c2592857efba4dd9b7c60228d4cee78ca8c11d9021f812619d4828d13e80 - Sigstore transparency entry: 1638854149
- Sigstore integration time:
-
Permalink:
konvert7/klint@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Branch / Tag:
refs/heads/main - Owner: https://github.com/konvert7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file klint-0.1.1-py3-none-macosx_10_13_x86_64.whl.
File metadata
- Download URL: klint-0.1.1-py3-none-macosx_10_13_x86_64.whl
- Upload date:
- Size: 889.3 kB
- Tags: Python 3, macOS 10.13+ x86-64
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
41b38540dc1464d4d63c9fca8f5d67bb2c5878ca100003cca98c4e1025671615
|
|
| MD5 |
baed1d23cef63419075b3cd8b38f1999
|
|
| BLAKE2b-256 |
aa520a93447dceb1dae411451e9de534b519ae37152e2b4977eeb96c73962cec
|
Provenance
The following attestation bundles were made for klint-0.1.1-py3-none-macosx_10_13_x86_64.whl:
Publisher:
python-release.yml on konvert7/klint
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
klint-0.1.1-py3-none-macosx_10_13_x86_64.whl -
Subject digest:
41b38540dc1464d4d63c9fca8f5d67bb2c5878ca100003cca98c4e1025671615 - Sigstore transparency entry: 1638854200
- Sigstore integration time:
-
Permalink:
konvert7/klint@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Branch / Tag:
refs/heads/main - Owner: https://github.com/konvert7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
python-release.yml@13bfc539d148a7a5cb9274204c12b7b46ab1f8ef -
Trigger Event:
workflow_dispatch
-
Statement type: