Sync Django migrations to match the dev branch, then checkout dev.
Project description
django-sync-migrations
Sync Django migrations to match the dev branch, then checkout dev. Use when on a feature branch with migrations you want to discard before switching back to dev.
Install / run (from your Django project directory)
If published on PyPI:
uvx django-sync-migrations
uvx django-sync-migrations --dry-run
uvx django-sync-migrations --branch develop
uvx django-sync-migrations --skip-checkout
Or run from GitHub (no PyPI):
uvx --from git+https://github.com/sponrad/django-sync-migrations django-sync-migrations
uvx --from git+https://github.com/sponrad/django-sync-migrations@main django-sync-migrations # pin to branch/tag
Requires a Django project (with manage.py), git, and a reachable database. The tool runs manage.py migrate using your project’s .venv Python when present.
Publishing to PyPI
One-time setup
- Create a PyPI account at pypi.org and enable 2FA.
- Create the project on PyPI (or it will be created on first publish): go to pypi.org/manage/account/ → “Create a new project”, name it
django-sync-migrations. - Create an API token (Account → API tokens): scope it to this project (or “Entire account” for testing). Copy the token; you won’t see it again.
Manual publish (each release)
From the repo root:
# Bump version (optional; or edit pyproject.toml by hand)
uv version --bump patch
# Build
uv build
# Upload to PyPI (set token once: export UV_PUBLISH_TOKEN=pypi-...)
uv publish --token $(grep UV_PUBLISH_TOKEN .env 2>/dev/null | cut -d= -f2)
# or: uv publish # if UV_PUBLISH_TOKEN is already in the environment
For Test PyPI first: add to pyproject.toml under [tool.uv] (or use a separate config) an index with publish-url = "https://test.pypi.org/legacy/" and run uv publish --index testpypi.
Automated publish (recommended): Trusted Publisher
No tokens: push a tag and the workflow publishes to PyPI.
- GitHub: Create an environment named
pypi(Settings → Environments). - PyPI: Project → “Publishing” → “Add a new trusted publisher” → GitHub. Set:
- Owner/repository:
sponrad/django-sync-migrations - Workflow name:
publish.yml - Environment name:
pypi
- Owner/repository:
- Release: Tag and push. The workflow in
.github/workflows/publish.ymlruns on tagsv*(e.g.v0.1.0).
git tag -a v0.1.0 -m "Release 0.1.0"
git push --tags
Project details
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 django_sync_migrations-0.1.0.tar.gz.
File metadata
- Download URL: django_sync_migrations-0.1.0.tar.gz
- Upload date:
- Size: 4.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d3b2b39d602daf1705f220f2bbb67fa3d124f6d1e26000e7783cf1a54000fd91
|
|
| MD5 |
832be050b4cbb0b49c5062d0cd634f7e
|
|
| BLAKE2b-256 |
92ed3bc72d7bf3178d2731bdb2bb32d68be5fef679cfd0736a481466fb16f733
|
File details
Details for the file django_sync_migrations-0.1.0-py3-none-any.whl.
File metadata
- Download URL: django_sync_migrations-0.1.0-py3-none-any.whl
- Upload date:
- Size: 5.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.6.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
3af084b1631238e0d4aa279e90725ff1982ed0a5e469b67d14d3f70c844ef720
|
|
| MD5 |
e34e2d5c074a7fc0c2b9923ea5f758ce
|
|
| BLAKE2b-256 |
6c29d0153f461796e4420793c50eceaa10e8c079c00db89bc973e05910cb8e1e
|