about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorSandro <sandro.jaeckel@gmail.com>2022-05-28 21:39:15 +0200
committerGitHub <noreply@github.com>2022-05-28 21:39:15 +0200
commit05bacb0c3098cbb0fb6397b73b656da92a54ca0a (patch)
tree5261c46d42254f1fbee9e785df59396eea4fc4e7 /pkgs/development
parent793f99c48e3a6d6b47e88deb20ff6171e7971977 (diff)
parent17ce82cf813ac83c0a3f7f45f6687b03a243186d (diff)
Merge pull request #173140 from gador/init-icontract
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/python-modules/dpcontracts/default.nix31
-rw-r--r--pkgs/development/python-modules/icontract/default.nix78
2 files changed, 109 insertions, 0 deletions
diff --git a/pkgs/development/python-modules/dpcontracts/default.nix b/pkgs/development/python-modules/dpcontracts/default.nix
new file mode 100644
index 0000000000000..5a6491b7ee094
--- /dev/null
+++ b/pkgs/development/python-modules/dpcontracts/default.nix
@@ -0,0 +1,31 @@
+{ lib
+, buildPythonPackage
+, pythonOlder
+, fetchFromGitHub
+}:
+
+buildPythonPackage rec {
+  pname = "dpcontracts";
+  version = "unstable-2018-11-20";
+  format = "setuptools";
+  disabled = pythonOlder "3.5";
+
+  src = fetchFromGitHub {
+    owner = "deadpixi";
+    repo = "contracts";
+    rev = "45cb8542272c2ebe095c6efb97aa9407ddc8bf3c";
+    hash = "sha256-FygJPXo7lZ9tlfqY6KmPJ3PLIilMGLBr3013uj9hCEs=";
+  };
+
+  # package does not have any tests
+  doCheck = false;
+
+  pythonImportsCheck = [ "dpcontracts" ];
+
+  meta = with lib; {
+    description = "Provides a collection of decorators that makes it easy to write software using contracts";
+    homepage = "https://github.com/deadpixi/contracts";
+    license = licenses.lgpl3Only;
+    maintainers = with maintainers; [ gador ];
+  };
+}
diff --git a/pkgs/development/python-modules/icontract/default.nix b/pkgs/development/python-modules/icontract/default.nix
new file mode 100644
index 0000000000000..7b7d20ce17f06
--- /dev/null
+++ b/pkgs/development/python-modules/icontract/default.nix
@@ -0,0 +1,78 @@
+{ lib
+, buildPythonPackage
+, pythonOlder
+, fetchFromGitHub
+, asttokens
+, typing-extensions
+, pytestCheckHook
+, yapf
+, docutils
+, pygments
+, dpcontracts
+, tabulate
+, py-cpuinfo
+, typeguard
+, astor
+, numpy
+, asyncstdlib
+}:
+
+buildPythonPackage rec {
+  pname = "icontract";
+  version = "2.6.1";
+  format = "setuptools";
+  disabled = pythonOlder "3.6";
+
+  src = fetchFromGitHub {
+    owner = "Parquery";
+    repo = pname;
+    rev = "refs/tags/v${version}";
+    hash = "sha256-QyuegyjVyRLQS0DjBJXpTDNeBM7LigGJ5cztVOO7e3Y=";
+  };
+
+  preCheck = ''
+    # we don't want to use the precommit.py script to build the package.
+    # For the tests to succeed, "ICONTRACT_SLOW" needs to be set.
+    # see https://github.com/Parquery/icontract/blob/aaeb1b06780a34b05743377e4cb2458780e808d3/precommit.py#L57
+    export ICONTRACT_SLOW=1
+  '';
+
+
+  propagatedBuildInputs = [
+    asttokens
+    typing-extensions
+  ];
+
+  checkInputs = [
+    pytestCheckHook
+    yapf
+    docutils
+    pygments
+    dpcontracts
+    tabulate
+    py-cpuinfo
+    typeguard
+    astor
+    numpy
+    asyncstdlib
+  ];
+
+  disabledTestPaths = [
+    # needs an old version of deal to comply with the tests
+    # see https://github.com/Parquery/icontract/issues/244
+    "tests_with_others/test_deal.py"
+    # mypy decorator checks don't pass. For some reaseon mypy
+    # doesn't check the python file provided in the test.
+    "tests/test_mypy_decorators.py"
+  ];
+
+  pythonImportsCheck = [ "icontract" ];
+
+  meta = with lib; {
+    description = "Provide design-by-contract with informative violation messages";
+    homepage = "https://github.com/Parquery/icontract";
+    changelog = "https://github.com/Parquery/icontract/blob/master/CHANGELOG.rst";
+    license = licenses.mit;
+    maintainers = with maintainers; [ gador ];
+  };
+}