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 scrubadubVerified import paths — ran on the pinned version, not inferred.
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.
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())`.
Upgrade to Python 3.6+ or pin `scrubadub` to `==1.2.2` for older Python versions.
Install the required optional packages (e.g., `pip install scrubadub-spacy`) and then use `scrubber.add_detector(DetectorClass())` to enable them.
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')`).
Ensure you are using `scrubadub==2.0.1` or later to avoid this specific dependency naming issue.