1{
2 lib,
3 astroid,
4 buildPythonPackage,
5 deal-solver,
6 docstring-parser,
7 fetchFromGitHub,
8 flit-core,
9 hypothesis,
10 marshmallow,
11 pygments,
12 pytest-cov-stub,
13 pytestCheckHook,
14 pythonOlder,
15 pythonAtLeast,
16 sphinx,
17 typeguard,
18 urllib3,
19 vaa,
20}:
21
22buildPythonPackage rec {
23 pname = "deal";
24 version = "4.24.5";
25 pyproject = true;
26
27 disabled = pythonOlder "3.7";
28
29 src = fetchFromGitHub {
30 owner = "life4";
31 repo = "deal";
32 tag = version;
33 hash = "sha256-oSvLi+9JYnwilJa63MuGb2iir2Mjr3UewzpPLCtOVzs=";
34 };
35
36 build-system = [ flit-core ];
37
38 dependencies = [
39 astroid
40 deal-solver
41 pygments
42 typeguard
43 ];
44
45 nativeCheckInputs = [
46 docstring-parser
47 hypothesis
48 marshmallow
49 pytest-cov-stub
50 pytestCheckHook
51 sphinx
52 urllib3
53 vaa
54 ];
55
56 disabledTests = [
57 # Tests need internet access
58 "test_smoke_has"
59 "test_pure_offline"
60 "test_raises_doesnt_override_another_contract"
61 "test_raises_doesnt_override_another_contract_async"
62 "test_raises_generator"
63 # AttributeError: module 'vaa' has no attribute 'Error'
64 "test_source_vaa_scheme"
65 "test_vaa_scheme_and_custom_exception"
66 "test_scheme_string_validation_args_correct"
67 "test_method_chain_decorator_with_scheme_is_fulfilled"
68 "test_scheme_contract_is_satisfied_when_setting_arg"
69 "test_scheme_contract_is_satisfied_within_chain"
70 "test_scheme_errors_rewrite_message"
71 # assert errors
72 "test_doctest"
73 "test_no_violations"
74 "test_source_get_lambda_multiline_splitted_dec"
75 # assert basically correct but fails in string match due to '' removed
76 "test_unknown_command"
77 ]
78 ++ lib.optional (pythonAtLeast "3.13") [
79 # assert basically correct but string match fails in due to
80 # ('pathlib._local', 'Path.write_text') != ('pathlib', 'Path.write_text')
81 "test_infer"
82 ];
83
84 disabledTestPaths = [
85 # Test needs internet access
86 "tests/test_runtime/test_offline.py"
87 # depends on typeguard <4.0.0 for tests, but >=4.0.0 seems fine for runtime
88 # https://github.com/life4/deal/blob/9be70fa1c5a0635880619b2cea83a9f6631eb236/pyproject.toml#L40
89 "tests/test_testing.py"
90 ];
91
92 pythonImportsCheck = [ "deal" ];
93
94 meta = with lib; {
95 description = "Library for design by contract (DbC) and checking values, exceptions, and side-effects";
96 longDescription = ''
97 In a nutshell, deal empowers you to write bug-free code.
98 By adding a few decorators to your code, you get for free tests, static analysis, formal verification,
99 and much more.
100 '';
101 homepage = "https://github.com/life4/deal";
102 changelog = "https://github.com/life4/deal/releases/tag/${version}";
103 license = licenses.mit;
104 maintainers = with maintainers; [ gador ];
105 };
106}