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.6.6";
20 pyproject = true;
21
22 disabled = pythonOlder "3.6";
23
24 src = fetchFromGitHub {
25 owner = "Parquery";
26 repo = "icontract";
27 rev = "refs/tags/v${version}";
28 hash = "sha256-R5/FBfuTvXItfTlNZMSnO18Q+etnHbQyXFWpaOpOLes=";
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
45 nativeCheckInputs = [
46 astor
47 asyncstdlib
48 deal
49 dpcontracts
50 numpy
51 pytestCheckHook
52 ];
53
54 disabledTests = [
55 # AssertionError
56 "test_abstract_method_not_implemented"
57 ];
58
59 disabledTestPaths = [
60 # mypy decorator checks don't pass. For some reason mypy
61 # doesn't check the python file provided in the test.
62 "tests/test_mypy_decorators.py"
63 # Those tests seems to simply re-run some typeguard tests
64 "tests/test_typeguard.py"
65 ];
66
67 pytestFlagsArray = [
68 # RuntimeWarning: coroutine '*' was never awaited
69 "-W"
70 "ignore::RuntimeWarning"
71 ];
72
73 pythonImportsCheck = [ "icontract" ];
74
75 meta = with lib; {
76 description = "Provide design-by-contract with informative violation messages";
77 homepage = "https://github.com/Parquery/icontract";
78 changelog = "https://github.com/Parquery/icontract/blob/v${version}/CHANGELOG.rst";
79 license = licenses.mit;
80 maintainers = with maintainers; [
81 gador
82 thiagokokada
83 ];
84 };
85}