Getting Started with Deply
This guide will help you get up and running with Deply quickly.
Installation
To install Deply, use pip:
pip install deply
Basic Usage
After installation, you can start using Deply by following these steps:
- Create a configuration file named
deply.yamlin your project root. Starting with Deply v1.3.2, generate it from a packaged preset (layered,django,fastapi, orflask) and adjust the layer directories to your project:
deply init --preset fastapi
Until those directories match your layout, the first deply analyze exits 1 with “no code elements mapped to configured layers” when nothing matches, or passes with mostly empty layers when only a regex or decorator collector matches.
- Validate the configuration:
deply validate --config=deply.yaml
- Run the analysis command:
deply analyze
python -m deply is equivalent to the deply command, which helps when the console script is not on PATH:
deply analyze
python -m deply analyze
You can also use the Deply Config Agent Skill with Codex, Claude Code, or another Agent Skills-compatible assistant to generate the configuration interactively.
Configuration
Before running the tool, you need to create a configuration file that specifies the rules and target files to enforce. The configuration file should be named deply.yaml by default, but you can specify a different name using the --config option. Starting with Deply v1.3.2 on Python 3.11+, the same configuration can live in a [tool.deply] table in pyproject.toml; see Using pyproject.toml.
Basic Configuration Example
Here’s a simple example of a deply.yaml configuration file:
deply:
paths:
- /path/to/your/project
exclude_files:
- ".*\\.venv/.*"
layers:
- name: models
collectors:
- type: class_inherits
base_class: "django.db.models.Model"
- name: views
collectors:
- type: file_regex
regex: ".*/views_api.py"
ruleset:
views:
disallow_layer_dependencies:
- models
For more detailed configuration options and examples, please refer to the Configuration Guide.