life4 / Deal
Licence: mit
Design by contract for Python with static checker and tests' generation.
Stars: ✭ 164
Programming Languages
python
139335 projects - #7 most used programming language
Projects that are alternatives of or similar to Deal
Vscode Stylelint
A Visual Studio Code extension to lint CSS/SCSS/Less with stylelint
Stars: ✭ 260 (+58.54%)
Mutual labels: linter, validation
Nyaya
Random Data Generation and/or Property Testing in Scala & Scala.JS.
Stars: ✭ 165 (+0.61%)
Mutual labels: functional-programming, property-based-testing
Hamsters
A mini Scala utility library
Stars: ✭ 292 (+78.05%)
Mutual labels: validation, functional-programming
openapi-lint-vscode
OpenAPI 2.0/3.0.x intellisense, validator, linter, converter and resolver extension for Visual Studio Code
Stars: ✭ 47 (-71.34%)
Mutual labels: validation, linter
Interfacer
A linter that suggests interface types
Stars: ✭ 706 (+330.49%)
Mutual labels: linter, interface
dockerfile-utils
A library and command line interface for formatting and linting Dockerfiles.
Stars: ✭ 17 (-89.63%)
Mutual labels: validation, linter
Gowrap
GoWrap is a command line tool for generating decorators for Go interfaces
Stars: ✭ 464 (+182.93%)
Mutual labels: decorators, interface
Swift Validated
🛂 A result type that accumulates multiple errors.
Stars: ✭ 350 (+113.41%)
Mutual labels: validation, functional-programming
Class Validator
Decorator-based property validation for classes.
Stars: ✭ 6,941 (+4132.32%)
Mutual labels: validation, decorators
Superstruct
A simple and composable way to validate data in JavaScript (and TypeScript).
Stars: ✭ 5,604 (+3317.07%)
Mutual labels: validation, interface
Html5validator
Command line tool to validate HTML5 files. Great for continuous integration.
Stars: ✭ 251 (+53.05%)
Mutual labels: linter, validation
Graphql Go Tools
Tools to write high performance GraphQL applications using Go/Golang.
Stars: ✭ 96 (-41.46%)
Mutual labels: linter, validation
Deep Waters
🔥Deep Waters is an easy-to-compose functional validation system for javascript developers 🔥
Stars: ✭ 188 (+14.63%)
Mutual labels: validation, functional-programming
validada
Another library for defensive data analysis.
Stars: ✭ 29 (-82.32%)
Mutual labels: validation, decorators
Joiful
TypeScript Declarative Validation for Joi
Stars: ✭ 177 (+7.93%)
Mutual labels: validation, decorators
Enforce
Python 3.5+ runtime type checking for integration testing and data validation
Stars: ✭ 502 (+206.1%)
Mutual labels: validation, decorators
React Inform
Simple controlled forms with validations in react
Stars: ✭ 81 (-50.61%)
Mutual labels: validation, decorators
Functionaljava
Functional programming in Java
Stars: ✭ 1,472 (+797.56%)
Mutual labels: functional-programming, property-based-testing
Metalang99
A functional language for C99 preprocessor metaprogramming
Stars: ✭ 152 (-7.32%)
Mutual labels: functional-programming
Canarinho
Utilitários Android para padrões Brasileiros
Stars: ✭ 162 (-1.22%)
Mutual labels: validation
Deal -- python library for design by contract (DbC) and checking values, exceptions, and side-effects. Read intro to get started.
Features
- Classic DbC: precondition, postcondition, invariant.
- Tracking exceptions and side-effects.
- Property-based testing.
- Static checker.
- Integration with pytest, flake8, and hypothesis.
- Type annotations support.
- External validators support.
- Contracts for importing modules.
- Can be enabled or disabled on production.
- Colorless: annotate only what you want. Hence, easy integration into an existing project.
- Colorful: syntax highlighting for every piece of code in every command.
- Memory leaks detection. Deal makes sure that a pure function doesn't leave unexpected objects in the memory.
- DRY: test discovery, error messages generation.
- Partial execution: linter executes contracts to statically check possible values.
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
orflake8
to statically check errors. - Run
python3 -m deal test
orpytest
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 ❤️
Note that the project description data, including the texts, logos, images, and/or trademarks,
for each open source project belongs to its rightful owner.
If you wish to add or remove any projects, please contact us at [email protected].