Development¶
Local environment¶
The repository uses uv for maintainer and contributor workflows. Package users can still install
the published library with pip; uv is only the internal development tool.
Example:
python -m pip install uv
uv sync --python 3.12 --all-groups
Quality commands¶
Run all core checks before merging:
uv run ruff format .
uv run ruff format --check .
uv run ruff check .
uv run mypy src tests
uv run pytest -q
uv run mkdocs build --strict
The repository also includes a GitHub Actions workflow at .github/workflows/ci.yml that
enforces the same checks on pushes and pull requests.
Release workflow¶
Build and validate release artifacts locally with:
uv sync --no-default-groups --group release
uv build
uv run twine check dist/*
The repository also includes .github/workflows/release.yml for Trusted Publishing.
Recommended release flow:
- Update
versioninpyproject.tomlandsrc/django_migration_inspector/__about__.py. - Run the local release checks.
- Trigger the
releaseworkflow withtestpypiselected. - Configure GitHub environments named
testpypiandpypias Trusted Publishers in TestPyPI and PyPI. - Push a version tag such as
v0.1.0to publish to PyPI.
Documentation workflow¶
Install docs dependencies and build locally:
uv sync --no-default-groups --group docs
uv run mkdocs serve
uv run mkdocs build --strict
Code style rules¶
The package is intentionally strict:
- Typed public interfaces.
mypy --strict.- Deterministic render outputs.
- Django internals isolated in adapter modules.
- Pure analysis layers wherever possible.
Architecture outline¶
The current implementation is split into:
django_adapter/Django-specific graph loading and operation normalization.domain/Immutable typed models and report contracts.analyzers/Pure graph intelligence, risk, and rollback logic.renderers/Text, JSON, Mermaid, DOT, risk-report, and rollback-report outputs.services/Thin orchestration between providers and analyzers.management/commands/Django CLI entry points.risk_rules/Built-in rule modules for destructive, custom, and data-migration checks.