Installation¶
pygarble requires Python 3.8 or later. The base install has no runtime dependencies; its bundled character statistics and dictionary require no inference-time downloads. Optional screening backends have separate extras.
This documentation describes 0.11.0, including pygarble.screening,
pygarble.gibberish, optional backends and both command lines. They are
listed under 0.11.0 in the repository changelog. pip install pygarble
installs 0.11.0; 0.8.0 was the previous PyPI release and has none of these
APIs. See Upgrading for the version boundary.
Install a release¶
python -m pip install pygarble
python -m pip show pygarble
Install from source¶
To use unreleased changes from main, with Git installed:
python -m pip install "pygarble @ git+https://github.com/brightertiger/pygarble.git@main"
Replace main with a reviewed commit SHA to pin a reproducible installation.
For an editable checkout:
git clone https://github.com/brightertiger/pygarble.git
cd pygarble
python -m pip install -e .
When evaluating an unmerged change, check out its reviewed branch or commit before the install command.
Optional screening backends¶
From a source checkout:
python -m pip install -e ".[phones]" # phonenumberslite
python -m pip install -e ".[stdnum]" # python-stdnum
python -m pip install -e ".[secrets]" # detect-secrets
python -m pip install -e ".[screening]" # all three Python extras
From PyPI, the corresponding form is
python -m pip install 'pygarble[screening]'. Installing an extra
does not enable it; pass backend names to the standalone Scanner.
Native profanity detection uses the bundled English word list and needs no
extra package.
Gitleaks is a separately installed executable, not a Python extra. The
adapter supports Gitleaks >=8.19,<9; CI exercises 8.30.1. Put the executable
on PATH or configure its path through backend_options. The adapter
does not install it. See Standalone screening and optional backends for supported options
and coverage, and Command-line interface for command-line selection.
Verify the installation¶
import pygarble
from pygarble.gibberish import EnsembleDetector
from pygarble.screening import Scanner
print(pygarble.__version__)
detector = EnsembleDetector()
assert detector.predict("Hello world") is False
assert detector.predict("asdfghjkl") is True
assert Scanner().redact("mail jane@example.com").text == "mail [EMAIL]"
Development tools¶
The dev extra installs test, formatting, lint, and typing tools. The
docs extra installs Sphinx and the sphinx-immaterial theme. The theme
needs Python 3.10 or newer; the documentation is built on Python 3.12.
Neither is required to use the package.
python -m pip install -e ".[dev,docs]"
See Quick start for usage and Upgrading when upgrading.