aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/python-modules/nplusone/default.nix
blob: c2f484cb3a92dd4230c8388671c6165b9129ca55 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
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;
  };
}