{"categories":[{"label":"Quality Assurance","url":"https://skillfed.io/packages/category/software-development-quality-assurance/2"}],"enrichment":{"capability":"icontract enforces design-by-contract in Python through decorators that validate preconditions, postconditions, and class invariants, with detailed violation messages showing source code and variable values.","skillfed_tags":["design-by-contract","runtime-validation","api-documentation"],"use_cases":["Add runtime validation to library APIs to catch misuse early with informative error messages","Document and enforce class invariants in complex stateful objects to prevent invalid states","Verify function inputs and outputs in data processing pipelines to catch logic errors","Generate automated test cases by inferring test strategies from contracts","Enforce contracts on HTTP APIs to validate request and response contracts"],"what_it_does":"icontract is a Python library that implements design-by-contract through decorators, allowing you to declare preconditions (what must be true before a function runs), postconditions (what must be true after), and invariants (what must always be true for a class). When a contract is violated, it raises a ViolationError with a detailed message that includes the contract condition itself, the values of all relevant variables at the time of violation, and any custom description you provided.\n\nThe library is built on three runtime dependencies: asttokens, contextvars, and typing_extensions. It supports Python 3.6 through 3.13 and has been in production use since 2018. Unlike simpler assertion-based approaches, icontract automatically extracts and displays variable values without requiring you to write custom error messages, following the DRY principle. It also supports contract inheritance, allowing subclasses to weaken preconditions and strengthen postconditions.","worth_installing":"Yes, if you want runtime contract enforcement with detailed diagnostics. The permissive MIT license, low install friction, and lack of known vulnerabilities make it safe to adopt. Aging maintenance (197 days since last release) is a minor concern but not a blocker\u2014the library is stable and the repository remains active. Best suited for teams that value explicit contract documentation and detailed failure messages over minimal runtime overhead."},"id":"icontract","links":{"html":"https://skillfed.io/packages/icontract","md":"https://skillfed.io/packages/icontract.md","pypi":"https://pypi.org/project/icontract/"},"maintenance":{"status":"aging"},"meta":{"latest_release":"2026-01-29","license_spdx":null,"license_treatment":"permissive","name":"icontract","python_support":"unspecified","summary":"Provide design-by-contract with informative violation messages."},"popularity":{"monthly_downloads":408319,"position":6881,"tier":"top_15000"},"security":{"n_vulnerabilities":0},"version":"2.7.3"}
