Deply Agent Instructions
Project
- Deply is a Python static architecture analysis CLI.
- It analyzes Python code, maps code elements into configured layers, checks architecture rules, and reports violations.
- Keep changes small, explicit, and scoped to the task. Do not edit unrelated code.
Stack
- Python package supporting Python 3.8 through 3.14.
- Packaging:
setuptools,setup.py,MANIFEST.in. - Runtime dependency:
PyYAML. - Tests:
unittestundertests/. - Quality tools:
ruff,mypy,pip-audit,pre-commit,mutmut.
Commands
- Setup:
python3 -m venv .venv && ./.venv/bin/pip install -r requirements.txt -r requirements-dev.txt - Full local check:
make check - Tests:
make test - Lint:
make lint - Typing:
make typing - Security:
make security - Mutation tests:
make mutation - Pre-commit hooks:
make pre-commit - Direct tests:
./.venv/bin/python -m unittest discover tests
Architecture Map
- CLI entrypoint:
deply/main.py. - Orchestration:
deply/deply_runner.py. - AST dependency analysis:
deply/code_analyzer.pyanddeply/utils/dependency_visitor.py. - Config parsing:
deply/config_parser.py. - Collectors:
deply/collectors/, created throughCollectorFactory. - Rules:
deply/rules/, created throughRuleFactory. - Reports:
deply/reports/anddeply/reports/formats/. - Mermaid output:
deply/diagrams/marmaid_diagram_builder.py. - Value objects:
deply/models/. - Docs:
README.mdanddoc/.
Coding Rules
- Follow existing style unless it is clearly wrong for the task.
- Prefer simple functions, early returns, descriptive names, and low side effects.
- Keep business analysis logic independent from CLI parsing, report formatting, and persistence.
- Do not add dependencies unless the task truly needs them.
- Do not add logging, comments, abstractions, or broad refactors unless they remove real complexity.
- Treat generated or local artifacts as out of scope:
.venv/,.mypy_cache/,.ruff_cache/,dist/,build/,deply.egg-info/,mutants/, and coverage output. - Treat local
deply.yamlas user/runtime config; updatedeply.yaml.exampleand docs for public config examples.
Extension Rules
- New collector: add implementation in
deply/collectors/, wire it throughCollectorFactory, document config shape, and add focused tests. - New rule: add implementation in
deply/rules/, wire it throughRuleFactory, update violation/report behavior if needed, and add focused tests. - New report format: add formatter under
deply/reports/formats/, wire it throughReportGenerator, update CLI choices/docs, and add tests. - CLI/config behavior changes require matching updates in
README.mdanddoc/.
Testing
- Add or update
unittestcoverage for changed behavior. - Prefer small tests that exercise public behavior through existing factories, runner paths, or CLI boundaries.
- For docs-only changes,
git diff --checkis enough unless code changes were also made. - Before finishing code changes, run the narrow relevant test first, then
make checkwhen feasible.
Git
- Do not work directly on a divergent
main. - Prefer a short-lived branch from
origin/mainfor repo changes. - Keep commits atomic and docs-only changes separate from behavior changes.
- Before final response, inspect
git status --short --branchand verify the diff.