FastPII Docs

Contributing

Set up the FastPII development environment and contribute detectors, regions, and fixes.

Contributing

FastPII contributions are easiest to review when they stay focused, tested, and aligned with the library's lightweight design.

Development setup

git clone <your-fork-or-upstream-url>
cd fastpii
pip install -e ".[dev]"
pytest
ruff check .
mypy .

Adding a detector

New detectors should follow the project's detector abstraction and validation style.

Recommended workflow:

  1. Implement the detector using the Detector ABC.
  2. Add pattern coverage and validation rules.
  3. Add tests for valid matches, invalid matches, and false positives.
  4. Confirm the detector behaves correctly in detect(), validate(), and transformation flows.

Adding a region

Regional support should plug into the pattern loading architecture cleanly.

Recommended workflow:

  1. Add the region's patterns and detector mappings.
  2. Register the region through PatternLoader.
  3. Add representative fixtures and evaluation cases.
  4. Verify the region works when initialized with PrivacyGuard(regions=["cz"])-style configuration.

Pull request process

  • Keep pull requests small and reviewable.
  • Include tests for every detector or parser change.
  • Document user-visible behavior changes.
  • Include benchmark notes if accuracy or performance changes significantly.

Code standards

  • Run pytest before opening a pull request.
  • Run ruff check . for linting.
  • Run mypy . for type checking.
  • Prefer clear detector logic over opaque heuristics.
  • Preserve the project's low-dependency design where possible.

On this page