{"id":13468646,"url":"https://github.com/life4/deal","last_synced_at":"2025-03-26T05:31:14.643Z","repository":{"id":28712359,"uuid":"118873232","full_name":"life4/deal","owner":"life4","description":"🤝 Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.","archived":false,"fork":false,"pushed_at":"2024-03-24T19:46:00.000Z","size":2007,"stargazers_count":741,"open_issues_count":5,"forks_count":25,"subscribers_count":14,"default_branch":"master","last_synced_at":"2024-10-29T22:56:39.302Z","etag":null,"topics":["contracts","contracts-programming","dbc","deal","decorators","design-by-contract","flake8","functional-programming","hacktoberfest","interface","invariant","linter","mypy","property-based-testing","python","pythonic","refinement-types","testing","typing","validation"],"latest_commit_sha":null,"homepage":"https://deal.readthedocs.io/","language":"Python","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/life4.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2018-01-25T06:38:47.000Z","updated_at":"2024-10-25T10:55:35.000Z","dependencies_parsed_at":"2022-07-18T03:00:40.620Z","dependency_job_id":"73eeece1-5560-4d3a-a0dc-66bad17e0f6a","html_url":"https://github.com/life4/deal","commit_stats":{"total_commits":1120,"total_committers":18,"mean_commits":62.22222222222222,"dds":"0.48124999999999996","last_synced_commit":"624d9a9369e3c9cfc7693a63fe90715180d41339"},"previous_names":[],"tags_count":60,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Fdeal","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Fdeal/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Fdeal/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/life4%2Fdeal/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/life4","download_url":"https://codeload.github.com/life4/deal/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245597266,"owners_count":20641862,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["contracts","contracts-programming","dbc","deal","decorators","design-by-contract","flake8","functional-programming","hacktoberfest","interface","invariant","linter","mypy","property-based-testing","python","pythonic","refinement-types","testing","typing","validation"],"created_at":"2024-07-31T15:01:15.653Z","updated_at":"2025-03-26T05:31:13.039Z","avatar_url":"https://github.com/life4.png","language":"Python","funding_links":[],"categories":["Python","ریاضی","Design by Contract"],"sub_categories":["کار با زمان و تقویم"],"readme":"# ![Deal](https://raw.githubusercontent.com/life4/deal/master/logo.png)\n\n[![Build Status](https://cloud.drone.io/api/badges/life4/deal/status.svg)](https://cloud.drone.io/life4/deal)\n[![PyPI version](https://img.shields.io/pypi/v/deal.svg)](https://pypi.python.org/pypi/deal)\n[![Development Status](https://img.shields.io/pypi/status/deal.svg)](https://pypi.python.org/pypi/deal)\n\nA 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.\n\n## Features\n\n* [Classic DbC: precondition, postcondition, invariant.][values]\n* [Tracking exceptions and side-effects.][exceptions]\n* [Property-based testing.][tests]\n* [Static checker.][linter]\n* Integration with pytest, flake8, sphinx, and hypothesis.\n* Type annotations support.\n* [External validators support.][validators]\n* [Contracts for importing modules.][module_load]\n* [Can be enabled or disabled on production.][runtime]\n* [Colorless][colorless]: annotate only what you want. Hence, easy integration into an existing project.\n* Colorful: syntax highlighting for every piece of code in every command.\n* [Memory leaks detection][leaks]: deal makes sure that pure functions don't leave unexpected objects in the memory.\n* DRY: test discovery, error messages generation.\n* Partial execution: linter executes contracts to statically check possible values.\n* [Formal verification][verification]: prove that your code works for all input (or find out when it doesn't).\n* Zero-dependency runtime: there are some dependencies for analysis tools, but nothing of it is required on the production.\n* Fast: each code change is benchmarked and profiled.\n* Reliable: the library has 100% test coverage, partially verified, and runs on production by multiple companies since 2018.\n\n[values]: https://deal.readthedocs.io/basic/values.html\n[exceptions]: https://deal.readthedocs.io/basic/exceptions.html\n[tests]: https://deal.readthedocs.io/basic/tests.html\n[linter]: https://deal.readthedocs.io/basic/linter.html\n[validators]: https://deal.readthedocs.io/details/contracts.html#external-validators\n[module_load]: https://deal.readthedocs.io/details/module_load.html\n[runtime]: https://deal.readthedocs.io/basic/runtime.html\n[colorless]: http://journal.stuffwithstuff.com/2015/02/01/what-color-is-your-function/\n[leaks]: https://deal.readthedocs.io/basic/tests.html#memory-leaks\n[verification]: https://deal.readthedocs.io/basic/verification.html\n\n## Deal in 30 seconds\n\n```python\n# the result is always non-negative\n@deal.post(lambda result: result \u003e= 0)\n# the function has no side-effects\n@deal.pure\ndef count(items: List[str], item: str) -\u003e int:\n    return items.count(item)\n\n# generate test function\ntest_count = deal.cases(count)\n```\n\nNow we can:\n\n* Run `python3 -m deal lint` or `flake8` to statically check errors.\n* Run `python3 -m deal test` or `pytest` to generate and run tests.\n* Just use the function in the project and check errors in runtime.\n\nRead more in the [documentation](https://deal.readthedocs.io/).\n\n## Installation\n\n```bash\npython3 -m pip install --user 'deal[all]'\n```\n\n## Contributing\n\nContributions are welcome! A few ideas what you can contribute:\n\n* Add new checks for the linter.\n* Improve documentation.\n* Add more tests.\n* Improve performance.\n* Found a bug? Fix it!\n* Made an article about deal? Great! Let's add it into the `README.md`.\n* Don't have time to code? No worries! Just tell your friends and subscribers about the project. More users -\u003e more contributors -\u003e more cool features.\n\nTo run tests locally, all you need is [task](http://taskfile.dev/). Run `task all` to run all code formatters, linters, and tests.\n\nThank you :heart:\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flife4%2Fdeal","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flife4%2Fdeal","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flife4%2Fdeal/lists"}