1{
2 lib,
3 stdenv,
4 buildPythonPackage,
5 fetchFromGitHub,
6
7 # build-system
8 setuptools,
9
10 # dependencies
11 ipython-genutils,
12 jinja2,
13 jupysql-plugin,
14 ploomber-core,
15 prettytable,
16 sqlalchemy,
17 sqlglot,
18 sqlparse,
19
20 # optional-dependencies
21 duckdb,
22 duckdb-engine,
23 grpcio,
24 ipython,
25 ipywidgets,
26 matplotlib,
27 numpy,
28 pandas,
29 polars,
30 pyarrow,
31 pyspark,
32
33 # tests
34 pytestCheckHook,
35 psutil,
36 writableTmpDirAsHomeHook,
37}:
38
39buildPythonPackage rec {
40 pname = "jupysql";
41 version = "0.11.1";
42
43 pyproject = true;
44
45 src = fetchFromGitHub {
46 owner = "ploomber";
47 repo = "jupysql";
48 tag = version;
49 hash = "sha256-7wfKvKqDf8LlUiLoevNRxmq8x5wLheOgIeWz72oFcuw=";
50 };
51
52 pythonRelaxDeps = [ "sqlalchemy" ];
53
54 build-system = [ setuptools ];
55
56 dependencies = [
57 ipython-genutils
58 jinja2
59 jupysql-plugin
60 ploomber-core
61 prettytable
62 sqlalchemy
63 sqlglot
64 sqlparse
65 ];
66
67 optional-dependencies.dev = [
68 duckdb
69 duckdb-engine
70 grpcio
71 ipython
72 ipywidgets
73 matplotlib
74 numpy
75 pandas
76 polars
77 pyarrow
78 pyspark
79 ];
80
81 nativeCheckInputs = [
82 pytestCheckHook
83 psutil
84 writableTmpDirAsHomeHook
85 ]
86 ++ optional-dependencies.dev;
87
88 disabledTests = [
89 # AttributeError: 'DataFrame' object has no attribute 'frame_equal'
90 "test_resultset_polars_dataframe"
91
92 # all of these are broken with later versions of duckdb; see
93 # https://github.com/ploomber/jupysql/issues/1030
94 "test_resultset_getitem"
95 "test_resultset_dict"
96 "test_resultset_len"
97 "test_resultset_dicts"
98 "test_resultset_dataframe"
99 "test_resultset_csv"
100 "test_resultset_str"
101 "test_resultset_repr_html_when_feedback_is_2"
102 "test_resultset_repr_html_with_reduced_feedback"
103 "test_invalid_operation_error"
104 "test_resultset_config_autolimit_dict"
105
106 # fails due to strict warnings
107 "test_calling_legacy_plotting_functions_displays_warning"
108 ]
109 ++ lib.optionals stdenv.hostPlatform.isDarwin [
110 # RuntimeError: *** -[__NSPlaceholderArray initWithObjects:count:]: attempt to insert nil object from objects[1]
111 "test_no_errors_with_stored_query"
112 ];
113
114 disabledTestPaths = [
115 # require docker
116 "src/tests/integration"
117
118 # want to download test data from the network
119 "src/tests/test_parse.py"
120 "src/tests/test_ggplot.py"
121 "src/tests/test_plot.py"
122 "src/tests/test_magic.py"
123 "src/tests/test_magic_plot.py"
124
125 # require js2py (which is unmaintained and insecure)
126 "src/tests/test_widget.py"
127 ];
128
129 pythonImportsCheck = [ "sql" ];
130
131 meta = {
132 description = "Better SQL in Jupyter";
133 homepage = "https://github.com/ploomber/jupysql";
134 changelog = "https://github.com/ploomber/jupysql/blob/${version}/CHANGELOG.md";
135 license = lib.licenses.asl20;
136 maintainers = with lib.maintainers; [ euxane ];
137 };
138}