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