aboutsummaryrefslogtreecommitdiff
path: root/nixpkgs/pkgs/development/python-modules/datasette/default.nix
blob: b5d9c3dfad6a895e87281db20731e5c7432a6ba7 (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
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
{ lib
, buildPythonPackage
, fetchFromGitHub
, aiofiles
, click
, click-default-group
, janus
, jinja2
, hupper
, pint
, pluggy
, uvicorn
# Check Inputs
, pytestCheckHook
, pytestrunner
, pytest-asyncio
, black
, aiohttp
, beautifulsoup4
, asgiref
, setuptools
}:

buildPythonPackage rec {
  pname = "datasette";
  version = "0.39";

  src = fetchFromGitHub {
    owner = "simonw";
    repo = "datasette";
    rev = version;
    sha256 = "07d46512bc9sdan9lv39sf1bwlf7vf1bfhcsm825vk7sv7g9kczd";
  };

  nativeBuildInputs = [ pytestrunner ];

  propagatedBuildInputs = [
    aiofiles
    click
    click-default-group
    janus
    jinja2
    hupper
    pint
    pluggy
    uvicorn
    setuptools
  ];

  checkInputs = [
    pytestCheckHook
    pytest-asyncio
    aiohttp
    beautifulsoup4
    black
    asgiref
  ];

  postConfigure = ''
    substituteInPlace setup.py \
      --replace "click~=7.1.1" "click" \
      --replace "click-default-group~=1.2.2" "click-default-group" \
      --replace "Jinja2~=2.10.3" "Jinja2" \
      --replace "hupper~=1.9" "hupper" \
      --replace "pint~=0.9" "pint" \
      --replace "pluggy~=0.13.0" "pint" \
      --replace "uvicorn~=0.11" "uvicorn" \
      --replace "aiofiles~=0.4.0" "aiofiles" \
      --replace "janus~=0.4.0" "janus" \
      --replace "PyYAML~=5.3" "PyYAML"
  '';

  # many tests require network access
  # test_black fails on darwin
  dontUseSetuptoolsCheck = true;
  pytestFlagsArray = [
    "--ignore=tests/test_api.py"
    "--ignore=tests/test_csv.py"
    "--ignore=tests/test_html.py"
    "--ignore=tests/test_docs.py"
    "--ignore=tests/test_black.py"
  ];
  disabledTests = [
    "facet"
    "_invalid_database" # checks error message when connecting to invalid database
  ];

  meta = with lib; {
    description = "An instant JSON API for your SQLite databases";
    homepage = "https://github.com/simonw/datasette";
    license = licenses.asl20;
    maintainers = [ maintainers.costrouc ];
  };

}