Skip to main content

Excelsior: High-fidelity clean architecture linter for Python.

Project description

Stellar Engineering Command Banner

PyPI Build Status Python Versions License

Captain's Log: High-authority Pylint module for enforcing Prime Directives (Clean Architecture) and preventing Hull Integrity Breaches (Technical Debt) in Python projects.

Enforcing architectural boundaries, dependency rules, and design patterns to ensure the fleet remains operational and modular.

Features

  • Layer Boundary Enforcement: Ensures Prime Directives are maintained between Domain, UseCase, and Infrastructure.
  • The Silent Core Rule (W9013): Guarantees that Domain/UseCase layers remain free of print, logging, and console I/O, forcing delegation to Interfaces/Adapters.
  • Dependency Injection Checks: Forbids unauthorized instantiation of infrastructure modules within UseCases.
  • Design Pattern Enforcement: Detects "naked returns" and other architectural anomalies.
  • Law of Demeter: Prevents tight coupling through deep method chains.
  • Contract Integrity: Verifies that Infrastructure implements Domain Protocols correctly.
  • Anti-Bypass Guard: Prevents "lazy" disabling of Prime Directives without high-level authorization (Justification).

Docking Procedures

pip install pylint-clean-architecture

Flight Manual

Add the plugin to your pyproject.toml or Pylint configuration:

[tool.pylint.main]
load-plugins = ["clean_architecture_linter"]

Run Pylint as usual:

pylint src/

AI Coding Assistant Support

The clean-arch-init command generates architectural instructions for AI agents (like Cursor or GitHub Copilot) to prevent "Split Brain" issues by teaching the AI your project's rules before it writes code.

Usage:

clean-arch-init

Outcome: This creates a customized .agent/instructions.md file based on the layer names defined in the project's Console Calibration.

Console Calibration

The module is calibrated via [tool.clean-arch] in pyproject.toml.

[tool.clean-arch]
# 1. Project Type Presets (generic, cli_app, fastapi_sqlalchemy)
project_type = "generic"

# 2. Strict Visibility Enforcement
visibility_enforcement = true

# 3. Silent Core Calibration
silent_layers = ["Domain", "UseCase"]
allowed_io_interfaces = ["TelemetryPort", "LoggerPort"]

# 4. Shared Kernel (Allow cross-cutting concerns anywhere)
shared_kernel_modules = ["logging_utils", "clean_architecture_linter.interface.telemetry"]

# 5. Custom Layer Mapping (Map directory regex patterns to layers)
[tool.clean-arch.layer_map]
"services" = "UseCase"
"infrastructure/clients" = "Infrastructure"
"domain/models" = "Domain"

Prime Directives

See RULES.md for a complete catalog of enforced Prime Directives and "Clean Fix" examples.

Mission Log

Contributing

  1. Fork the repo.
  2. Install dependencies: make install.
  3. Run tests: make test.
  4. Submit a PR.

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

pylint_clean_architecture-1.4.1.tar.gz (32.2 kB view details)

Uploaded Source

Built Distribution

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

pylint_clean_architecture-1.4.1-py3-none-any.whl (35.8 kB view details)

Uploaded Python 3

File details

Details for the file pylint_clean_architecture-1.4.1.tar.gz.

File metadata

File hashes

Hashes for pylint_clean_architecture-1.4.1.tar.gz
Algorithm Hash digest
SHA256 dcac51fdc2b5da75e85320023a21f05d77cc185b413ae3c50a1f64afeb7bb4ee
MD5 31a14a90e00f0ce87686739c6e63239b
BLAKE2b-256 37faf5af360f4bf5bad3d7dde67550091ecfaea9c9057913b4f02d32ed29272e

See more details on using hashes here.

File details

Details for the file pylint_clean_architecture-1.4.1-py3-none-any.whl.

File metadata

File hashes

Hashes for pylint_clean_architecture-1.4.1-py3-none-any.whl
Algorithm Hash digest
SHA256 10ae1a090254679ddf2948a56ddb96adc8a9b7a2b14bc946294c650055a3926d
MD5 13f4b509d89c24bb662e3355086e73b9
BLAKE2b-256 9eef3c10b44e79fb65f07bdcdd4917bb10fb7e23679ee257358140a7daa2a6a7

See more details on using hashes here.

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