nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{ lib
2, buildPythonPackage
3, fetchFromGitHub
4, pythonOlder
5, pytestCheckHook
6, atpublic
7, cached-property
8, click
9, clickhouse-cityhash
10, clickhouse-driver
11, dask
12, datafusion
13, duckdb
14, duckdb-engine
15, geoalchemy2
16, geopandas
17, graphviz-nox
18, importlib-metadata
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, shapely
40, sqlalchemy
41, sqlite
42, tabulate
43, toolz
44}:
45let
46 testBackends = [
47 "dask"
48 "datafusion"
49 "duckdb"
50 "pandas"
51 "sqlite"
52 ];
53
54 ibisTestingData = fetchFromGitHub {
55 owner = "ibis-project";
56 repo = "testing-data";
57 rev = "a88a4b3c3b54a88e7f77e59de70f5bf20fb62f19";
58 sha256 = "sha256-BnRhVwPcWFwiBJ2ySgiiuUdnF4gesnTq1/dLcuvc868=";
59 };
60in
61
62buildPythonPackage rec {
63 pname = "ibis-framework";
64 version = "3.0.2";
65 format = "pyproject";
66
67 disabled = pythonOlder "3.8";
68
69 src = fetchFromGitHub {
70 repo = "ibis";
71 owner = "ibis-project";
72 rev = version;
73 hash = "sha256-7ywDMAHQAl39kiHfxVkq7voUEKqbb9Zq8qlaug7+ukI=";
74 };
75
76 nativeBuildInputs = [ poetry-core ];
77
78 propagatedBuildInputs = [
79 atpublic
80 cached-property
81 importlib-metadata
82 multipledispatch
83 numpy
84 packaging
85 pandas
86 parsy
87 poetry-dynamic-versioning
88 pydantic
89 pytz
90 regex
91 tabulate
92 toolz
93 ];
94
95 checkInputs = [
96 pytestCheckHook
97 click
98 pytest-benchmark
99 pytest-mock
100 pytest-randomly
101 pytest-xdist
102 ] ++ lib.concatMap (name: passthru.optional-dependencies.${name}) testBackends;
103
104 preBuild = ''
105 # setup.py exists only for developer convenience and is automatically generated
106 rm setup.py
107 '';
108
109 pytestFlagsArray = [
110 "--dist=loadgroup"
111 "-m"
112 "'${lib.concatStringsSep " or " testBackends} or core'"
113 ];
114
115 preCheck = ''
116 set -eo pipefail
117
118 export IBIS_TEST_DATA_DIRECTORY
119 IBIS_TEST_DATA_DIRECTORY="$(mktemp -d)"
120
121 # copy the test data to a writable directory
122 cp -r ${ibisTestingData}/* "$IBIS_TEST_DATA_DIRECTORY"
123
124 find "$IBIS_TEST_DATA_DIRECTORY" -type d -exec chmod u+rwx {} +
125 find "$IBIS_TEST_DATA_DIRECTORY" -type f -exec chmod u+rw {} +
126
127 # load data
128 for backend in ${lib.concatStringsSep " " testBackends}; do
129 ${python.interpreter} ci/datamgr.py load "$backend"
130 done
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 ];
144 dask = [ dask pyarrow ];
145 datafusion = [ datafusion ];
146 duckdb = [ duckdb duckdb-engine sqlalchemy ];
147 geospatial = [ geoalchemy2 geopandas shapely ];
148 mysql = [ pymysql sqlalchemy ];
149 pandas = [ ];
150 postgres = [ psycopg2 sqlalchemy ];
151 pyspark = [ pyarrow pyspark ];
152 sqlite = [ sqlalchemy sqlite ];
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}