{"id":22737794,"url":"https://github.com/fourdigits/django-anonymous","last_synced_at":"2025-08-26T23:36:54.710Z","repository":{"id":43375808,"uuid":"466051692","full_name":"fourdigits/django-anonymous","owner":"fourdigits","description":"Simple Django module to anonymize production data for safe usage on none production environments","archived":false,"fork":false,"pushed_at":"2023-06-06T10:56:56.000Z","size":50,"stargazers_count":9,"open_issues_count":1,"forks_count":1,"subscribers_count":0,"default_branch":"master","last_synced_at":"2025-03-27T18:50:22.428Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/fourdigits.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2022-03-04T08:59:15.000Z","updated_at":"2025-02-13T19:33:31.000Z","dependencies_parsed_at":"2022-09-13T15:31:16.356Z","dependency_job_id":null,"html_url":"https://github.com/fourdigits/django-anonymous","commit_stats":null,"previous_names":[],"tags_count":2,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fdjango-anonymous","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fdjango-anonymous/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fdjango-anonymous/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/fourdigits%2Fdjango-anonymous/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/fourdigits","download_url":"https://codeload.github.com/fourdigits/django-anonymous/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248606803,"owners_count":21132415,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-12-10T22:17:55.780Z","updated_at":"2025-04-14T04:44:53.964Z","avatar_url":"https://github.com/fourdigits.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# django-anonymous \n\n[![CI](https://github.com/krukas/django-anonymous/actions/workflows/main.yml/badge.svg)](https://github.com/krukas/django-anonymous/actions/workflows/main.yml)\n[![codecov](https://codecov.io/gh/krukas/django-anonymous/branch/master/graph/badge.svg?token=BPQQ1RVKDJ)](https://codecov.io/gh/krukas/django-anonymous)\n[![License: GPL v3](https://img.shields.io/badge/License-GPLv3-blue.svg)](https://www.gnu.org/licenses/gpl-3.0)\n[![PyPI version](https://badge.fury.io/py/django-anonymous.svg)](https://badge.fury.io/py/django-anonymous)\n\n\nSimple Django module to anonymize production data for safe usage on non-production environments.\n\n## Installation\n\n    pip install django-anonymous\n\n## Usage\n\nIn your app create a file `anon.py`:\n\n```python\nfrom django_anonymous import Anonymizer, Faker, register\nfrom .model import YourModel\n\n\n@register(YourModel)\nclass YourModelAnonymizer(Anonymizer):\n    \n    # You can give any callable, Faker is a small wrapper around the `faker` library. \n    email = Faker(\"email\", unique=True)\n    \n    # You can also use any static value\n    first_name = \"Anon\"\n```\n\nRun the anonymizer\n\n    python manage.py anonymize\n\n## Custom QuerySet\n\nYou can set a custom QuerySet to filter out some objects\n\n```python\nfrom django_anonymous import Anonymizer, Faker, register\nfrom .model import YourModel\n\n\n@register(YourModel)\nclass YourModelAnonymizer(Anonymizer):\n    email = Faker(\"email\", unique=True)\n\n    def get_queryset(self):\n        return super().get_queryset().filter(is_staff=True)\n```\n\n## Faker seed\n\nDefault it will use the object id as seed, to generate the same data for every run.\nYou can disable this by overriding the `get_object_seed` and return falsy value.\n\n```python\nfrom django_anonymous import Anonymizer, Faker, register\nfrom .model import YourModel\n\n\n@register(YourModel)\nclass YourModelAnonymizer(Anonymizer):\n    email = Faker(\"email\", unique=True)\n\n    def get_object_seed(self, obj):\n        return None\n```\n\n## Settings for Anonymizer\n\nPer Anonymizer you can set the select chunk size and update batch size.\nDefault it will not anonymize a field that has no value.\n\n```python\nfrom django_anonymous import Anonymizer, Faker, register\nfrom .model import YourModel\n\n\n@register(YourModel)\nclass YourModelAnonymizer(Anonymizer):\n    SELECT_CHUNK_SIZE = 100\n    UPDATE_BATCH_SIZE = 25\n    ANONYMIZE_EMPTY_FIELD = False\n    \n    email = Faker(\"email\", unique=True)\n```\n\n## Inspired by\n\n- https://github.com/Tesorio/django-anon\n- https://github.com/FactoryBoy/factory_boy\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffourdigits%2Fdjango-anonymous","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ffourdigits%2Fdjango-anonymous","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ffourdigits%2Fdjango-anonymous/lists"}