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:
- Implement the detector using the
DetectorABC. - Add pattern coverage and validation rules.
- Add tests for valid matches, invalid matches, and false positives.
- 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:
- Add the region's patterns and detector mappings.
- Register the region through
PatternLoader. - Add representative fixtures and evaluation cases.
- 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
pytestbefore 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.