Skip to main content

Introduction

Design by contract is a methodology of software design. It prescribes that software designers should define formal, precise and verifiable interface specifications for software components, which extend the ordinary definition of abstract data types with preconditions, postconditions and invariants. These specifications are referred to as “contracts”, in accordance with a conceptual metaphor with the conditions and obligations of business contracts.

Usage

When using this library, just create a class and define the preconditions, postconditions or invariants in the method, or in a separate function.

For ex.

from PyContractor import PyContractor

def division(self, a, b):
    PyContractor.require(b != 0, "Divisor must be non-zero")

division(2/0)

This tiny library just gives you a start to know this methodology and it’s mainly focused for educational purposes.

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

PyContractor-0.1.1.tar.gz (2.5 kB view details)

Uploaded Source

File details

Details for the file PyContractor-0.1.1.tar.gz.

File metadata

  • Download URL: PyContractor-0.1.1.tar.gz
  • Upload date:
  • Size: 2.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for PyContractor-0.1.1.tar.gz
Algorithm Hash digest
SHA256 af8e8f463772f4f334c34a77c4b460f309a78ae000e09512970615d243f550c5
MD5 a366120782103fd9e4b7cd12ece4ff55
BLAKE2b-256 5fa2ffec4d2c50a4bbe808dce5a13c94663575ee7d9872d51e9d4a0e39822884

See more details on using hashes here.

Release history Release notifications | RSS feed

This release

0.1.1 This release

1 file

0.1.0

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page