nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
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 pythonAtLeast,
15 sphinx,
16 typeguard,
17 urllib3,
18 vaa,
19}:
20
21buildPythonPackage rec {
22 pname = "deal";
23 version = "4.24.6";
24 pyproject = true;
25
26 src = fetchFromGitHub {
27 owner = "life4";
28 repo = "deal";
29 tag = version;
30 hash = "sha256-nLZ06Xfa9Q+Saf8qPXG1Xo6y6oO6kifhfK/gryZ6q90=";
31 };
32
33 build-system = [ flit-core ];
34
35 dependencies = [
36 astroid
37 deal-solver
38 pygments
39 typeguard
40 ];
41
42 nativeCheckInputs = [
43 docstring-parser
44 hypothesis
45 marshmallow
46 pytest-cov-stub
47 pytestCheckHook
48 sphinx
49 urllib3
50 vaa
51 ];
52
53 disabledTests = [
54 # Tests need internet access
55 "test_smoke_has"
56 "test_pure_offline"
57 "test_raises_doesnt_override_another_contract"
58 "test_raises_doesnt_override_another_contract_async"
59 "test_raises_generator"
60 # AttributeError: module 'vaa' has no attribute 'Error'
61 "test_source_vaa_scheme"
62 "test_vaa_scheme_and_custom_exception"
63 "test_scheme_string_validation_args_correct"
64 "test_method_chain_decorator_with_scheme_is_fulfilled"
65 "test_scheme_contract_is_satisfied_when_setting_arg"
66 "test_scheme_contract_is_satisfied_within_chain"
67 "test_scheme_errors_rewrite_message"
68 # assert errors
69 "test_doctest"
70 "test_no_violations"
71 "test_source_get_lambda_multiline_splitted_dec"
72 # assert basically correct but fails in string match due to '' removed
73 "test_unknown_command"
74 ]
75 ++ lib.optional (pythonAtLeast "3.13") [
76 # assert basically correct but string match fails in due to
77 # ('pathlib._local', 'Path.write_text') != ('pathlib', 'Path.write_text')
78 "test_infer"
79 ];
80
81 disabledTestPaths = [
82 # Test needs internet access
83 "tests/test_runtime/test_offline.py"
84 # depends on typeguard <4.0.0 for tests, but >=4.0.0 seems fine for runtime
85 # https://github.com/life4/deal/blob/9be70fa1c5a0635880619b2cea83a9f6631eb236/pyproject.toml#L40
86 "tests/test_testing.py"
87 ];
88
89 pythonImportsCheck = [ "deal" ];
90
91 meta = {
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,
96 and much more.
97 '';
98 homepage = "https://github.com/life4/deal";
99 changelog = "https://github.com/life4/deal/releases/tag/${version}";
100 license = lib.licenses.mit;
101 maintainers = with lib.maintainers; [ gador ];
102 };
103}