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.2";
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-bdIoKOOC7qSer9Cp9A55HG960xunKXT2WiXp0UC6tsI=";
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 # assert errors
81 "test_doctest"
82 "test_no_violations"
83 ];
84
85 disabledTestPaths = [
86 # 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, and much more
100 '';
101 homepage = "https://github.com/life4/deal";
102 license = licenses.mit;
103 maintainers = with maintainers; [ gador ];
104 };
105}