Overview of icontract and its ecosystem
mastericontract implements the design-by-contract paradigm for Python 3. It provides informative violation messages (including source code of the condition and variable values) and supports contract inheritance (weakening preconditions, strengthening postconditions/invariants).
Key ecosystem tools include:
- Linting:
pyicontract-lint - Documentation:
sphinx-icontract - Automated Testing:
icontract-hypothesis(infersHypothesisstrategies from contracts) with IDE integrations for Vim, PyCharm, and VSCode. - Formal Verification: Integrated with
CrossHairfor automatic verification, with IDE integrations for PyCharm and VSCode. - Web APIs:
fastapi-icontractfor enforcing contracts in FastAPI and exposing them in OpenAPI/Swagger schemas.