Skip to content

Tesorio/django-anon

Repository files navigation

django-anon

Anonymize production data so it can be safely used in not-so-safe environments

Install | Read Documentation | PyPI | Contribute

django-anon will help you anonymize your production database so it can be shared among developers, helping to reproduce bugs and make performance improvements in a production-like environment.

image

Features

🚀 Really fast data anonymization and database operations using bulk updates to operate over huge tables
🍰 Flexible to use your own anonymization functions or external libraries like Faker
🐩 Elegant solution following consolidated patterns from projects like Django and Factory Boy
🔨 Powerful. It can be used on any projects, not only Django, not only Python. Really!

Table of Contents

Installation

pip install django-anon

Supported versions

  • Python (2.7, 3.7)
  • Django (1.11, 2.2, 3.0)

License

MIT

Usage

Use anon.BaseAnonymizer to define your anonymizer classes:

Built-in functions

Lazy attributes

Lazy attributes can be defined as inline lambdas or methods, as shown below, using the anon.lazy_attribute function/decorator.

The clean method

Defining a custom QuerySet

A custom QuerySet can be used to select the rows that should be anonymized:

High-quality fake data

In order to be really fast, django-anon uses it's own algorithm to generate fake data. It is really fast, but the generated data is not pretty. If you need something prettier in terms of data, we suggest using Faker, which can be used out-of-the-box as the below:

Changelog

Check out CHANGELOG.rst for release notes

Contributing

Check out CONTRIBUTING.rst for information about getting involved


Icon made by Eucalyp from www.flaticon.com