deal
**Deal** is a Python library for [design by contract][wiki] (DbC) programming.
Decision gist · record as of 2026-08-14
Yes, with conditions. Deal is worth installing if you want to add design-by-contract discipline to Python code and benefit from both runtime and static verification. The zero-dependency runtime, production track record since 2018, and integration with standard tools (pytest, flake8) make it low-risk to adopt. However, the aging maintenance status (257 days since last release) means you should verify that the version works with your Python version and toolchain before committing to it in a new project.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Requires Python 3.8 or later.
- Low install friction with no runtime dependencies.
- The package is in production use since 2018 and has 903 repository stars, but maintenance status is aging—last release was 257 days ago.
License · maintenance · safety
permissive license (permissive) — Deal is permissively licensed, allowing use in both open-source and proprietary projects without significant legal constraints.
last release 2025-11-30 (257 days) · last repo commit 2025-11-30 · 903 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 97,100 downloads/mo, #13,168 on PyPI
Alternatives
Verify before relying
pip install deal
import deal
@deal.post(lambda result: result >= 0)
@deal.pure
def count(items, item):
return items.count(item)
test_count = deal.cases(count)- Whether the 100% test coverage claim and partial formal verification are current as of version 4.24.6.
- Performance characteristics and overhead of contract checking at runtime versus static analysis only.
- Current state of integration with pytest, flake8, sphinx, and hypothesis in this version.
What it is and what it does
Deal is a design-by-contract library that lets you annotate Python functions with decorators to declare expected behavior: what inputs are valid (preconditions), what outputs must satisfy (postconditions), what invariants must hold, and what side-effects are allowed. Once annotated, the same contract declarations power multiple verification modes—runtime checking, static linting via flake8, property-based test generation, and formal verification—without requiring separate test code. The library has zero runtime dependencies, so you can add contracts during development and leave them enabled or disabled in production.
Deal integrates with pytest, flake8, sphinx, and hypothesis, and supports type annotations. It tracks exceptions and side-effects, detects memory leaks in pure functions, and performs partial execution to statically check possible values. The package has been in production use since 2018 and is actively maintained, though the last release was several months ago.
Use it for
- Add precondition and postcondition decorators to functions to catch invalid inputs and outputs early in development.
- Generate property-based tests automatically from contract decorators using deal.cases() integration.
- Run static contract checking via flake8 or deal's built-in linter to find violations before runtime.
- Enforce that functions are pure (no side-effects) and detect unexpected memory retention in pure functions.
- Formally verify critical code paths to prove correctness for all possible inputs.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, with conditions.
Deal is worth installing if you want to add design-by-contract discipline to Python code and benefit from both runtime and static verification. The zero-dependency runtime, production track record since 2018, and integration with standard tools (pytest, flake8) make it low-risk to adopt. However, the aging maintenance status (257 days since last release) means you should verify that the version works with your Python version and toolchain before committing to it in a new project.
Install
deal on PyPI
Before you install
Low install friction with no runtime dependencies. The package is in production use since 2018 and has 903 repository stars, but maintenance status is aging—last release was 257 days ago.
Requires Python 3.8 or later.
License in practice
Deal is permissively licensed, allowing use in both open-source and proprietary projects without significant legal constraints.
Quickstart
pip install deal
import deal
@deal.post(lambda result: result >= 0)
@deal.pure
def count(items, item):
return items.count(item)
test_count = deal.cases(count)
Verify before relying
- Whether the 100% test coverage claim and partial formal verification are current as of version 4.24.6.
- Performance characteristics and overhead of contract checking at runtime versus static analysis only.
- Current state of integration with pytest, flake8, sphinx, and hypothesis in this version.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | None |
| Maintenance | Aging 257 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 97,100 / month, #13,168 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: PluginsIntended Audience :: DevelopersLicense :: OSI Approved :: MIT LicenseProgramming Language :: PythonTopic :: Software DevelopmentTopic :: Software Development :: Libraries :: Python ModulesTopic :: Software Development :: Quality Assurance |
Evidence: deal-4.24.6-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “design by contract decorators”
- dealDeal is a Python library for design by contract that adds decorators…
- icontracticontract enforces design-by-contract in Python through decorators…
- zope.interfaceProvides a Python implementation of object interfaces for declaring…
Give your agent the search over MCP, or paste the wish link into any chat.
More Software Development packages
Provides backported and experimental type hints for Python 3.9+, allowing use of newer typing features on older Python versions and enabling early experimentation with type system PEPs before they enter the standard library.
NumPy provides an N-dimensional array object and a comprehensive suite of mathematical, linear algebra, Fourier transform, and random number functions for scientific computing in Python.
FastAPI is a Python web framework for building REST APIs using type hints, with automatic request validation, serialization, and interactive API documentation.
Provides a way to document function parameters, class attributes, return types, and variables inline using Python's `Annotated` type hint syntax instead of traditional docstrings.
Typer builds command-line applications from Python functions using type hints, automatically generating help text, argument parsing, and shell completion.
Install it if you are building CLIs in Python.
Distlib provides low-level packaging utilities for building, distributing, and managing Python software—including metadata handling, version specifiers, wheel support, script installation, and dependency resolution.
See also crosshair-tool · icontract · pact-python · python-interface · DafnyRuntimePython · zope.interface · eth-brownie · hypothesis · dvsim · datacontract-cli