1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, ipython
6, ipython_genutils
7, pandas
8, prettytable
9, pytest
10, sqlalchemy
11, sqlparse
12}:
13buildPythonPackage rec {
14 pname = "ipython-sql";
15 version = "0.4.0";
16
17 disabled = pythonOlder "3.7";
18
19 src = fetchFromGitHub {
20 owner = "catherinedevlin";
21 repo = "ipython-sql";
22 rev = "117764caf099d80100ed4b09fc004b55eed6f121";
23 hash = "sha256-ScQihsvRSnC7VIgy8Tzi1z4x6KIZo0SAeLPvHAVdrfA=";
24 };
25
26 postPatch = ''
27 substituteInPlace setup.py --replace 'prettytable<1' prettytable
28 '';
29
30 propagatedBuildInputs = [
31 ipython
32 ipython_genutils
33 prettytable
34 sqlalchemy
35 sqlparse
36 ];
37
38 checkInputs = [ ipython pandas pytest ];
39
40 checkPhase = ''
41 runHook preCheck
42
43 # running with ipython is required because the tests use objects available
44 # only inside of ipython, for example the global `get_ipython()` function
45 ipython -c 'import pytest; pytest.main()'
46
47 runHook postCheck
48 '';
49
50 pythonImportsCheck = [ "sql" ];
51
52 meta = with lib; {
53 description = "Introduces a %sql (or %%sql) magic.";
54 homepage = "https://github.com/catherinedevlin/ipython-sql";
55 license = licenses.mit;
56 maintainers = with maintainers; [ cpcloud ];
57 };
58}