1{
2 lib,
3 astor,
4 asttokens,
5 asyncstdlib,
6 buildPythonPackage,
7 deal,
8 dpcontracts,
9 fetchFromGitHub,
10 numpy,
11 pytestCheckHook,
12 pythonOlder,
13 setuptools,
14 typing-extensions,
15}:
16
17buildPythonPackage rec {
18 pname = "icontract";
19 version = "2.7.1";
20 pyproject = true;
21
22 disabled = pythonOlder "3.6";
23
24 src = fetchFromGitHub {
25 owner = "Parquery";
26 repo = "icontract";
27 tag = "v${version}";
28 hash = "sha256-7mRQ1g2mllHIaZh0jEd/iCgaDja1KJXuRnamhDo/Pbo=";
29 };
30
31 preCheck = ''
32 # we don't want to use the precommit.py script to build the package.
33 # For the tests to succeed, "ICONTRACT_SLOW" needs to be set.
34 # see https://github.com/Parquery/icontract/blob/aaeb1b06780a34b05743377e4cb2458780e808d3/precommit.py#L57
35 export ICONTRACT_SLOW=1
36 '';
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 asttokens
42 typing-extensions
43 ];
44 pythonRelaxDeps = [
45 "asttokens"
46 ];
47
48 nativeCheckInputs = [
49 astor
50 asyncstdlib
51 deal
52 dpcontracts
53 numpy
54 pytestCheckHook
55 ];
56
57 disabledTests = [
58 # AssertionError
59 "test_abstract_method_not_implemented"
60 ];
61
62 disabledTestPaths = [
63 # mypy decorator checks don't pass. For some reason mypy
64 # doesn't check the python file provided in the test.
65 "tests/test_mypy_decorators.py"
66 # Those tests seems to simply re-run some typeguard tests
67 "tests/test_typeguard.py"
68 ];
69
70 pytestFlags = [
71 # RuntimeWarning: coroutine '*' was never awaited
72 "-Wignore::RuntimeWarning"
73 ];
74
75 pythonImportsCheck = [ "icontract" ];
76
77 meta = with lib; {
78 description = "Provide design-by-contract with informative violation messages";
79 homepage = "https://github.com/Parquery/icontract";
80 changelog = "https://github.com/Parquery/icontract/blob/v${version}/CHANGELOG.rst";
81 license = licenses.mit;
82 maintainers = with maintainers; [
83 gador
84 thiagokokada
85 ];
86 };
87}