{"id":27695,"library":"django-consistency-enforcer","title":"django-consistency-enforcer","description":"A Django library that provides testing utilities to enforce internal consistency across Django concepts (models, signals, permissions, etc.). Current version is 0.5.1, with monthly releases.","status":"active","version":"0.5.1","language":"python","source_language":"en","source_url":"https://github.com/yourusername/django-consistency-enforcer","tags":["django","testing","consistency","enforcer","models"],"install":[{"cmd":"pip install django-consistency-enforcer","lang":"bash","label":"Standard installation"}],"dependencies":[{"reason":"Runtime dependency; enforcer works with Django models and ORM.","package":"django","optional":false}],"imports":[{"note":"The main class is directly importable from the top-level module, not a submodule.","wrong":"from consistency_enforcer.enforcer import ConsistencyEnforcer","symbol":"ConsistencyEnforcer","correct":"from consistency_enforcer import ConsistencyEnforcer"},{"note":"Function has been moved to top-level since 0.4.","wrong":"from consistency_enforcer.decorators import enforce_consistency","symbol":"enforce_consistency","correct":"from consistency_enforcer import enforce_consistency"}],"quickstart":{"code":"# In your test file\nfrom django.test import TestCase\nfrom consistency_enforcer import ConsistencyEnforcer\n\nclass MyModelTest(TestCase):\n    def test_model_consistency(self):\n        enforcer = ConsistencyEnforcer()\n        # This will check that all model references are consistent\n        enforcer.check_all()\n","lang":"python","description":"Basic usage of ConsistencyEnforcer to verify internal consistency in Django tests."},"warnings":[{"fix":"Update imports to `from consistency_enforcer import ConsistencyEnforcer`.","message":"In version 0.5.0, the import path for `ConsistencyEnforcer` changed from `consistency_enforcer.enforcer` to `consistency_enforcer`. Old imports will break.","severity":"breaking","affected_versions":">=0.5.0"},{"fix":"Replace `@enforce_consistency` with a call to `enforcer.check_all()` inside the test.","message":"The `enforce_consistency` decorator is deprecated in favor of using the `ConsistencyEnforcer` class directly. It will be removed in version 0.6.","severity":"deprecated","affected_versions":">=0.5.0"},{"fix":"Pass app labels to `check_all(app_labels=['myapp'])` to limit scope.","message":"The enforcer may be slow on large projects because it inspects all Django apps' models and signals. Run it only on specific apps or models in CI to avoid timeout.","severity":"gotcha","affected_versions":"all"}],"env_vars":null,"last_verified":"2026-05-09T00:00:00.000Z","next_check":"2026-08-07T00:00:00.000Z","problems":[{"fix":"Either upgrade the library (`pip install --upgrade django-consistency-enforcer`) or use the old import: `from consistency_enforcer.enforcer import ConsistencyEnforcer`.","cause":"The library version is older than 0.5.0, where the class was in a submodule.","error":"ImportError: cannot import name 'ConsistencyEnforcer' from 'consistency_enforcer'"},{"fix":"Use the `ConsistencyEnforcer` class instead: `from consistency_enforcer import ConsistencyEnforcer`.","cause":"Trying to import a deprecated function that was removed in 0.5.0.","error":"AttributeError: module 'consistency_enforcer' has no attribute 'enforce_consistency'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}