From d00a690499aca48e2b9942921c4d1fb0e7e235f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Mat=C3=ADas=20Lang?= Date: Mon, 27 Jul 2020 02:08:08 -0300 Subject: [PATCH] pythonPackages.nplusone: init at 1.0.0 --- .../python-modules/nplusone/default.nix | 49 +++++++++++++++++++ pkgs/top-level/python-packages.nix | 2 + 2 files changed, 51 insertions(+) create mode 100644 pkgs/development/python-modules/nplusone/default.nix diff --git a/pkgs/development/python-modules/nplusone/default.nix b/pkgs/development/python-modules/nplusone/default.nix new file mode 100644 index 00000000000..c2f484cb3a9 --- /dev/null +++ b/pkgs/development/python-modules/nplusone/default.nix @@ -0,0 +1,49 @@ +{ blinker, buildPythonPackage, fetchFromGitHub, lib, isPy27, six, mock, pytest +, webtest, pytestcov, pytest-django, pytest-pythonpath, flake8, sqlalchemy +, flask_sqlalchemy, peewee }: + +buildPythonPackage rec { + pname = "nplusone"; + version = "1.0.0"; + disabled = isPy27; + + src = fetchFromGitHub { + owner = "jmcarp"; + repo = "nplusone"; + rev = "v${version}"; + sha256 = "0qdwpvvg7dzmksz3vqkvb27n52lq5sa8i06m7idnj5xk2dgjkdxg"; + }; + + # The tests assume the source code is in an nplusone/ directory. When using + # the Nix sandbox, it will be in a source/ directory instead, making the + # tests fail. + prePatch = '' + substituteInPlace tests/conftest.py \ + --replace nplusone/tests/conftest source/tests/conftest + ''; + + checkPhase = '' + pytest tests/ + ''; + + propagatedBuildInputs = [ six blinker ]; + checkInputs = [ + mock + pytest + webtest + pytestcov + pytest-django + pytest-pythonpath + flake8 + sqlalchemy + flask_sqlalchemy + peewee + ]; + + meta = with lib; { + description = "Detecting the n+1 queries problem in Python"; + homepage = "https://github.com/jmcarp/nplusone"; + maintainers = with maintainers; [ cript0nauta ]; + license = licenses.mit; + }; +} diff --git a/pkgs/top-level/python-packages.nix b/pkgs/top-level/python-packages.nix index 20a99b2a47c..4ac616e62eb 100644 --- a/pkgs/top-level/python-packages.nix +++ b/pkgs/top-level/python-packages.nix @@ -2566,6 +2566,8 @@ in { mxnet = callPackage ../development/python-modules/mxnet { }; + nplusone = callPackage ../development/python-modules/nplusone { }; + parsy = callPackage ../development/python-modules/parsy { }; portalocker = callPackage ../development/python-modules/portalocker { };