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 [
58 # Tests need internet access
59 "test_smoke_has"
60 "test_pure_offline"
61 "test_raises_doesnt_override_another_contract"
62 "test_raises_doesnt_override_another_contract_async"
63 "test_raises_generator"
64 # AttributeError: module 'vaa' has no attribute 'Error'
65 "test_source_vaa_scheme"
66 "test_vaa_scheme_and_custom_exception"
67 "test_scheme_string_validation_args_correct"
68 "test_method_chain_decorator_with_scheme_is_fulfilled"
69 "test_scheme_contract_is_satisfied_when_setting_arg"
70 "test_scheme_contract_is_satisfied_within_chain"
71 "test_scheme_errors_rewrite_message"
72 # assert errors
73 "test_doctest"
74 "test_no_violations"
75 "test_source_get_lambda_multiline_splitted_dec"
76 # assert basically correct but fails in string match due to '' removed
77 "test_unknown_command"
78 ]
79 ++ lib.optional (pythonAtLeast "3.13") [
80 # assert basically correct but string match fails in due to
81 # ('pathlib._local', 'Path.write_text') != ('pathlib', 'Path.write_text')
82 "test_infer"
83 ];
84
85 disabledTestPaths = [
86 # Test needs internet access
87 "tests/test_runtime/test_offline.py"
88 # depends on typeguard <4.0.0 for tests, but >=4.0.0 seems fine for runtime
89 # https://github.com/life4/deal/blob/9be70fa1c5a0635880619b2cea83a9f6631eb236/pyproject.toml#L40
90 "tests/test_testing.py"
91 ];
92
93 pythonImportsCheck = [ "deal" ];
94
95 meta = with lib; {
96 description = "Library for design by contract (DbC) and checking values, exceptions, and side-effects";
97 longDescription = ''
98 In a nutshell, deal empowers you to write bug-free code.
99 By adding a few decorators to your code, you get for free tests, static analysis, formal verification,
100 and much more.
101 '';
102 homepage = "https://github.com/life4/deal";
103 changelog = "https://github.com/life4/deal/releases/tag/${version}";
104 license = licenses.mit;
105 maintainers = with maintainers; [ gador ];
106 };
107}