Skip to content
/ deal Public

🤝 Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.

License

Notifications You must be signed in to change notification settings

life4/deal

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Jul 11, 2021
113d5f7 · Jul 11, 2021
Oct 15, 2020
Jul 10, 2021
Jul 11, 2021
Jul 9, 2021
Jul 8, 2021
Jul 11, 2021
Jul 9, 2021
Jun 30, 2019
Jul 9, 2021
Jul 5, 2019
Jan 27, 2018
Jul 9, 2021
Jul 10, 2021
Mar 22, 2018
Mar 22, 2018
Jul 11, 2021
Jul 9, 2021

Repository files navigation

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 ❤️