1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, fetchpatch
5, pythonOlder
6, pytestCheckHook
7, atpublic
8, click
9, clickhouse-cityhash
10, clickhouse-driver
11, dask
12, datafusion
13, duckdb
14, duckdb-engine
15, filelock
16, geoalchemy2
17, geopandas
18, graphviz-nox
19, lz4
20, multipledispatch
21, numpy
22, packaging
23, pandas
24, parsy
25, poetry-core
26, poetry-dynamic-versioning
27, psycopg2
28, pyarrow
29, pydantic
30, pymysql
31, pyspark
32, pytest-benchmark
33, pytest-randomly
34, pytest-mock
35, pytest-xdist
36, python
37, pytz
38, regex
39, rich
40, rsync
41, shapely
42, sqlalchemy
43, sqlglot
44, sqlite
45, toolz
46}:
47let
48 testBackends = [
49 "datafusion"
50 "duckdb"
51 "pandas"
52 "sqlite"
53 ];
54
55 ibisTestingData = fetchFromGitHub {
56 owner = "ibis-project";
57 repo = "testing-data";
58 rev = "3c39abfdb4b284140ff481e8f9fbb128b35f157a";
59 sha256 = "sha256-BZWi4kEumZemQeYoAtlUSw922p+R6opSWp/bmX0DjAo=";
60 };
61in
62
63buildPythonPackage rec {
64 pname = "ibis-framework";
65 version = "3.2.0";
66 format = "pyproject";
67
68 disabled = pythonOlder "3.8";
69
70 src = fetchFromGitHub {
71 repo = "ibis";
72 owner = "ibis-project";
73 rev = version;
74 hash = "sha256-YRP1nGJs4btqXQirm0GfEDKNPCVXexVrwQ6sE8JtD2o=";
75 };
76
77 nativeBuildInputs = [ poetry-core ];
78
79 propagatedBuildInputs = [
80 atpublic
81 multipledispatch
82 numpy
83 packaging
84 pandas
85 parsy
86 poetry-dynamic-versioning
87 pydantic
88 pytz
89 regex
90 rich
91 toolz
92 ];
93
94 checkInputs = [
95 pytestCheckHook
96 click
97 filelock
98 pytest-benchmark
99 pytest-mock
100 pytest-randomly
101 pytest-xdist
102 rsync
103 ] ++ lib.concatMap (name: passthru.optional-dependencies.${name}) testBackends;
104
105 preBuild = ''
106 # setup.py exists only for developer convenience and is automatically generated
107 # it gets in the way in nixpkgs so we remove it
108 rm setup.py
109 '';
110
111 pytestFlagsArray = [
112 "--dist=loadgroup"
113 "-m"
114 "'${lib.concatStringsSep " or " testBackends} or core'"
115 # this test fails on nixpkgs datafusion version (0.4.0), but works on
116 # datafusion 0.6.0
117 "-k"
118 "'not datafusion-no_op'"
119 ];
120
121 preCheck = ''
122 set -eo pipefail
123
124 export IBIS_TEST_DATA_DIRECTORY
125 IBIS_TEST_DATA_DIRECTORY="ci/ibis-testing-data"
126
127 mkdir -p "$IBIS_TEST_DATA_DIRECTORY"
128
129 # copy the test data to a directory
130 rsync --chmod=Du+rwx,Fu+rw --archive "${ibisTestingData}/" "$IBIS_TEST_DATA_DIRECTORY"
131 '';
132
133 postCheck = ''
134 rm -r "$IBIS_TEST_DATA_DIRECTORY"
135 '';
136
137 pythonImportsCheck = [
138 "ibis"
139 ] ++ map (backend: "ibis.backends.${backend}") testBackends;
140
141 passthru = {
142 optional-dependencies = {
143 clickhouse = [ clickhouse-cityhash clickhouse-driver lz4 sqlglot ];
144 dask = [ dask pyarrow ];
145 datafusion = [ datafusion ];
146 duckdb = [ duckdb duckdb-engine pyarrow sqlalchemy sqlglot ];
147 geospatial = [ geoalchemy2 geopandas shapely ];
148 mysql = [ sqlalchemy pymysql sqlglot ];
149 pandas = [ ];
150 postgres = [ psycopg2 sqlalchemy sqlglot ];
151 pyspark = [ pyarrow pyspark ];
152 sqlite = [ sqlalchemy sqlite sqlglot ];
153 visualization = [ graphviz-nox ];
154 };
155 };
156
157 meta = with lib; {
158 description = "Productivity-centric Python Big Data Framework";
159 homepage = "https://github.com/ibis-project/ibis";
160 license = licenses.asl20;
161 maintainers = with maintainers; [ costrouc cpcloud ];
162 };
163}