1{ lib
2, buildPythonPackage
3, pythonOlder
4, fetchFromGitHub
5, flit-core
6, astroid
7, pytestCheckHook
8, docstring-parser
9, marshmallow
10, sphinx
11, hypothesis
12, vaa
13, deal-solver
14, pygments
15, typeguard
16, urllib3
17, flake8
18}:
19
20buildPythonPackage rec {
21 pname = "deal";
22 version = "4.24.0";
23 format = "pyproject";
24 disabled = pythonOlder "3.7";
25
26 src = fetchFromGitHub {
27 owner = "life4";
28 repo = pname;
29 rev = "refs/tags/${version}";
30 hash = "sha256-5gd46SMucH0rek9talMJ74TMRRvUm5Up6pCusUIHDjE=";
31 };
32
33 postPatch = ''
34 # don't do coverage
35 substituteInPlace pyproject.toml \
36 --replace "\"--cov-fail-under=100\"," "" \
37 --replace "\"--cov=deal\"," "" \
38 --replace "\"--cov-report=html\"," "" \
39 --replace "\"--cov-report=term-missing:skip-covered\"," ""
40 '';
41
42 nativeBuildInputs = [
43 flit-core
44 ];
45
46 propagatedBuildInputs = [
47 astroid
48 deal-solver
49 pygments
50 typeguard
51 ];
52
53 nativeCheckInputs = [
54 pytestCheckHook
55
56 docstring-parser
57 marshmallow
58 sphinx
59 hypothesis
60 vaa
61 urllib3
62 flake8
63 ];
64
65 disabledTests = [
66 # needs internet access
67 "test_smoke_has"
68 "test_pure_offline"
69 "test_raises_doesnt_override_another_contract"
70 "test_raises_doesnt_override_another_contract_async"
71 "test_raises_generator"
72 # AttributeError: module 'vaa' has no attribute 'Error'
73 "test_source_vaa_scheme"
74 "test_vaa_scheme_and_custom_exception"
75 "test_scheme_string_validation_args_correct"
76 "test_method_chain_decorator_with_scheme_is_fulfilled"
77 "test_scheme_contract_is_satisfied_when_setting_arg"
78 "test_scheme_contract_is_satisfied_within_chain"
79 "test_scheme_errors_rewrite_message"
80 # broken since pytest > 7.1.3
81 "test_exception_hook"
82 ];
83
84 disabledTestPaths = [
85 # needs internet access
86 "tests/test_runtime/test_offline.py"
87 ];
88
89 pythonImportsCheck = [ "deal" ];
90
91 meta = with lib; {
92 description = "Library for design by contract (DbC) and checking values, exceptions, and side-effects";
93 longDescription = ''
94 In a nutshell, deal empowers you to write bug-free code.
95 By adding a few decorators to your code, you get for free tests, static analysis, formal verification, and much more
96 '';
97 homepage = "https://github.com/life4/deal";
98 license = licenses.mit;
99 maintainers = with maintainers; [ gador ];
100 };
101}