https://github.com/tesorio/django-anon

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

https://github.com/tesorio/django-anon

Science Score: 26.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
    Found .zenodo.json file
  • DOI references
  • Academic publication links
  • Committers with academic emails
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (14.4%) to scientific vocabulary

Keywords

django hacktoberfest
Last synced: 6 months ago · JSON representation

Repository

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

Basic Info
Statistics
  • Stars: 164
  • Watchers: 3
  • Forks: 6
  • Open Issues: 9
  • Releases: 3
Topics
django hacktoberfest
Created almost 7 years ago · Last pushed about 2 years ago
Metadata Files
Readme Changelog Contributing License

README.rst

.. BANNERSTART
.. Since PyPI does not support raw directives, we remove them from the README
..
.. raw directives are only used to make README fancier on GitHub and do not
.. contain relevant information to be displayed in PyPI, as they are not tied
.. to the current version, but to the current development status
.. raw:: html

    

django-anon

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

Install | Read Documentation | PyPI | Contribute

.. BANNEREND **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:: https://raw.githubusercontent.com/Tesorio/django-anon/master/django-anon-recording.gif .. start-features Features ======== .. start-features-table .. csv-table:: "🚀", "**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!" .. end-features-table .. end-features .. start-table-of-contents Table of Contents ================= .. contents:: :local: .. end-table-of-contents .. start-introduction Installation ------------ .. code:: pip install django-anon Supported versions ------------------ * Python (2.7, 3.7) * Django (1.11, 2.2, 3.0) License ------- `MIT `_ .. end-introduction .. start-usage Usage ----- Use ``anon.BaseAnonymizer`` to define your anonymizer classes: .. code-block:: python import anon from your_app.models import Person class PersonAnonymizer(anon.BaseAnonymizer): email = anon.fake_email # You can use static values instead of callables is_admin = False class Meta: model = Person # run anonymizer: be cautious, this will affect your current database! PersonAnonymizer().run() Built-in functions ~~~~~~~~~~~~~~~~~~ .. code:: python import anon anon.fake_word(min_size=_min_word_size, max_size=20) anon.fake_text(max_size=255, max_diff_allowed=5, separator=' ') anon.fake_small_text(max_size=50) anon.fake_name(max_size=15) anon.fake_username(max_size=10, separator='') anon.fake_email(max_size=40, suffix='@example.com') anon.fake_url(max_size=50, scheme='http://', suffix='.com') anon.fake_phone_number(format='999-999-9999') Lazy attributes ~~~~~~~~~~~~~~~ Lazy attributes can be defined as inline lambdas or methods, as shown below, using the ``anon.lazy_attribute`` function/decorator. .. code-block:: python import anon from your_app.models import Person class PersonAnonymizer(anon.BaseAnonymizer): name = anon.lazy_attribute(lambda o: 'x' * len(o.name)) @lazy_attribute def date_of_birth(self): # keep year and month return self.date_of_birth.replace(day=1) class Meta: model = Person The clean method ~~~~~~~~~~~~~~~~ .. code-block:: python import anon class UserAnonymizer(anon.BaseAnonymizer): class Meta: model = User def clean(self, obj): obj.set_password('test') obj.save() Defining a custom QuerySet ~~~~~~~~~~~~~~~~~~~~~~~~~~ A custom QuerySet can be used to select the rows that should be anonymized: .. code-block:: python import anon from your_app.models import Person class PersonAnonymizer(anon.BaseAnonymizer): email = anon.fake_email class Meta: model = Person def get_queryset(self): # keep admins unmodified return Person.objects.exclude(is_admin=True) 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: .. code-block:: python import anon from faker import Faker from your_app.models import Address faker = Faker() class PersonAnonymizer(anon.BaseAnonymizer): postalcode = faker.postalcode class Meta: model = Address .. end-usage 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 `_

Owner

  • Name: Tesorio
  • Login: Tesorio
  • Kind: organization
  • Email: hello@tesorio.com
  • Location: San Francisco Bay Area, CA

GitHub Events

Total
  • Issues event: 1
  • Watch event: 1
Last Year
  • Issues event: 1
  • Watch event: 1

Committers

Last synced: almost 3 years ago

All Time
  • Total Commits: 58
  • Total Committers: 5
  • Avg Commits per committer: 11.6
  • Development Distribution Score (DDS): 0.103
Top Committers
Name Email Commits
Caio Ariede c****e@g****m 52
dependabot[bot] 4****]@u****m 3
Felipe Vieira me@f****o 1
James Addison j****n@c****m 1
Balaji D R d****7@g****m 1
Committer Domains (Top 20 + Academic)

Issues and Pull Requests

Last synced: 6 months ago

