A zero-dependency ERD generator for your Python models — pure AST, no database required.
Project description
🗃️ erdify
🚀 Generate beautiful PlantUML Entity Relationship Diagrams from your SQLModel, SQLAlchemy, Django, Pydantic and dataclass models automatically!
erdify parses your model files using AST (Abstract Syntax Tree) and generates comprehensive ERD diagrams in PlantUML format. It supports SQLModel, SQLAlchemy 2.0, Django ORM, Pydantic and standard-library dataclasses — and raw SQL DDL files (.sql) via the optional erdify[sql] extra. No database connection required!
✨ Features
- 🧬 5 Python Frameworks + SQL DDL - SQLModel, SQLAlchemy 2.0, Django ORM, Pydantic, dataclasses, and raw
.sqlfiles (viaerdify[sql]) - 🔍 AST-Based Parsing - No imports needed, works with any valid Python code
- 🎯 Zero dependencies by default — core uses only the stdlib; SQL support is an opt-in extra (
erdify[sql]) - 🔗 Relationship Detection - Foreign keys, relationships and many-to-many link tables
- 🧜 4 Output Formats -
--formatemits PlantUML, Mermaid (renders natively on GitHub), JSON, or a self-contained HTML preview - 📝 Markdown Embed -
--injectwrites the diagram into a Markdown file between markers - ⚙️ Config File - Store options under
[tool.erdify]inpyproject.toml - ✅ Drift Check -
--checkfails CI/pre-commit when the committed diagram is stale
See the full feature matrix for everything erdify recognizes.
🚀 Quick Start
# Run without installing (or `pip install erdify`)
uvx erdify ./src/database -o erd.puml
# Output to stdout, with a custom title
erdify ./src/models --title "My Database Schema"
See the documentation for installation options, the full CLI, the Python API and more.
🧬 One Schema, Five Frameworks
The same User / Order schema in SQLModel, SQLAlchemy 2.0, Django, Pydantic
and dataclasses — only the syntax differs. Each one produces the identical
diagram:
👉 See the full side-by-side comparison and the detection/parsing table in the
Frameworks Overview (with a worked
example and Django specifics).
The runnable sources live in docs/examples/.
📚 Documentation
- Installation — pip, uv, pipx, or run with uvx
- CLI & Python API — all CLI options, running as a module, and the Python API
- Output Formats — PlantUML & Mermaid,
--format,--injectinto Markdown, output naming - Filtering & Key Inference —
--exclude,--exclude-paths,--include,--sources,--infer-keys - Viewing the Diagram — render online, locally with PlantUML, or in VS Code
- CI/CD & pre-commit — automate ERD generation in CI and on commit
- Frameworks Overview — a worked example with the generated PlantUML output
- Django ORM — Django-specific parsing details
- SQL DDL — generate ERDs from
.sqlfiles witherdify[sql]
📋 Supported Features
Primary/foreign keys, nullable fields, defaults, indexes, enums, relationships, inheritance, link tables, custom table names and per-framework specifics — see the full feature matrix in the docs.
💬 Community
Questions, ideas, or want to show off an ERD erdify generated? Join the Discussions. For open-ended topics and feature direction, Discussions are the place; concrete bugs and proposals go to Issues.
🤝 Contributing
Contributions are welcome! Have a bug or a concrete feature request? Please open an issue, and see CONTRIBUTING.md for guidelines. Shipped changes are tracked in the changelog.
🔒 Security
For security concerns, please see SECURITY.md.
📄 License
This project is licensed under the MIT License - see the LICENSE file for details.
🙏 Acknowledgments
erdify stands on the shoulders of great open-source projects:
Supported model frameworks
- SQLModel - The awesome SQL database library
- SQLAlchemy - The Python SQL toolkit and ORM
- Django - The web framework whose ORM models erdify parses
- Pydantic - Data validation using Python type hints
- dataclasses - Python standard-library data classes
Rendering & output
- PlantUML - For the diagram rendering
- Graphviz - Layout engine behind PlantUML's ER diagrams
- Mermaid - Renders the
--format mermaid/htmloutput
Tooling & infrastructure
- uv - Packaging, builds and dependency management
- Ruff - Linting and formatting
- mypy - Static type checking
- pytest - Testing framework
- pre-commit - Git hook management
Community
- Contributor Covenant - Our Code of Conduct
- Keep a Changelog - Changelog format
- And everyone who contributes issues, ideas and pull requests 💜
Created & maintained with ❤️ by devsuit GmbH
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 Distribution
Built Distribution
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 erdify-0.11.1.tar.gz.
File metadata
- Download URL: erdify-0.11.1.tar.gz
- Upload date:
- Size: 30.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
5dddc2bab2ec22b320637ab3c0c4e6fba6843479987b3a9b9b1036640e145563
|
|
| MD5 |
9d87c325746a1266d12d0c0f6969c4e3
|
|
| BLAKE2b-256 |
e8ec5960bff617d88a629a39a65be5569d87b58a819b0467f9226cf8302fbd88
|
File details
Details for the file erdify-0.11.1-py3-none-any.whl.
File metadata
- Download URL: erdify-0.11.1-py3-none-any.whl
- Upload date:
- Size: 33.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: uv/0.11.24 {"installer":{"name":"uv","version":"0.11.24","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
c40b3c8fff01c59e4dcc3afb4787fc055bc3124ce8145d20ab1099169d33e0bd
|
|
| MD5 |
eec0241914f24f4598e62ce46aecae08
|
|
| BLAKE2b-256 |
d9b528355ed2a6de6dd1006bbf8528ecf5e70a554b99a4315d0a60bb405ac627
|