deal
🤝 Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.
Science Score: 26.0%
This score indicates how likely this project is to be science-related based on various indicators:
-
○CITATION.cff file
-
✓codemeta.json file
Found codemeta.json file -
✓.zenodo.json file
Found .zenodo.json file -
○DOI references
-
○Academic publication links
-
○Committers with academic emails
-
○Institutional organization owner
-
○JOSS paper metadata
-
○Scientific vocabulary similarity
Low similarity (13.4%) to scientific vocabulary
Keywords
Keywords from Contributors
Repository
🤝 Design by contract for Python. Write bug-free code. Add a few decorators, get static analysis and tests for free.
Basic Info
- Host: GitHub
- Owner: life4
- License: mit
- Language: Python
- Default Branch: master
- Homepage: https://deal.readthedocs.io/
- Size: 1.95 MB
Statistics
- Stars: 826
- Watchers: 13
- Forks: 33
- Open Issues: 5
- Releases: 44
Topics
Metadata Files
README.md
A Python library for 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 to get started.
Features
- Classic DbC: precondition, postcondition, invariant.
- Tracking exceptions and side-effects.
- Property-based testing.
- Static checker.
- Integration with pytest, flake8, sphinx, 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 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: 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.
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 lintorflake8to statically check errors. - Run
python3 -m deal testorpytestto generate and run tests. - Just use the function in the project and check errors in runtime.
Read more in the documentation.
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. Run task all to run all code formatters, linters, and tests.
Thank you :heart:
Owner
- Name: Life4
- Login: life4
- Kind: organization
- Website: https://orsinium.dev/
- Repositories: 14
- Profile: https://github.com/life4
Big and cool projects by @orsinium. See also @orsinium-labs.
GitHub Events
Total
- Release event: 1
- Watch event: 75
- Delete event: 2
- Issue comment event: 16
- Push event: 12
- Pull request review event: 6
- Pull request review comment event: 6
- Pull request event: 11
- Fork event: 6
- Create event: 2
Last Year
- Release event: 1
- Watch event: 75
- Delete event: 2
- Issue comment event: 16
- Push event: 12
- Pull request review event: 6
- Pull request review comment event: 6
- Pull request event: 11
- Fork event: 6
- Create event: 2
Committers
Last synced: 9 months ago
Top Committers
| Name | Commits | |
|---|---|---|
| Gram | m****s@m****u | 1,099 |
| Ryan Delaney | r****y@p****m | 14 |
| sobolevn | m****l@s****e | 6 |
| Ryan Delaney | r****b@p****m | 5 |
| Max Caldwell | m****x@s****i | 3 |
| aleien | a****n@y****u | 3 |
| Isidro Arias | i****s@h****s | 2 |
| Ryan Delaney | r****t@p****m | 2 |
| Devon Richards | f****n@g****m | 1 |
| Jacob Sánchez | j****z@p****m | 1 |
| Spencer Williams | s****i@g****m | 1 |
| Vishal Sodani | v****i@r****m | 1 |
| Waleed Mebane | 5****e | 1 |
| jgberry | j****e@g****m | 1 |
| Sergey Sokolov | d****7@y****u | 1 |
| Panashe M. Fundira | p****e@d****m | 1 |
| toonarmycaptain | t****n@h****m | 1 |
| Иннокентий Садыков | i****5@g****m | 1 |
| Luis Durão | k****x@m****m | 1 |
Committer Domains (Top 20 + Academic)
Issues and Pull Requests
Last synced: 6 months ago
All Time
- Total issues: 0
- Total pull requests: 113
- Average time to close issues: N/A
- Average time to close pull requests: 9 days
- Total issue authors: 0
- Total pull request authors: 18
- Average comments per issue: 0
- Average comments per pull request: 1.14
- Merged pull requests: 107
- Bot issues: 0
- Bot pull requests: 0
Past Year
- Issues: 0
- Pull requests: 4
- Average time to close issues: N/A
- Average time to close pull requests: 12 days
- Issue authors: 0
- Pull request authors: 4
- Average comments per issue: 0
- Average comments per pull request: 3.5
- Merged pull requests: 3
- Bot issues: 0
- Bot pull requests: 0
Top Authors
Issue Authors
Pull Request Authors
- orsinium (90)
- rpdelaney (8)
- maxtheman (4)
- TheDSCPL (2)
- isidroas (2)
- qnbhd (2)
- sobolevn (2)
- FedericoCeratto (2)
- toonarmycaptain (1)
- dutyrok (1)
- vishalsodani (1)
- ruler501 (1)
- aleien (1)
- waleedmebane (1)
- munyari (1)
Top Labels
Issue Labels
Pull Request Labels
Packages
- Total packages: 1
-
Total downloads:
- pypi 43,587 last-month
- Total docker downloads: 197
- Total dependent packages: 9
- Total dependent repositories: 28
- Total versions: 67
- Total maintainers: 2
pypi.org: deal
**Deal** is a Python library for [design by contract][wiki] (DbC) programming.
- Documentation: https://deal.readthedocs.io/
- License: MIT License
-
Latest release: 4.24.5
published 12 months ago
