Registry / database / django-anon

django-anon

JSON →
library0.3.2pypypi✓ verified 84d ago

django-anon is a Django library that helps anonymize production data so it can be safely used in non-production environments. It provides model mixins and field anonymization functions. The current version is 0.3.2. Release cadence is sporadic; last release was in 2019.

pip install django-anon
INSTALL
IMPORT
SIG · DJANGO-ANON
D
django-anon
databasepythonv0.3.2
Install
3.6s avg
Import
Disk
66MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v0.3.2 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.95 runs
installs and imports cleanly · install 0.0s · import 0.000s · 66.7MB
glibc
py 3.103.95 runs
installs and imports cleanly · install 3.6s · import 0.000s · 67MB
66MB installed
● package 66MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

BaseAnonymizer
from anon import BaseAnonymizer
from django_anon import AnonymousUser

Basic usage: create an AnonymousUser instance from an existing model instance and access anonymized fields.

import os os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'your_project.settings') import django django.setup() from django_anon import AnonymousUser from myapp.models import User for user in User.objects.all()[:1]: anon_user = AnonymousUser(user) print(anon_user.email) print(anon_user.username)
Debug
Known issues
gotchaIf you override save() in your model and call anonymize(), ensure you call super() to avoid infinite loops. Version 0.3.2 fixed a similar infinite loop in fake_username with empty separator.
fix
Always call super().save() after anonymization in custom save methods.
affects: <=0.3.2
deprecatedThe built-in bulk_update method changed in Django 2.2. django-anon 0.3 uses Django's built-in method if available, but there may be edge cases.
fix
Use Django's native bulk_update instead of relying on django-anon's version.
affects: 0.3
breakingThe fake_email function default max_size changed from infinite to 40 in version 0.3. This can cause emails to be truncated if you expect longer ones.
fix
Set max_size explicitly when calling fake_email if you need longer addresses.
affects: 0.3
Upgrade
Version history
0.3.2latest on PyPI · released Jul 28, 2021
Audit
Dependencies
djangorequiredRequired for model fields and querysets
fakerrequiredProvides fake data generators
Agent activity
5 hits · last 30 days
node
4
OpenAI (training)
1
Resources
django-anon — pip install django-anon · libregistry