Registry / auth-security / scrubadub

scrubadub

JSON →
library2.0.1pypypiunverified

Scrubadub is a Python library designed to clean personally identifiable information (PII) from unstructured text. It automatically detects and replaces various types of sensitive data like names, email addresses, phone numbers, and more, with configurable placeholders. The library is actively maintained, currently at version 2.0.1, and receives regular updates, including major releases that introduce new detectors and architectural changes.

pip install scrubadub
INSTALL
IMPORT
SIG · SCRUBADUB
S
scrubadub
auth-securitypythonv2.0.1
Install
58.0s avg
Import
7336ms
Disk
5530MB
Pass rate
4/ 10
Env Coverage4 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v2.0.1 · 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
glibc
py 3.10
✕ build_error
✓ 60.3s
py 3.11
✕ build_error
✓ 59.86s
py 3.12
✕ build_error
✓ 55.48s
py 3.13
✕ build_error
✓ 56.44s
py 3.9
✕ build_error
4/8 runs
5530MB installed
● package 5530MB
Code
Verified usage

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

clean
import scrubadub cleaned_text = scrubadub.clean(text)
The primary convenience function for quick cleaning.
Scrubber
from scrubadub import Scrubber scrubber = Scrubber() cleaned_text = scrubber.clean(text)
Use the Scrubber class for more fine-grained control, adding/removing specific detectors, or configuring post-processors.
Detector
from scrubadub.detectors import EmailDetector scrubber = Scrubber() scrubber.add_detector(EmailDetector())
Import specific detector classes to add them to a Scrubber, especially for optional or external detectors.

This quickstart demonstrates the basic usage of `scrubadub.clean()` for straightforward PII redaction. It also illustrates how to use the `Scrubber` class to manually add detectors for more customized control over the scrubbing process, especially useful for optional or external detectors not loaded by default.

import scrubadub text = "My cat can be contacted on example@example.com, or 1800 555-5555. His name is John Doe." cleaned_text = scrubadub.clean(text) print(cleaned_text) # For more control, use the Scrubber class from scrubadub import Scrubber from scrubadub.detectors import TextBlobNameDetector # Example of an optional detector scrubber = Scrubber() # Add a detector if it's not enabled by default or for custom configuration scrubber.add_detector(TextBlobNameDetector()) controlled_cleaned_text = scrubber.clean(text) print(controlled_cleaned_text)
Debug
Known issues
breakingVersion 2.0.0 introduced significant changes, including the splitting of the library into smaller sub-packages and a shift from loading all detectors by default to loading only a default set. Code relying on previously auto-loaded detectors (e.g., spaCy, Stanford NER) will need explicit `add_detector()` calls or installation of optional packages (`scrubadub_spacy`, `scrubadub_stanford`, `scrubadub_address`).
fix
Review the changelog for v2.0.0. For previously implicitly available detectors, explicitly install the relevant sub-package (e.g., `pip install scrubadub-spacy`) and add the detector to your `Scrubber` instance using `scrubber.add_detector(DetectorClass())`.
affects: >=2.0.0
breakingPython 2.7 and 3.5 support was dropped starting from version 2.0.0. If you require these Python versions, you must use `scrubadub` version 1.2.2 or earlier.
fix
Upgrade to Python 3.6+ or pin `scrubadub` to `==1.2.2` for older Python versions.
affects: >=2.0.0
gotchaOnly a default set of detectors are loaded when initializing a `Scrubber` or using `scrubadub.clean()` since version 2.0.0. If you need functionality from optional or external detectors (e.g., `SpacyNameDetector`, `AddressDetector`), you must explicitly install their packages and add them to your `Scrubber` instance.
fix
Install the required optional packages (e.g., `pip install scrubadub-spacy`) and then use `scrubber.add_detector(DetectorClass())` to enable them.
affects: >=2.0.0
gotchaAttempting to add two detectors with the same name to a `Scrubber` instance will result in a `KeyError`.
fix
Ensure each detector you add has a unique name. If adding multiple instances of the same detector class with different configurations, assign a unique `name` parameter during instantiation (e.g., `EmailDetector(name='work_email_detector')`).
affects: All versions
gotchaVersion 2.0.1 fixed an issue where the `scikit-learn` dependency was incorrectly named. Users might have encountered installation problems with `scrubadub==2.0.0` due to this.
fix
Ensure you are using `scrubadub==2.0.1` or later to avoid this specific dependency naming issue.
affects: 2.0.0
Upgrade
Version history
2.0.1latest on PyPI · released Sep 1, 2023
Audit
Dependencies
cataloguerequiredRequired for core functionality.
dateparserrequiredRequired for core functionality.
fakerrequiredRequired for core functionality.
phonenumbersrequiredRequired for core functionality (phone number detection).
python-stdnumrequiredRequired for core functionality.
scikit-learnrequiredRequired for core functionality.
textblobrequiredRequired for core functionality (name detection).
typing-extensionsrequiredRequired for core functionality.
scrubadub-spacyoptionalEnables spaCy-based detectors for enhanced name and entity recognition.
scrubadub-stanfordoptionalEnables Stanford NER detectors for advanced entity recognition.
scrubadub-addressoptionalEnables address and postal code detection.
Agent activity
44 hits · last 30 days
node
34
OpenAI (training)
1
Resources