deal-4.9.0
توضیحات
**Deal** is a Python library for [design by contract][wiki] (DbC) programming.
| ویژگی | مقدار |
|---|---|
| سیستم عامل | - |
| نام فایل | deal-4.9.0 |
| نام | deal |
| نسخه کتابخانه | 4.9.0 |
| نگهدارنده | [] |
| ایمیل نگهدارنده | [] |
| نویسنده | - |
| ایمیل نویسنده | Gram <gram@orsinium.dev> |
| آدرس صفحه اصلی | - |
| آدرس اینترنتی | https://pypi.org/project/deal/ |
| مجوز | - |
# 
[](https://cloud.drone.io/life4/deal)
[](https://pypi.python.org/pypi/deal)
[](https://pypi.python.org/pypi/deal)
A Python library for [design by contract](https://en.wikipedia.org/wiki/Design_by_contract) (DbC) and checking values, exceptions, and side-effects. In a nutshell, deal empowers you to write bug-free code. By adding a few decorators to your code, you get for free tests, static analysis, formal verification, and much more. Read [intro](https://deal.readthedocs.io/basic/intro.html) to get started.
## Features
* [Classic DbC: precondition, postcondition, invariant.][values]
* [Tracking exceptions and side-effects.][exceptions]
* [Property-based testing.][tests]
* [Static checker.][linter]
* Integration with pytest, flake8, sphinx, and hypothesis.
* Type annotations support.
* [External validators support.][validators]
* [Contracts for importing modules.][module_load]
* [Can be enabled or disabled on production.][runtime]
* [Colorless][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][leaks]: deal makes sure that pure functions don't leave unexpected objects in the memory.
* DRY: test discovery, error messages generation.
* Partial execution: linter executes contracts to statically check possible values.
* [Formal verification][verification]: prove that your code works for all input (or find out when it doesn't).
* Zero-dependency runtime: there are some dependencies for analysis tools, but nothing of it is required on the production.
* Fast: each code change is benchmarked and profiled.
* Reliable: the library has 100% test coverage, partially verified, and runs on production by multiple companies since 2018.
[values]: https://deal.readthedocs.io/basic/values.html
[exceptions]: https://deal.readthedocs.io/basic/exceptions.html
[tests]: https://deal.readthedocs.io/basic/tests.html
[linter]: https://deal.readthedocs.io/basic/linter.html
[validators]: https://deal.readthedocs.io/details/contracts.html#external-validators
[module_load]: https://deal.readthedocs.io/details/module_load.html
[runtime]: https://deal.readthedocs.io/basic/runtime.html
[colorless]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/
[leaks]: https://deal.readthedocs.io/basic/tests.html#memory-leaks
[verification]: https://deal.readthedocs.io/basic/verification.html
## Deal in 30 seconds
```python
# 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](https://deal.readthedocs.io/).
## Installation
```bash
python3 -m pip install --user 'deal[all]'
```
## 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.
To run tests locally, all you need is [task](http://taskfile.dev/). Run `task all` to run all code formatters, linters, and tests.
Thank you :heart:
نیازمندی
| مقدار | نام |
|---|---|
| xtr | astroid>=2.11.0; |
| xtr | deal-solver>=0.1.2; |
| xtr | hypothesis; |
| xtr | pygments; |
| xtr | typeguard>=3.0.0; |
| xtr | vaa>=0.2.1; |
| xtr | m2r2>=0.3.3.post2; |
| xtr | myst-parser; |
| xtr | sphinx==7.*; |
| xtr | sphinx-rtd-theme==2.*; |
| xtr | astroid>=2.11.0; |
| xtr | deal-solver>=0.1.2; |
| xtr | hypothesis; |
| xtr | pygments; |
| xtr | typeguard<4.0.0; |
| xtr | vaa>=0.2.1; |
| xtr | sphinx>=4.5.0; |
| xtr | flake8; |
| xtr | marshmallow; |
| xtr | flake8; |
| xtr | flake8-commas; |
| xtr | flake8-quotes; |
| xtr | mypy>=0.900; |
| xtr | mypy_test>=0.1.1; |
| xtr | isort; |
| xtr | deal-solver>=0.1.2; |
| xtr | hypothesis; |
| xtr | pygments; |
| xtr | typeguard<4.0.0; |
| xtr | coverage[toml]; |
| xtr | coverage-conditional-plugin; |
| xtr | docstring-parser; |
| xtr | pytest-cov; |
| xtr | pytest; |
| xtr | urllib3; |
زبان مورد نیاز
| مقدار | نام |
|---|---|
| >=3.8 | Python |
نحوه نصب
نصب پکیج whl deal-4.9.0:
pip install deal-4.9.0.whl
نصب پکیج tar.gz deal-4.9.0:
pip install deal-4.9.0.tar.gz