1{
2 lib,
3 buildPythonPackage,
4 fetchFromGitHub,
5 hatchling,
6 attrs,
7 chardet,
8 humanize,
9 isodate,
10 jinja2,
11 jsonschema,
12 marko,
13 petl,
14 pydantic,
15 python-dateutil,
16 python-slugify,
17 pyyaml,
18 requests,
19 rfc3986,
20 simpleeval,
21 tabulate,
22 typer,
23 typing-extensions,
24 validators,
25
26 # Optional formats
27 boto3,
28 google-api-python-client,
29 datasette,
30 duckdb,
31 duckdb-engine,
32 sqlalchemy,
33 pygithub,
34 pyquery,
35 ijson,
36 jsonlines,
37 pymysql,
38 ezodf,
39 lxml,
40 pandas,
41 pyarrow,
42 fastparquet,
43 psycopg,
44 psycopg2,
45 visidata,
46 tatsu,
47
48 # Tests
49 pytestCheckHook,
50 pytest-cov,
51 pytest-dotenv,
52 pytest-lazy-fixtures,
53 pytest-mock,
54 pytest-timeout,
55 pytest-vcr,
56 moto,
57 requests-mock,
58
59 # Tests depending on excel
60 openpyxl,
61 xlrd,
62}:
63
64buildPythonPackage rec {
65 pname = "frictionless";
66 version = "5.18.1";
67 pyproject = true;
68
69 src = fetchFromGitHub {
70 owner = "frictionlessdata";
71 repo = "frictionless-py";
72 tag = "v${version}";
73 hash = "sha256-svspEHcEw994pEjnuzWf0FFaYeFZuqriK96yFAB6/gI=";
74 };
75
76 build-system = [
77 hatchling
78 ];
79
80 dependencies = [
81 attrs
82 chardet
83 humanize
84 isodate
85 jinja2
86 jsonschema
87 marko
88 petl
89 pydantic
90 python-dateutil
91 python-slugify
92 pyyaml
93 requests
94 rfc3986
95 simpleeval
96 tabulate
97 typer
98 typing-extensions
99 validators
100 ];
101
102 optional-dependencies = {
103 # The commented-out formats require dependencies that have not been packaged
104 # They are intentionally left in for reference - Please do not remove them
105 aws = [
106 boto3
107 ];
108 bigquery = [
109 google-api-python-client
110 ];
111 #ckan = [
112 # frictionless-ckan-mapper # not packaged
113 #];
114 datasette = [
115 datasette
116 ];
117 duckdb = [
118 duckdb
119 duckdb-engine
120 sqlalchemy
121 ];
122 #excel = [
123 # openpyxl
124 # tableschema-to-template # not packaged
125 # xlrd
126 # xlwt
127 #];
128 github = [
129 pygithub
130 ];
131 #gsheets = [
132 # pygsheets # not packaged
133 #];
134 html = [
135 pyquery
136 ];
137 json = [
138 ijson
139 jsonlines
140 ];
141 mysql = [
142 pymysql
143 sqlalchemy
144 ];
145 ods = [
146 ezodf
147 lxml
148 ];
149 pandas = [
150 pandas
151 pyarrow
152 ];
153 parquet = [
154 fastparquet
155 ];
156 postgresql = [
157 psycopg
158 psycopg2
159 sqlalchemy
160 ];
161 #spss = [
162 # savreaderwriter # not packaged
163 #];
164 sql = [
165 sqlalchemy
166 ];
167 visidata = [
168 # Not ideal: This is actually outside pythonPackages set and depends on whatever
169 # Python version the top-level python3Packages set refers to
170 visidata
171 ];
172 wkt = [
173 tatsu
174 ];
175 #zenodo = [
176 # pyzenodo3 # not packaged
177 #];
178 };
179
180 nativeCheckInputs = [
181 pytestCheckHook
182 pytest-cov
183 pytest-dotenv
184 pytest-lazy-fixtures
185 pytest-mock
186 pytest-timeout
187 pytest-vcr
188 moto
189 requests-mock
190
191 # We do not have all packages for the `excel` format to fully function,
192 # but it's required for some of the tests.
193 openpyxl
194 xlrd
195 ]
196 ++ lib.flatten (lib.attrValues optional-dependencies);
197
198 disabledTestPaths = [
199 # Requires optional dependencies that have not been packaged (commented out above)
200 # The tests of other unavailable formats are auto-skipped
201 "frictionless/formats/excel"
202 "frictionless/formats/spss"
203 ];
204
205 pythonImportsCheck = [
206 "frictionless"
207 ];
208
209 meta = {
210 description = "Data management framework for Python that provides functionality to describe, extract, validate, and transform tabular data";
211 homepage = "https://github.com/frictionlessdata/frictionless-py";
212 changelog = "https://github.com/frictionlessdata/frictionless-py/blob/${src.rev}/CHANGELOG.md";
213 license = lib.licenses.mit;
214 maintainers = with lib.maintainers; [ zhaofengli ];
215 };
216}