Popularity
2.5
Growing
Activity
8.8
Declining
231
7
9

Description

Deal -- python library for design by contract (DbC) programming. That's nice assert statements in decorators style to validate function input, output, available operations and object state. Goal is make testing much easier and detect errors in your code that occasionally was missed in tests.

Programming language: Python
License: MIT License
Latest version: v4.4.0

Deal alternatives and similar packages

Based on the "Functional Programming" category.
Alternatively, view Deal alternatives based on common mentions on social networks and blogs.

Do you think we are missing an alternative of Deal or a related project?

Add another 'Functional Programming' Package

README

Deal

Build Status PyPI version Development Status

Deal -- python library for design by contract (DbC) and checking values, exceptions, and side-effects. Read intro to get started.

Features

Deal in 30 seconds

# the result is always non-negative
@deal.post(lambda result: result >= 0)
# the function has no side-effects
@deal.pure
def count(items: List[str], item: str) -> int:
    return items.count(item)

# generate test function
test_count = deal.cases(count)

Now we can:

  • Run python3 -m deal lint or flake8 to statically check errors.
  • Run python3 -m deal test or pytest to generate and run tests.
  • Just use the function in the project and check errors in runtime.

Read more in the documentation.

Installation

python3 -m pip install --user deal

Contributing

Contributions are welcome! A few ideas what you can contribute:

  • Add new checks for the linter.
  • Improve documentation.
  • Add more tests.
  • Improve performance.
  • Found a bug? Fix it!
  • Made an article about deal? Great! Let's add it into the README.md.
  • Don't have time to code? No worries! Just tell your friends and subscribers about the project. More users -> more contributors -> more cool features.

Thank you :heart: