django-safemigrate
Safely run migrations before deployment
Decision gist · record as of 2026-08-14
Yes, if you deploy Django applications and want to reduce deployment-order migration errors. The low install friction and permissive license make it a safe add. However, the aging maintenance status (437 days since last release) means you should verify compatibility with your Django version before relying on it in production.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.9 or later and Django as a runtime dependency.
- Low install friction with a single runtime dependency on django.
- Maintenance status is aging—last release was 437 days ago, though the repository remains active and the package has been stable since its first release in 2019.
License · maintenance · safety
MIT (permissive) — MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
last release 2025-06-03 (437 days) · last repo commit 2025-06-03 · 96 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 97,551 downloads/mo, #13,147 on PyPI
Alternatives
Verify before relying
pip install django-safemigrate
# In settings.py, add to INSTALLED_APPS:
INSTALLED_APPS = [
"django_safemigrate",
]
# In a migration file:
from django_safemigrate import Safe
class Migration(migrations.Migration):
safe = Safe.before_deploy- Whether the aging maintenance status (437 days since last release) affects compatibility with recent Django versions.
- Real-world effectiveness of the pre-commit hook in preventing unmarked migrations from reaching production.
What it is and what it does
django-safemigrate is a Django extension that adds a safemigrate command to control when migrations run relative to code deployment. It lets you mark each migration as safe to run before deployment (e.g., adding a column), after deployment (e.g., removing a column), or always safe. When you run safemigrate, only migrations marked as safe for the current deployment phase will execute; if an unsafe migration blocks a safe one, the command fails rather than proceeding.
The package solves a common deployment problem: running the wrong migrations at the wrong time can cause downtime or data loss. By explicitly marking migrations and enforcing their order, it prevents accidental unsafe runs. It supports a delay mechanism for after-deploy migrations, nonstrict mode for development, and integrates with pre-commit to catch unmarked migrations before they reach version control. The normal migrate command continues to work unchanged.
Use it for
- Mark a migration that adds a new column as Safe.before_deploy so it runs during the pre-deployment phase, before new code is live.
- Mark a migration that removes a deprecated column as Safe.after_deploy so it only runs after the code no longer references it.
- Use Safe.after_deploy(delay=timedelta(days=7)) to defer a destructive migration for a week, reducing risk of rollback.
- Enable nonstrict mode in development to allow migrations to accumulate between developers without blocking the safemigrate command.
- Use the pre-commit hook to enforce that all migrations in a repository are explicitly marked with a safe value.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you deploy Django applications and want to reduce deployment-order migration errors.
The low install friction and permissive license make it a safe add. However, the aging maintenance status (437 days since last release) means you should verify compatibility with your Django version before relying on it in production.
Install
django-safemigrate on PyPI
Before you install
Low install friction with a single runtime dependency on django. Maintenance status is aging—last release was 437 days ago, though the repository remains active and the package has been stable since its first release in 2019.
Requires Python 3.9 or later and Django as a runtime dependency.
License in practice
MIT license is permissive; you can use, modify, and distribute this package freely with minimal restrictions.
Quickstart
pip install django-safemigrate
# In settings.py, add to INSTALLED_APPS:
INSTALLED_APPS = [
"django_safemigrate",
]
# In a migration file:
from django_safemigrate import Safe
class Migration(migrations.Migration):
safe = Safe.before_deploy
Verify before relying
- Whether the aging maintenance status (437 days since last release) affects compatibility with recent Django versions.
- Real-world effectiveness of the pre-commit hook in preventing unmarked migrations from reaching production.
Package facts
| License | MIT permissive |
| Python support | Supports the current Python release >=3.9 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 1 packagedjango |
| Maintenance | Aging 437 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 97,551 / month, #13,147 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
Evidence: django_safemigrate-6.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “pre-deployment migrations”
- django-safemigrateAdds a safemigrate command to Django that selectively runs migrations…
- django-syzygyAutomates Django database migration deployment by splitting…
- pybatfishPybatfish is a Python client for Batfish, a network validation tool…
Give your agent the search over MCP, or paste the wish link into any chat.
More Quality Assurance packages
Coverage.py measures which lines of Python code are executed during test runs, reporting coverage percentages and identifying untested code paths.
Install it if you want to measure test completeness or enforce coverage thresholds in your project.
Ruff is a Python linter and code formatter written in Rust that combines linting, formatting, and code fixing into a single tool, replacing Flake8, Black, isort, and related utilities.
Pexpect spawns and controls interactive console applications by sending input and matching output patterns, automating tasks that would otherwise require manual interaction.
Black reformats Python source code to a consistent style by parsing entire files and rewriting them according to an opinionated, deterministic set of rules, eliminating manual formatting decisions.
pytest-xdist distributes pytest tests across multiple CPU cores or machines to speed up test execution, with the simplest usage being `pytest -n auto` to spawn workers equal to available CPUs.
Install it if your test suite takes long enough that parallelization would save meaningful time.
Validates AWS CloudFormation templates in YAML or JSON format against resource provider schemas and best practices, checking property values and configuration correctness.
Install it if you work with CloudFormation templates.
See also django-pgmigrate · django-syzygy · django-linear-migrations · django-pg-zero-downtime-migrations · django-pg-migration-tools · django-add-default-value · django-test-migrations · Flask-Migrate · django-migration-linter