Repository navigation
Expand file tree
/
Copy pathpyproject.toml
More file actions
431 lines (383 loc) · 14.7 KB
/
Copy pathpyproject.toml
File metadata and controls
431 lines (383 loc) · 14.7 KB
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
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
[project]
name = "datacontract-cli"
version = "1.2.11"
description = "The datacontract CLI is an open source command-line tool for working with Data Contracts. It uses data contract YAML files to lint the data contract, connect to data sources and execute schema and quality tests, detect breaking changes, and export to different formats. The tool is written in Python. It can be used as a standalone CLI tool, in a CI/CD pipeline, or directly as a Python library."
license = "MIT"
readme = "README.md"
authors = [
{ name = "Jochen Christ", email = "jochen.christ@entropy-data.com" },
{ name = "Stefan Negele", email = "stefan.negele@innoq.com" },
{ name = "Simon Harrer", email = "simon.harrer@entropy-data.com" },
]
# No "License :: OSI Approved :: MIT License" classifier: PEP 639 makes the SPDX
# `license` expression above and the License classifiers mutually exclusive, and
# setuptools >= 77 errors out when both are present.
classifiers = [
"Development Status :: 5 - Production/Stable",
"Environment :: Console",
"Intended Audience :: Developers",
"Intended Audience :: Information Technology",
"Operating System :: OS Independent",
"Programming Language :: Python :: 3",
# Keep in sync with `requires-python` below.
"Programming Language :: Python :: 3.10",
"Programming Language :: Python :: 3.11",
"Programming Language :: Python :: 3.12",
"Programming Language :: Python :: 3.13",
"Programming Language :: Python :: 3.14",
"Topic :: Database",
"Topic :: Software Development :: Quality Assurance",
"Topic :: Software Development :: Testing",
]
keywords = [
"data-contract",
"data-contracts",
"odcs",
"open-data-contract-standard",
"data-quality",
"data-governance",
"data-mesh",
"data-product",
"data-engineering",
"schema",
"dbt",
"snowflake",
"databricks",
"bigquery",
]
requires-python = ">=3.10,<3.15"
dependencies = [
"typer>=0.18.0,<0.30",
"click>=8.1.0,<9.0.0",
"pydantic>=2.8.2,<2.15.0",
"pydantic-settings>=2.5.0,<3.0.0",
"pyyaml~=6.0.1",
"ruamel.yaml>=0.17,<0.20",
"requests>=2.31,<2.35",
"truststore>=0.10,<1.0",
"fastjsonschema>=2.19.1,<2.23.0",
"jsonschema>=4.23.0,<5.0.0",
"pytz>=2024.1",
"python-multipart>=0.0.20,<1.0.0",
"rich>=13.7,<16.0",
"sqlglot>=26.6.0,!=30.34.0,<31.0.0",
"python-dotenv>=1.0.0,<2.0.0",
"boto3>=1.34.41,<2.0.0",
"Jinja2>=3.1.5,<4.0.0",
"jinja_partials>=0.2.1,<1.0.0",
"datacontract-specification>=1.2.3,<2.0.0",
"open-data-contract-standard>=3.2.0,<3.3.0",
"deepdiff>=8.0.0,<10.0.0",
]
[project.optional-dependencies]
avro = [
"avro==1.12.2"
]
bigquery = [
"ibis-framework[bigquery]>=10.0.0,<13.0.0",
]
# ibis's ClickHouse backend talks to the HTTP interface through clickhouse-connect,
# whose wheels need no ClickHouse client libraries on the system.
clickhouse = [
"ibis-framework[clickhouse]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
# CSV import reads through DuckDB; kept as an alias so existing installs keep working.
csv = [
"datacontract-cli[duckdb]",
]
excel = [
"openpyxl>=3.1.5,<4.0.0",
]
# Tests Excel workbooks (`format: xlsx`)
xlsx = [
"datacontract-cli[duckdb]",
"duckdb-extension-excel>=1.5.0,<1.6.0",
]
# The dataframe server type runs against a Spark session the caller passes to
# `DataContract(spark=...)`, so pyspark is necessarily importable in that process
# already. Declaring it here would only risk pip shadowing the build a Spark
# runtime (Databricks, EMR) provides, so it is left to the caller.
#
# ibis ships the pyspark backend module in its base wheel but declares that
# backend's dependencies behind its `pyspark` extra, so what is listed here is
# that extra minus pyspark itself.
dataframe = [
"ibis-framework>=10.0.0,<13.0.0",
"numpy>=1.23.2,<3",
"packaging>=21.3,<27.0",
"pandas>=1.5.3,<4",
"pyarrow>=10.0.1",
"pyarrow-hotfix>=0.4",
"rich>=12.4.4",
]
# No pyspark: the SQL-connector path never needs it, and the Spark path runs
# against a session the caller passes to `DataContract(spark=...)` — which they
# cannot have built without pyspark already importable. Declaring it here only
# risks pip shadowing the build a Databricks Runtime or EMR cluster provides.
# ibis ships the pyspark backend module in its base wheel and declares the
# pyspark dependency only behind its `pyspark` extra, so
# `ibis.pyspark.connect(session=spark)` still works against that session.
databricks = [
"ibis-framework[databricks]>=10.0.0,<13.0.0",
"databricks-sql-connector>=3.7.0,<4.10.0",
"databricks-sdk<0.170.0",
# ibis's pyspark backend imports packaging, which ibis declares only in its
# `pyspark` extra — the one deliberately left out above.
"packaging>=21.3,<27.0",
]
# Kept as an alias of `databricks`, which no longer installs pyspark either.
# Existing `datacontract-cli[databricks-runtime]` installs keep working.
databricks-runtime = [
"datacontract-cli[databricks]",
]
iceberg = [
"pyiceberg[pyarrow,rest-sigv4]==0.12.0",
"datacontract-cli[duckdb]"
]
# Kafka needs no JVM: the topic is consumed with confluent-kafka, decoded in
# Python, and checked in DuckDB (see engines/ibis/connections/kafka.py).
kafka = [
"datacontract-cli[duckdb,parquet]",
"confluent-kafka>=2.6.0,<3.0.0",
# fastavro rather than the `avro` reference implementation the avro importer
# uses: schemaless_reader decodes a bare message against the writer schema,
# which is exactly the operation here, and it is an order of magnitude faster
# per message.
"fastavro>=1.9.7,<2.0.0",
]
# MySQL is tested through DuckDB's `mysql` extension (ATTACH), not ibis's
# native MySQL backend, which would require `mysqlclient` (a C extension with no
# macOS/Linux wheels). No Python MySQL driver is needed at runtime; the test
# fixtures' seed driver (mysql-connector-python) lives in the `dev` extra.
mysql = [
"datacontract-cli[duckdb]",
]
postgres = [
"ibis-framework[postgres]>=10.0.0,<13.0.0",
# psycopg's binary wheels bundle libpq, so the extra works without
# PostgreSQL client libraries installed on the system.
"psycopg[binary]>=3.1,<4.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
redshift = [
# Redshift speaks the postgres wire protocol; ibis has no dedicated backend.
"ibis-framework[postgres]>=10.0.0,<13.0.0",
# psycopg's binary wheels bundle libpq, so the extra works without
# PostgreSQL client libraries installed on the system.
"psycopg[binary]>=3.1,<4.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
# DuckDB extension wheels are bundled for air-gapped installs. The 1.5.x line
# publishes wheels for all platforms including manylinux2014_aarch64, so no
# platform markers are needed.
s3 = [
"datacontract-cli[duckdb]",
"s3fs>=2025.2.0,<2027.0.0",
"duckdb-extension-httpfs>=1.5.0,<1.6.0",
"duckdb-extension-aws>=1.5.0,<1.6.0",
]
# GCS is an S3-compatible server, tested through the same connection setup.
gcs = [
"datacontract-cli[s3]",
]
azure = [
"datacontract-cli[duckdb]",
"duckdb-extension-azure>=1.5.0,<1.6.0",
"azure-identity>=1.17.1,<1.28",
"azure-storage-blob>=12.24,<12.32",
]
snowflake = [
"snowflake-connector-python[pandas]>=3.17,<5.2",
"ibis-framework[snowflake]>=10.0.0,<13.0.0",
# ibis imports packaging unconditionally; snowflake-connector-python 5.x no longer pulls it in.
"packaging>=21.3,<27.0"
]
sqlserver = [
"ibis-framework[mssql]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
oracle = [
"ibis-framework[oracle]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
athena = [
"ibis-framework[athena]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
hana = [
"hdbcli>=2.20.0,<3.0.0",
]
exasol = [
"ibis-framework[exasol]>=10.0.0,<13.0.0",
# `host/nocertcheck` in the connection string needs the DSN grammar from 1.1.0.
"pyexasol>=1.1.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
# the read-only SQL guard parses with sqlglot's own Exasol dialect, added in 26.31.0
"sqlglot>=26.31.0",
]
trino = [
"ibis-framework[trino]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
impala = [
"ibis-framework[impala]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
# ibis has no Hive backend; its Impala backend reaches a HiveServer2 through impyla,
# which speaks the HiveServer2 protocol of both (see connections/hive_patch.py).
hive = [
"ibis-framework[impala]>=10.0.0,<13.0.0",
# ibis loads its datafusion compiler (needs packaging) but omits it from this extra.
"packaging>=21.3,<27.0",
]
# ibis has no Dremio backend; the SQL of ibis's Trino compiler, written in sqlglot's
# Dremio dialect, runs as jobs over Dremio's REST API (see connections/dremio.py),
# which needs no driver beyond requests.
dremio = [
"ibis-framework>=10.0.0,<13.0.0",
"numpy>=1.23.2,<3",
# ibis loads its datafusion compiler (needs packaging) but omits it from its base wheel.
"packaging>=21.3,<27.0",
"pandas>=1.5.3,<4",
"pyarrow>=10.0.1",
"pyarrow-hotfix>=0.4",
# sqlglot's Dremio dialect, which the SQL and the physical types are written in, arrived in
# 26.32.0, a release ibis cannot load its compilers with.
"sqlglot>=26.33.0",
]
dbml = [
"pydbml>=1.1.1"
]
# duckdb must stay in lockstep with the bundled duckdb-extension-* wheels
# (httpfs/aws/azure/excel) used for air-gapped installs, since those extensions are
# built per duckdb version. Both are pinned to the 1.5.x line.
duckdb = [
"duckdb>=1.5.0,<1.6.0",
"ibis-framework[duckdb]>=10.0.0,<13.0.0",
]
parquet = [
"pyarrow>=18.1.0"
]
rdf = [
"rdflib==7.6.0",
]
api = [
"fastapi>=0.115.0,<0.163.0",
"uvicorn>=0.44.0,<0.55.0",
]
protobuf = [
# Pure-Python .proto parser — no `protoc` system binary or C extension needed.
"proto-schema-parser>=1.0,<3.0",
]
xml = [
# Resolves includes, imports, groups and type derivation of XML Schemas for `import xsd`
"xmlschema>=4.0,<5.0",
]
# NOTE: `hana` is intentionally NOT part of `all`. It depends on `hdbcli`, the
# SAP HANA Client, which is distributed under SAP's proprietary license (SAP
# Developer License), not an OSI-approved open-source license. Bundling it into
# the `all` meta-extra would pull a proprietary package into a default-ish
# install, so HANA support must be opted into explicitly via `datacontract-cli[hana]`.
all = [
"datacontract-cli[avro,kafka,bigquery,csv,excel,snowflake,postgres,redshift,mysql,dataframe,databricks,sqlserver,s3,gcs,azure,athena,trino,exasol,impala,clickhouse,hive,dremio,dbml,duckdb,iceberg,parquet,rdf,api,protobuf,oracle,xml,xlsx]"
]
# for development, we pin all libraries to an exact version
dev = [
"datacontract-cli[all]",
"httpx==0.28.1",
"kafka-python",
"minio==7.2.20", # Pin to 7.2.17 - 7.2.18+ has keyword-only params incompatible with testcontainers
"moto==5.2.5",
"openapi-spec-validator>=0.7,<0.10", # asserts that `datacontract api` serves a valid OpenAPI document
"pandas>=2.1.0",
"pre-commit>=3.7.1,<4.7.0",
"pytest",
"pytest-cov",
"pytest-xdist",
"pymssql==2.4.6",
# psycopg2 / mysql-connector-python are used directly by the postgres / mysql
# test fixtures to load seed SQL (the engine connects via ibis-postgres'
# psycopg v3 and DuckDB's mysql extension respectively).
"psycopg2-binary>=2.9,<3.0",
"mysql-connector-python>=8.0.30,<26.11.0",
"ruff==0.17.6",
"testcontainers[minio,postgres,kafka,mssql,mysql]==4.15.0",
"trino==0.340.0",
]
# PyPI special-cases these exact names (icon + prominent placement in the
# "Project links" sidebar); unrecognised names render as plain bullets.
[project.urls]
Homepage = "https://cli.datacontract.com"
Documentation = "https://cli.datacontract.com"
Repository = "https://github.com/datacontract/datacontract-cli"
Issues = "https://github.com/datacontract/datacontract-cli/issues"
Changelog = "https://cli.datacontract.com/release-notes"
[project.scripts]
datacontract = "datacontract.cli:main"
[build-system]
requires = ["setuptools", "wheel"]
build-backend = "setuptools.build_meta"
[tool.uv]
# yarl 1.24.0 and 1.24.1 were published to PyPI with cp310-only wheels and no
# sdist, so `uv sync` fails on Python 3.11/3.12/3.13 ("no wheel for the current
# platform"). The whole 1.24.x line is affected; pin below it (resolves to the
# last good 1.23.0) until a 1.24.x with full wheels is available.
override-dependencies = [
"yarl<1.24",
]
[tool.pytest.ini_options]
# Exclude slow tests by default; run them with `pytest -m slow` (or `-m "slow or not slow"` for everything).
# Append parallel execution with "-n 8" if desired (disable with "-n0").
addopts = "-m 'not slow'"
testpaths = ["tests"]
markers = [
"slow: tests that are slow to run (e.g. pull large containers); deselect with '-m \"not slow\"'",
]
log_level = "INFO"
#log_cli = "true" # activate live logging, do not use with -n 8 xdist option for parallel test execution: https://github.com/pytest-dev/pytest-xdist/issues/402
log_cli_level = "INFO"
# Coverage is for local runs (`pytest --cov`), not a gate: deliberately no `fail_under`.
[tool.coverage.run]
source = ["datacontract"]
omit = [
# Vendored build output of the datacontract-editor npm package, not ours to test.
"datacontract/editor_assets/*",
]
[tool.coverage.report]
exclude_also = [
# Bodies that only exist for typing; never executed at runtime.
"if TYPE_CHECKING:",
"raise NotImplementedError",
"@overload",
]
[tool.ruff]
line-length = 120
# ruff 0.16 formats Python blocks inside markdown. The docs contain generated
# CLI output (the AUTOGENERATED blocks under docs/docs/exports), which must
# match what the tool actually prints and is rewritten by the update scripts,
# so formatting it here would both misrepresent the output and churn.
extend-exclude = ["*.md"]
[tool.ruff.lint]
# Pin the rule set explicitly. With only `extend-select`, the effective rules are
# whatever ruff currently defaults to, so a ruff upgrade silently changes what CI
# enforces (0.16.0 added ~1400 findings this way). New rule families are opted
# into here deliberately.
select = [
"E4", # ruff's default: pycodestyle imports
"E7", # ruff's default: pycodestyle statements
"E9", # ruff's default: pycodestyle runtime errors
"F", # ruff's default: pyflakes
"I", # re-order imports in alphabetic order
]
[tool.ruff.lint.per-file-ignores]
"__init__.py" = ["F401", "F403"]