🛡️ django-signal-guard
Make Django signal failures loud.
Catch the bulk writes that silently skip your pre_save / post_save receivers,
the receivers that never get connected, run twice, loop forever,
or send the email before the transaction commits.
Documentation • Getting started • Test assertions • Large projects • Configuration • Changelog
💥 The problem
Order.objects.bulk_create(rows) # post_save never fires
Order.objects.filter(...).update(...) # neither does pre_save
bulk_create(), bulk_update() and update() write rows without calling
Model.save(), so your pre_save and post_save receivers never run.
Nothing errors. The search index goes stale, the audit log has gaps, a cache is never invalidated. You usually find out days later, in production.
✅ The fix
django-signal-guard catches those writes in development, tests and CI, and
tells you exactly which receivers were skipped and where the call came from:
SignalBypassError: QuerySet.bulk_create() on shop.Order skips 2 receivers:
pre_save shop.signals.normalize_status (shop/signals.py:5)
post_save shop.signals.reindex_order (shop/signals.py:9)
Called from shop/imports.py:42.
Run the receivers' work yourself, or wrap the call in signal_guard.allow_bypass(Order, reason="...").
It doesn't add new signals or replace them with hooks. Your signals stay
exactly as they are. It just reports misuse, the way
nplusone and
django-seal report lazy queries.
✨ What's inside
| Feature | What it catches | |
|---|---|---|
| 🚧 | Bypass guard | Bulk writes that skip receivers: raise, warn or log. |
| 🔁 | Recursion tracing | A receiver that saves its own instance and loops, with the whole chain. |
| ⏳ | Before-commit check | Emails, Celery tasks and HTTP calls made before the transaction commits, and @receiver_on_commit to fix them. |
| 🩺 | System checks | Receivers that never run, only run in some processes, die silently, or run twice. |
| 🔒 | signals.lock |
A committed inventory of every receiver, checked in CI, so new receivers show up in code review. |
| 🧪 | Test assertions | assert_bypass(), assert_no_reports(), assert_sent() and friends, for pytest and unittest. |
| 📋 | CI baseline | Adopt it on a big codebase: known reports stay quiet, new ones fail CI. |
📦 Install
pip install django-signal-guard
Requires Python 3.10+ and Django 5.2+.
🚀 Quick start
1. Add it to INSTALLED_APPS, first in the list:
# settings.py
INSTALLED_APPS = [
"signal_guard", # first, so it sees every receiver being connected
# ...
]
2. Make every finding fail your tests:
# settings/test.py
SIGNAL_GUARD = {"BYPASS": "raise", "RECURSION": "raise", "SIDE_EFFECTS": "raise"}
3. Add two lines to CI:
python manage.py check --tag signals --fail-level WARNING
python manage.py signal_map --check
That's it. Everywhere else, the default is "warn".
When skipping receivers is what you want, say so next to the code:
from signal_guard import allow_bypass
with allow_bypass(Order, reason="import reindexes in one batch"):
Order.objects.bulk_create(rows)
🧪 In your tests
from signal_guard.testing import assert_bypass, assert_no_reports, assert_sent
def test_import_is_clean():
with assert_no_reports():
import_orders(rows)
def test_nightly_job_skips_reindex_on_purpose():
with assert_bypass(Order, method="update", receivers=["*.reindex_order"]):
mark_all_unindexed()
def test_paying_sends_order_paid():
with assert_sent(order_paid, sender=Order, amount=10):
order.pay(10)
Also as pytest fixtures (signal_reports, sent_signals) and as unittest
methods. See Test assertions.
🏗️ On a big codebase
Thousands of reports on day one? Survey them, cut the noise, and let a baseline keep the known ones quiet while CI fails on new ones:
pytest --signal-guard-summary # every report, by call site
pytest --signal-guard-baseline=signal-guard-baseline.txt --signal-guard-update-baseline
pytest --signal-guard-baseline=signal-guard-baseline.txt # fails only on new reports
See Large projects.
📚 Documentation
Everything else, from each check in detail to the configuration reference, performance numbers and the stability policy, is at https://panosangelopoulos.github.io/django-signal-guard/.
🧭 Prior art
- Johnny Metz's post on blocking bulk operations that skip signals, which
shows the same idea as a custom
QuerySet. django-bulk-signals,django-bulk-trackerand similar packages add new bulk signals. Use them if you want receivers that do run on bulk writes;django-signal-guardtells you when your existing receivers don't.django-lifecyclereplaces signals with model hooks.
🧑💻 Development
uv sync --group dev
uv run pytest
uv run ruff check . && uv run ruff format --check .
uv run mkdocs serve # the documentation, live
uv run python benchmarks/overhead.py # what each wrapper costs
Issues and pull requests are welcome.
📄 License
BSD-3-Clause, the same as Django.
Metadata
Release files for django-signal-guard 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| django_signal_guard-1.0.1.tar.gz | 66.0 kB | With provenance | Details for django_signal_guard-1.0.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| django_signal_guard-1.0.1-py3-none-any.whl | Python 3 | none | any | Details for django_signal_guard-1.0.1-py3-none-any.whl |
Total release size: 121.0 kB
Release files / django_signal_guard-1.0.1.tar.gz
| Download URL | django_signal_guard-1.0.1.tar.gz |
|---|---|
| Size | 66.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
914dc0293fd0fb9245d9148117be5dd800a4f55d6718167e9c52ee23b84d32fd
|
|
BLAKE2b-256 checksum How to use checksums |
74f58b53e64c0f0f866ee3f068c8786c65def4235c1ff4eb49da0c4a45eac86d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logRelease files / django_signal_guard-1.0.1-py3-none-any.whl
| Download URL | django_signal_guard-1.0.1-py3-none-any.whl |
|---|---|
| Size | 54.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
8da339795dad0df72a1810e068f5e43bfc34cd8d47c751d1c9a4371adedd3aa4
|
|
BLAKE2b-256 checksum How to use checksums |
c753982c4bc30006d8bedec5969a01ae67fd3d3362bcb71737afb364b1ca6106
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.16
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logSecurity for django-signal-guard 1.0.1
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
Full provenance
Both files in this release have been uploaded with provenance metadata.
Attestation for django_signal_guard-1.0.1.tar.gz
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Nov 16, 2026.
Transparency logA note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.