All Time
  • Total issues: 16
  • Total pull requests: 64
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 6 days
  • Total issue authors: 11
  • Total pull request authors: 7
  • Average comments per issue: 2.44
  • Average comments per pull request: 0.91
  • Merged pull requests: 55
  • Bot issues: 0
  • Bot pull requests: 8
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: N/A
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • caioariede (5)
  • budlight (2)
  • 03b8 (1)
  • anujbhatt (1)
  • tillgschwend (1)
  • FabioFleitas (1)
  • ghost (1)
  • renatooliveira (1)
  • weber-s (1)
  • felipetio (1)
  • KyeRussell (1)
Pull Request Authors
  • caioariede (50)
  • dependabot[bot] (8)
  • SupImDos (2)
  • ghost (2)
  • renatooliveira (1)
  • felipetio (1)
  • deeaarbee (1)
Top Labels
Issue Labels
bug (2) Hacktoberfest (2) enhancement (1)
Pull Request Labels
dependencies (8) Hacktoberfest (1)

Packages

  • Total packages: 1
  • Total downloads:
    • pypi 27,686 last-month
  • Total dependent packages: 0
  • Total dependent repositories: 1
  • Total versions: 5
  • Total maintainers: 2
pypi.org: django-anon

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

  • Versions: 5
  • Dependent Packages: 0
  • Dependent Repositories: 1
  • Downloads: 27,686 Last month
Rankings
Downloads: 3.8%
Stargazers count: 5.7%
Dependent packages count: 9.8%
Average: 11.1%
Forks count: 14.2%
Dependent repos count: 21.8%
Maintainers (2)
Last synced: 6 months ago

Dependencies

.github/workflows/main.yml actions
  • 5monkeys/cobertura-action master composite
  • actions/checkout v2 composite
  • actions/checkout v1 composite
  • actions/setup-python v2 composite
  • actions/setup-python v1 composite
Pipfile pypi
  • sphinx * develop
  • sphinx-autobuild * develop
  • sphinx-rtd-theme * develop
  • tox * develop
  • twine * develop
  • django-bulk-update *
  • django-chunkator *
Pipfile.lock pypi
  • alabaster ==0.7.12 develop
  • appdirs ==1.4.4 develop
  • argh ==0.26.2 develop
  • babel ==2.9.0 develop
  • bleach ==3.3.0 develop
  • certifi ==2020.12.5 develop
  • cffi ==1.14.4 develop
  • chardet ==4.0.0 develop
  • colorama ==0.4.4 develop
  • cryptography ==3.3.1 develop
  • distlib ==0.3.1 develop
  • docutils ==0.16 develop
  • filelock ==3.0.12 develop
  • idna ==2.10 develop
  • imagesize ==1.2.0 develop
  • importlib-metadata ==1.7.0 develop
  • jeepney ==0.6.0 develop
  • jinja2 ==2.11.3 develop
  • keyring ==22.0.1 develop
  • livereload ==2.6.3 develop
  • markupsafe ==1.1.1 develop
  • packaging ==20.9 develop
  • pathtools ==0.1.2 develop
  • pkginfo ==1.7.0 develop
  • pluggy ==0.13.1 develop
  • port-for ==0.3.1 develop
  • py ==1.10.0 develop
  • pycparser ==2.20 develop
  • pygments ==2.7.4 develop
  • pyparsing ==2.4.7 develop
  • pytz ==2021.1 develop
  • pyyaml ==5.4.1 develop
  • readme-renderer ==28.0 develop
  • requests ==2.25.1 develop
  • requests-toolbelt ==0.9.1 develop
  • rfc3986 ==1.4.0 develop
  • secretstorage ==3.3.0 develop
  • six ==1.15.0 develop
  • snowballstemmer ==2.1.0 develop
  • sphinx ==3.2.1 develop
  • sphinx-autobuild ==0.7.1 develop
  • sphinx-rtd-theme ==0.5.0 develop
  • sphinxcontrib-applehelp ==1.0.2 develop
  • sphinxcontrib-devhelp ==1.0.2 develop
  • sphinxcontrib-htmlhelp ==1.0.3 develop
  • sphinxcontrib-jsmath ==1.0.1 develop
  • sphinxcontrib-qthelp ==1.0.3 develop
  • sphinxcontrib-serializinghtml ==1.1.4 develop
  • toml ==0.10.2 develop
  • tornado ==6.1 develop
  • tox ==3.19.0 develop
  • tqdm ==4.56.0 develop
  • twine ==3.2.0 develop
  • urllib3 ==1.26.3 develop
  • virtualenv ==20.4.2 develop
  • watchdog ==1.0.2 develop
  • webencodings ==0.5.1 develop
  • zipp ==3.4.0 develop
  • asgiref ==3.3.1
  • django ==3.1.6
  • django-bulk-update ==2.2.0
  • django-chunkator ==2.0.0
  • pytz ==2021.1
  • sqlparse ==0.4.1
setup.py pypi
  • django-bulk-update *
tests/requirements.txt pypi
  • django-bulk-update * test
  • django-chunkator * test
pyproject.toml pypi