about summary refs log tree commit diff
path: root/pkgs/development/python-modules/jupysql/default.nix
blob: de21f76224e7ca402f6b40e4ef49d4b663b5e456 (plain) (blame)
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
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
{
  lib,
  buildPythonPackage,
  fetchFromGitHub,
  pythonOlder,
  setuptools,
  prettytable,
  sqlalchemy,
  sqlparse,
  ipython-genutils,
  jinja2,
  sqlglot,
  jupysql-plugin,
  ploomber-core,
  ploomber-extension,
  ipython,
  duckdb,
  duckdb-engine,
  matplotlib,
  polars,
  ipywidgets,
  numpy,
  pandas,
  js2py,
  pyspark,
  pyarrow,
  grpcio,
  pytestCheckHook,
  psutil,
}:

buildPythonPackage rec {
  pname = "jupysql";
  version = "0.10.11";

  pyproject = true;
  disabled = pythonOlder "3.7";

  src = fetchFromGitHub {
    owner = "ploomber";
    repo = "jupysql";
    rev = "refs/tags/${version}";
    hash = "sha256-A9zTjH+9RYKcgy4mI6uOMHOc46om06y1zK3IbxeVcWE=";
  };

  pythonRelaxDeps = [ "sqlalchemy" ];

  build-system = [ setuptools ];

  dependencies = [
    prettytable
    sqlalchemy
    sqlparse
    ipython-genutils
    jinja2
    sqlglot
    jupysql-plugin
    ploomber-core
    ploomber-extension
  ];

  optional-dependencies.dev = [
    ipython
    duckdb
    duckdb-engine
    matplotlib
    polars
    ipywidgets
    numpy
    pandas
    js2py
    pyspark
    pyarrow
    grpcio
  ];

  nativeCheckInputs = [
    pytestCheckHook
    psutil
  ] ++ optional-dependencies.dev;

  disabledTestPaths = [
    # require docker
    "src/tests/integration"

    # require network access
    "src/tests/test_telemetry.py"

    # want to download test data from the network
    "src/tests/test_parse.py"
    "src/tests/test_ggplot.py"
    "src/tests/test_plot.py"
    "src/tests/test_magic.py"
    "src/tests/test_magic_plot.py"
  ];

  preCheck = ''
    # tests need to write temp data
    export HOME=$(mktemp -d)
  '';

  pythonImportsCheck = [ "sql" ];

  meta = with lib; {
    description = "Better SQL in Jupyter";
    homepage = "https://github.com/ploomber/jupysql";
    changelog = "https://github.com/ploomber/jupysql/blob/${version}/CHANGELOG.md";
    license = licenses.asl20;
    maintainers = with maintainers; [ pacien ];
  };
}