CI and Documentation Snippets
Use these snippets after deply.yaml validates.
Install Commands
Use a pinned Deply version in CI for reproducibility.
pip:
python -m pip install "deply==1.3.3"
deply validate --config=deply.yaml
deply analyze --parallel --config=deply.yaml
pipx:
pipx run --spec "deply==1.3.3" deply validate --config=deply.yaml
pipx run --spec "deply==1.3.3" deply analyze --parallel --config=deply.yaml
uv:
uvx --from "deply==1.3.3" deply validate --config=deply.yaml
uvx --from "deply==1.3.3" deply analyze --parallel --config=deply.yaml
poetry:
poetry add --group dev "deply==1.3.3"
poetry run deply validate --config=deply.yaml
poetry run deply analyze --parallel --config=deply.yaml
Baseline-Capable Builds
The pinned v1.3.3 examples support both commands. deply context requires v1.3.0 or later; --baseline requires v1.2.2 or later. Create and review the baseline once outside CI, following adoption-and-audit.md. On v1.2.1 or older, upgrade for baseline support or use the numeric fallback only when explicitly accepted by the user.
architecture-check:
deply validate --config=deply.yaml
deply analyze --config=deply.yaml --baseline=deply-baseline.json
- name: Check architecture against accepted debt
run: deply analyze --config=deply.yaml --baseline=deply-baseline.json --report-format=github-actions
CI must never invoke --write-baseline. New relationships and incomplete analysis fail; accepted relationships do not. For agent feedback use --report-format=json and inspect baseline.new, baseline.existing, and baseline.resolved.
Makefile
Add a target that validates the config and runs analysis:
.PHONY: architecture-check
architecture-check:
deply validate --config=deply.yaml
deply analyze --parallel --config=deply.yaml
For legacy adoption on published v1.2.1 (weaker numeric fallback):
architecture-check:
deply validate --config=deply.yaml
deply analyze --parallel --config=deply.yaml --max-violations=$(DEPLY_MAX_VIOLATIONS)
Use an exact numeric value in CI, not an untracked environment default.
GitHub Actions
pip install:
- name: Install Deply
run: |
python -m pip install --upgrade pip
python -m pip install "deply==1.3.3"
- name: Validate Deply config
run: deply validate --config=deply.yaml
- name: Check architecture
run: deply analyze --parallel --report-format=github-actions --config=deply.yaml
uv install:
- name: Install uv
uses: astral-sh/setup-uv@v5
- name: Validate Deply config
run: uvx --from "deply==1.3.3" deply validate --config=deply.yaml
- name: Check architecture
run: uvx --from "deply==1.3.3" deply analyze --parallel --report-format=github-actions --config=deply.yaml
Older-CLI numeric fallback:
- name: Check architecture
run: deply analyze --parallel --report-format=github-actions --config=deply.yaml --max-violations=12
GitLab CI
architecture:
image: python:3.12
script:
- python -m pip install --upgrade pip
- python -m pip install "deply==1.3.3"
- deply validate --config=deply.yaml
- deply analyze --parallel --config=deply.yaml
Documentation
Add a short architecture section to README.md or docs/architecture.md:
## Architecture Checks
This project uses Deply to enforce Python architecture boundaries.
Local check:
```bash
deply validate --config=deply.yaml
deply analyze --parallel --config=deply.yaml
```
Configured layers:
- `domain`: business rules and entities. No framework or persistence imports.
- `application`: use cases and orchestration.
- `infrastructure`: database, HTTP, queue, SDK, and framework adapters.
- `interface`: CLI, web, API, worker entrypoints.
Suppression policy:
- Existing `deply:ignore` and `deply:ignore-file` comments are reviewed during adoption.
- New suppressions require a specific architectural reason in review.
- Prefer config fixes or a reviewed baseline over hiding violations.
CI behavior:
- New projects should fail on any violation.
- Legacy projects on v1.2.2 or later use `--baseline=deply-baseline.json`. CI never writes the baseline.
- Older CLIs may use an explicitly accepted `--max-violations=N` fallback. The value should only decrease.
Keep documentation factual. Do not describe rules that are not present in deply.yaml.