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