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.2";
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-NUgMt/o9EpSQyOiAhYBVJtQKJn0Pd2lI45bKlo2z7mk=";
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 checkInputs = [
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 ];
54
55 # Upstream adds some plain text files direct to the package's root directory
56 # https://github.com/Parquery/icontract/blob/master/setup.py#L63
57 postInstall = ''
58 rm -f $out/{LICENSE.txt,README.rst,requirements.txt}
59 '';
60
61 pythonImportsCheck = [ "icontract" ];
62
63 meta = with lib; {
64 description = "Provide design-by-contract with informative violation messages";
65 homepage = "https://github.com/Parquery/icontract";
66 changelog = "https://github.com/Parquery/icontract/blob/v${version}/CHANGELOG.rst";
67 license = licenses.mit;
68 maintainers = with maintainers; [ gador thiagokokada ];
69 };
70}