pipeverify 0.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,7 @@
1
+ __pycache__/
2
+ *.egg-info/
3
+ .pytest_cache/
4
+ dist/
5
+ build/
6
+ .venv/
7
+ *.db
@@ -0,0 +1,202 @@
1
+
2
+ Apache License
3
+ Version 2.0, January 2004
4
+ http://www.apache.org/licenses/
5
+
6
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
7
+
8
+ 1. Definitions.
9
+
10
+ "License" shall mean the terms and conditions for use, reproduction,
11
+ and distribution as defined by Sections 1 through 9 of this document.
12
+
13
+ "Licensor" shall mean the copyright owner or entity authorized by
14
+ the copyright owner that is granting the License.
15
+
16
+ "Legal Entity" shall mean the union of the acting entity and all
17
+ other entities that control, are controlled by, or are under common
18
+ control with that entity. For the purposes of this definition,
19
+ "control" means (i) the power, direct or indirect, to cause the
20
+ direction or management of such entity, whether by contract or
21
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
22
+ outstanding shares, or (iii) beneficial ownership of such entity.
23
+
24
+ "You" (or "Your") shall mean an individual or Legal Entity
25
+ exercising permissions granted by this License.
26
+
27
+ "Source" form shall mean the preferred form for making modifications,
28
+ including but not limited to software source code, documentation
29
+ source, and configuration files.
30
+
31
+ "Object" form shall mean any form resulting from mechanical
32
+ transformation or translation of a Source form, including but
33
+ not limited to compiled object code, generated documentation,
34
+ and conversions to other media types.
35
+
36
+ "Work" shall mean the work of authorship, whether in Source or
37
+ Object form, made available under the License, as indicated by a
38
+ copyright notice that is included in or attached to the work
39
+ (an example is provided in the Appendix below).
40
+
41
+ "Derivative Works" shall mean any work, whether in Source or Object
42
+ form, that is based on (or derived from) the Work and for which the
43
+ editorial revisions, annotations, elaborations, or other modifications
44
+ represent, as a whole, an original work of authorship. For the purposes
45
+ of this License, Derivative Works shall not include works that remain
46
+ separable from, or merely link (or bind by name) to the interfaces of,
47
+ the Work and Derivative Works thereof.
48
+
49
+ "Contribution" shall mean any work of authorship, including
50
+ the original version of the Work and any modifications or additions
51
+ to that Work or Derivative Works thereof, that is intentionally
52
+ submitted to Licensor for inclusion in the Work by the copyright owner
53
+ or by an individual or Legal Entity authorized to submit on behalf of
54
+ the copyright owner. For the purposes of this definition, "submitted"
55
+ means any form of electronic, verbal, or written communication sent
56
+ to the Licensor or its representatives, including but not limited to
57
+ communication on electronic mailing lists, source code control systems,
58
+ and issue tracking systems that are managed by, or on behalf of, the
59
+ Licensor for the purpose of discussing and improving the Work, but
60
+ excluding communication that is conspicuously marked or otherwise
61
+ designated in writing by the copyright owner as "Not a Contribution."
62
+
63
+ "Contributor" shall mean Licensor and any individual or Legal Entity
64
+ on behalf of whom a Contribution has been received by Licensor and
65
+ subsequently incorporated within the Work.
66
+
67
+ 2. Grant of Copyright License. Subject to the terms and conditions of
68
+ this License, each Contributor hereby grants to You a perpetual,
69
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
70
+ copyright license to reproduce, prepare Derivative Works of,
71
+ publicly display, publicly perform, sublicense, and distribute the
72
+ Work and such Derivative Works in Source or Object form.
73
+
74
+ 3. Grant of Patent License. Subject to the terms and conditions of
75
+ this License, each Contributor hereby grants to You a perpetual,
76
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
77
+ (except as stated in this section) patent license to make, have made,
78
+ use, offer to sell, sell, import, and otherwise transfer the Work,
79
+ where such license applies only to those patent claims licensable
80
+ by such Contributor that are necessarily infringed by their
81
+ Contribution(s) alone or by combination of their Contribution(s)
82
+ with the Work to which such Contribution(s) was submitted. If You
83
+ institute patent litigation against any entity (including a
84
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
85
+ or a Contribution incorporated within the Work constitutes direct
86
+ or contributory patent infringement, then any patent licenses
87
+ granted to You under this License for that Work shall terminate
88
+ as of the date such litigation is filed.
89
+
90
+ 4. Redistribution. You may reproduce and distribute copies of the
91
+ Work or Derivative Works thereof in any medium, with or without
92
+ modifications, and in Source or Object form, provided that You
93
+ meet the following conditions:
94
+
95
+ (a) You must give any other recipients of the Work or
96
+ Derivative Works a copy of this License; and
97
+
98
+ (b) You must cause any modified files to carry prominent notices
99
+ stating that You changed the files; and
100
+
101
+ (c) You must retain, in the Source form of any Derivative Works
102
+ that You distribute, all copyright, patent, trademark, and
103
+ attribution notices from the Source form of the Work,
104
+ excluding those notices that do not pertain to any part of
105
+ the Derivative Works; and
106
+
107
+ (d) If the Work includes a "NOTICE" text file as part of its
108
+ distribution, then any Derivative Works that You distribute must
109
+ include a readable copy of the attribution notices contained
110
+ within such NOTICE file, excluding those notices that do not
111
+ pertain to any part of the Derivative Works, in at least one
112
+ of the following places: within a NOTICE text file distributed
113
+ as part of the Derivative Works; within the Source form or
114
+ documentation, if provided along with the Derivative Works; or,
115
+ within a display generated by the Derivative Works, if and
116
+ wherever such third-party notices normally appear. The contents
117
+ of the NOTICE file are for informational purposes only and
118
+ do not modify the License. You may add Your own attribution
119
+ notices within Derivative Works that You distribute, alongside
120
+ or as an addendum to the NOTICE text from the Work, provided
121
+ that such additional attribution notices cannot be construed
122
+ as modifying the License.
123
+
124
+ You may add Your own copyright statement to Your modifications and
125
+ may provide additional or different license terms and conditions
126
+ for use, reproduction, or distribution of Your modifications, or
127
+ for any such Derivative Works as a whole, provided Your use,
128
+ reproduction, and distribution of the Work otherwise complies with
129
+ the conditions stated in this License.
130
+
131
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
132
+ any Contribution intentionally submitted for inclusion in the Work
133
+ by You to the Licensor shall be under the terms and conditions of
134
+ this License, without any additional terms or conditions.
135
+ Notwithstanding the above, nothing herein shall supersede or modify
136
+ the terms of any separate license agreement you may have executed
137
+ with Licensor regarding such Contributions.
138
+
139
+ 6. Trademarks. This License does not grant permission to use the trade
140
+ names, trademarks, service marks, or product names of the Licensor,
141
+ except as required for reasonable and customary use in describing the
142
+ origin of the Work and reproducing the content of the NOTICE file.
143
+
144
+ 7. Disclaimer of Warranty. Unless required by applicable law or
145
+ agreed to in writing, Licensor provides the Work (and each
146
+ Contributor provides its Contributions) on an "AS IS" BASIS,
147
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
148
+ implied, including, without limitation, any warranties or conditions
149
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
150
+ PARTICULAR PURPOSE. You are solely responsible for determining the
151
+ appropriateness of using or redistributing the Work and assume any
152
+ risks associated with Your exercise of permissions under this License.
153
+
154
+ 8. Limitation of Liability. In no event and under no legal theory,
155
+ whether in tort (including negligence), contract, or otherwise,
156
+ unless required by applicable law (such as deliberate and grossly
157
+ negligent acts) or agreed to in writing, shall any Contributor be
158
+ liable to You for damages, including any direct, indirect, special,
159
+ incidental, or consequential damages of any character arising as a
160
+ result of this License or out of the use or inability to use the
161
+ Work (including but not limited to damages for loss of goodwill,
162
+ work stoppage, computer failure or malfunction, or any and all
163
+ other commercial damages or losses), even if such Contributor
164
+ has been advised of the possibility of such damages.
165
+
166
+ 9. Accepting Warranty or Additional Liability. While redistributing
167
+ the Work or Derivative Works thereof, You may choose to offer,
168
+ and charge a fee for, acceptance of support, warranty, indemnity,
169
+ or other liability obligations and/or rights consistent with this
170
+ License. However, in accepting such obligations, You may act only
171
+ on Your own behalf and on Your sole responsibility, not on behalf
172
+ of any other Contributor, and only if You agree to indemnify,
173
+ defend, and hold each Contributor harmless for any liability
174
+ incurred by, or claims asserted against, such Contributor by reason
175
+ of your accepting any such warranty or additional liability.
176
+
177
+ END OF TERMS AND CONDITIONS
178
+
179
+ APPENDIX: How to apply the Apache License to your work.
180
+
181
+ To apply the Apache License to your work, attach the following
182
+ boilerplate notice, with the fields enclosed by brackets "[]"
183
+ replaced with your own identifying information. (Don't include
184
+ the brackets!) The text should be enclosed in the appropriate
185
+ comment syntax for the file format. We also recommend that a
186
+ file or class name and description of purpose be included on the
187
+ same "printed page" as the copyright notice for easier
188
+ identification within third-party archives.
189
+
190
+ Copyright [yyyy] [name of copyright owner]
191
+
192
+ Licensed under the Apache License, Version 2.0 (the "License");
193
+ you may not use this file except in compliance with the License.
194
+ You may obtain a copy of the License at
195
+
196
+ http://www.apache.org/licenses/LICENSE-2.0
197
+
198
+ Unless required by applicable law or agreed to in writing, software
199
+ distributed under the License is distributed on an "AS IS" BASIS,
200
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
201
+ See the License for the specific language governing permissions and
202
+ limitations under the License.
@@ -0,0 +1,2 @@
1
+ pipeverify
2
+ Copyright 2026 Akshay Sharma
@@ -0,0 +1,234 @@
1
+ Metadata-Version: 2.5
2
+ Name: pipeverify
3
+ Version: 0.1.0
4
+ Summary: Check that a pipeline change left the data right, not just the job green.
5
+ Project-URL: Homepage, https://github.com/akshaysharma1088/pipeverify
6
+ Project-URL: Issues, https://github.com/akshaysharma1088/pipeverify/issues
7
+ Author: Akshay Sharma
8
+ License-Expression: Apache-2.0
9
+ License-File: LICENSE
10
+ License-File: NOTICE
11
+ Keywords: ci,data-diff,data-engineering,data-quality,duckdb,etl,llm-agents
12
+ Classifier: Development Status :: 3 - Alpha
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Programming Language :: Python :: 3
15
+ Classifier: Topic :: Database
16
+ Classifier: Topic :: Software Development :: Quality Assurance
17
+ Requires-Python: >=3.9
18
+ Requires-Dist: click>=8.1
19
+ Requires-Dist: duckdb>=1.0
20
+ Requires-Dist: pyyaml>=6.0
21
+ Provides-Extra: ai
22
+ Requires-Dist: anthropic>=0.40; extra == 'ai'
23
+ Requires-Dist: openai>=1.40; extra == 'ai'
24
+ Provides-Extra: dev
25
+ Requires-Dist: pandas>=2.0; extra == 'dev'
26
+ Requires-Dist: pytest>=8; extra == 'dev'
27
+ Provides-Extra: sql
28
+ Requires-Dist: pandas>=2.0; extra == 'sql'
29
+ Requires-Dist: sqlalchemy>=2.0; extra == 'sql'
30
+ Description-Content-Type: text/markdown
31
+
32
+ # pipeverify
33
+
34
+ **Check that a pipeline change left the data right, not just the job green.**
35
+
36
+ [![ci](https://github.com/akshaysharma1088/pipeverify/actions/workflows/ci.yml/badge.svg)](https://github.com/akshaysharma1088/pipeverify/actions/workflows/ci.yml)
37
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
38
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
39
+ ![Status](https://img.shields.io/badge/status-alpha-orange)
40
+
41
+ A pipeline change can pass every test, finish on time and keep the schema intact while quietly
42
+ dropping rows, duplicating keys or changing what a column means. More of these changes are now
43
+ written by AI coding agents, which makes "the job succeeded" an even weaker signal.
44
+
45
+ pipeverify compares your tables **before and after** a change and gives a verdict:
46
+
47
+ | Verdict | Meaning | Default CI behaviour |
48
+ |---|---|---|
49
+ | ✅ **PASS** | The data is the same where it should be. | Merge |
50
+ | 🟡 **REVIEW** | Something changed that tests would not catch. A person should look. | Merge allowed, flagged |
51
+ | ⛔ **BLOCK** | The change damages the data. | Fail the check |
52
+
53
+ It works with any tool that produces tables: SQL scripts, Spark jobs, dbt, Airflow tasks or an AI
54
+ agent's fix. It needs two snapshots, nothing else.
55
+
56
+ ## Why
57
+
58
+ In the [PipeMend benchmark](https://github.com/akshaysharma1088/pipemend)
59
+ ([DOI 10.5281/zenodo.23510784](https://doi.org/10.5281/zenodo.23510784)), LLM agents repaired
60
+ 64 data pipeline incidents. Production-style data quality monitors approved **every** harmful fix
61
+ the agents made. What caught them was comparing the data itself. pipeverify packages that check
62
+ so any team can run it on every change.
63
+
64
+ ## Quick start
65
+
66
+ ```bash
67
+ pip install pipeverify
68
+
69
+ # compare two snapshots of one table
70
+ pipeverify compare before/orders.parquet after/orders.parquet --key order_id
71
+ ```
72
+
73
+ ```
74
+ BLOCK orders.parquet
75
+ rows 1,200 -> 1,000, matched 1,000
76
+ BLOCK Table lost 200 rows (16.67%)
77
+ BLOCK 200 key(s) present before are gone after (16.67%)
78
+ BLOCK Total of 'revenue' moved 16.71% (1,383,131.25 -> 1,152,000.00)
79
+
80
+ Verdict: BLOCK This change damages the data. Do not merge as is.
81
+ ```
82
+
83
+ Try the bundled demo, five realistic changes to a retail sales table:
84
+
85
+ ```bash
86
+ git clone https://github.com/akshaysharma1088/pipeverify && cd pipeverify
87
+ pip install -e .
88
+ python examples/retail/make_demo.py
89
+ for s in examples/retail/scenarios/*/; do pipeverify run -c "$s/pipeverify.yml"; done
90
+ ```
91
+
92
+ | Scenario | What happened | Verdict |
93
+ |---|---|---|
94
+ | `1_safe_fix` | Revenue restated for late refunds on one day, as intended | ✅ PASS |
95
+ | `2_dedupe_drops_rows` | Duplicates removed on the wrong columns, real days dropped | ⛔ BLOCK |
96
+ | `3_join_fanout` | A join to a dimension with a duplicate row doubled one store | ⛔ BLOCK |
97
+ | `4_unit_change` | Upstream started sending one region's revenue in cents | ⛔ BLOCK |
98
+ | `5_null_creep` | A renamed source field left region empty for new stores | 🟡 REVIEW |
99
+
100
+ Every one of these runs successfully and keeps the same schema.
101
+
102
+ ## Sources
103
+
104
+ `before` and `after` can each be:
105
+
106
+ | Source | CLI form | Config form |
107
+ |---|---|---|
108
+ | CSV, Parquet, JSON file | `data/orders.parquet` | `path: data/orders.parquet` |
109
+ | DuckDB table | `duckdb:warehouse.db:gold.orders` | `{duckdb: warehouse.db, table: gold.orders}` |
110
+ | DuckDB query | `"duckdb:warehouse.db:SELECT ..."` | `{duckdb: warehouse.db, query: "SELECT ..."}` |
111
+ | Any SQLAlchemy database (Postgres, Snowflake, BigQuery, ...) | | `{url: "postgresql://${PGUSER}@host/db", table: gold.orders}` |
112
+ | pandas DataFrame | | Python API |
113
+
114
+ SQL databases need `pip install "pipeverify[sql]"` plus the driver for your database. Environment
115
+ variables in URLs are expanded, so credentials stay out of the config file.
116
+
117
+ ## Config
118
+
119
+ Check many tables at once with `pipeverify.yml` (`pipeverify init` writes a starter file):
120
+
121
+ ```yaml
122
+ thresholds: # optional, overrides the defaults below for every table
123
+ row_change_block_pct: 10
124
+ tables:
125
+ - name: gold.daily_sales
126
+ before: snapshots/main/daily_sales.parquet
127
+ after: snapshots/pr/daily_sales.parquet
128
+ key: [store_id, sale_date]
129
+ expect_change: [revenue] # columns this change is meant to modify
130
+ ignore: [loaded_at] # columns that always change
131
+ - name: gold.customers
132
+ before: {url: "${WAREHOUSE_URL}", table: prod.customers}
133
+ after: {url: "${WAREHOUSE_URL}", table: pr_123.customers}
134
+ key: [customer_id]
135
+ expect_row_change: true # this change is meant to add or remove rows
136
+ ```
137
+
138
+ ```bash
139
+ pipeverify run # uses ./pipeverify.yml
140
+ pipeverify run --fail-on review # stricter: fail CI on REVIEW too
141
+ pipeverify run --format markdown -o report.md
142
+ pipeverify run --json-out report.json
143
+ ```
144
+
145
+ Exit code is `1` when the verdict reaches `--fail-on` (default `block`), otherwise `0`.
146
+
147
+ ## What it checks
148
+
149
+ | Check | Catches | Default |
150
+ |---|---|---|
151
+ | Schema | Removed, added or retyped columns | removed: BLOCK, retyped: REVIEW |
152
+ | Row count | Rows lost or gained | REVIEW > 1%, BLOCK ≥ 10% |
153
+ | Missing keys | Rows that existed before and are gone | REVIEW on any, BLOCK ≥ 5% |
154
+ | New keys | Rows that did not exist before | REVIEW |
155
+ | Duplicate keys | Fan-out from joins, double loads | BLOCK on any new duplicate |
156
+ | Null rate | Columns going empty | REVIEW > 1 pt, BLOCK ≥ 10 pts |
157
+ | Changed values | Matched rows whose values changed, per column | REVIEW on any, BLOCK ≥ 10% |
158
+ | Column totals | Unit changes, partial loads, double counting | REVIEW > 0.5%, BLOCK ≥ 5% |
159
+ | Category values | New codes in low-cardinality text columns | REVIEW |
160
+
161
+ Columns listed in `expect_change` are reported but never raise the verdict. All thresholds can be
162
+ changed globally or per table; see [`pipeverify/checks.py`](pipeverify/checks.py) for every option.
163
+
164
+ ## GitHub Action
165
+
166
+ ```yaml
167
+ # .github/workflows/pipeverify.yml
168
+ on: pull_request
169
+ permissions:
170
+ contents: read
171
+ pull-requests: write
172
+ jobs:
173
+ verify:
174
+ runs-on: ubuntu-latest
175
+ steps:
176
+ - uses: actions/checkout@v4
177
+ # ... build the "after" snapshots for this PR here ...
178
+ - uses: akshaysharma1088/pipeverify@v0.1.0
179
+ with:
180
+ config: pipeverify.yml
181
+ fail-on: block # or review, or never
182
+ ```
183
+
184
+ The action posts the report as a PR comment and in the job summary, and exposes the verdict as an
185
+ output.
186
+
187
+ ## Python API
188
+
189
+ ```python
190
+ import pipeverify
191
+
192
+ result = pipeverify.verify(before_df, after_df, key="order_id", expect_change=["status"])
193
+ print(result.verdict) # "pass" | "review" | "block"
194
+ for f in result.findings:
195
+ print(f.severity, f.message)
196
+ ```
197
+
198
+ Useful inside an Airflow task, a notebook, or an AI agent's own loop: let the agent propose a fix,
199
+ run `verify`, and only apply the fix on PASS.
200
+
201
+ ## Optional AI explanation
202
+
203
+ ```bash
204
+ export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY with PIPEVERIFY_LLM_MODEL
205
+ pip install "pipeverify[ai]"
206
+ pipeverify run --explain
207
+ ```
208
+
209
+ This adds a short plain-English explanation of what probably happened and what to check next.
210
+ It is off by default. Only the findings are sent (check names, counts, percentages, column names);
211
+ example values from your data are removed first. The verdict never depends on the LLM.
212
+
213
+ ## Roadmap
214
+
215
+ - Native adapters for dbt (compare a PR's models against production), Airflow and Spark
216
+ - Sampling and pushdown for very large tables, so checks run in the warehouse
217
+ - Rules learned from history: what "normal" change looks like for each table
218
+ - Agent integration: a guardrail that coding and data agents call before applying a change
219
+
220
+ Ideas and pull requests are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md).
221
+
222
+ ## Status
223
+
224
+ Alpha. The checks and verdicts are stable enough to try in CI; options and output formats may
225
+ still change before 1.0.
226
+
227
+ ## Citation
228
+
229
+ If you use pipeverify in research, please cite the PipeMend benchmark that motivated it
230
+ (see [CITATION.cff](CITATION.cff)).
231
+
232
+ ## License
233
+
234
+ Apache-2.0
@@ -0,0 +1,203 @@
1
+ # pipeverify
2
+
3
+ **Check that a pipeline change left the data right, not just the job green.**
4
+
5
+ [![ci](https://github.com/akshaysharma1088/pipeverify/actions/workflows/ci.yml/badge.svg)](https://github.com/akshaysharma1088/pipeverify/actions/workflows/ci.yml)
6
+ [![License](https://img.shields.io/badge/license-Apache--2.0-blue.svg)](LICENSE)
7
+ ![Python](https://img.shields.io/badge/python-3.9%2B-blue)
8
+ ![Status](https://img.shields.io/badge/status-alpha-orange)
9
+
10
+ A pipeline change can pass every test, finish on time and keep the schema intact while quietly
11
+ dropping rows, duplicating keys or changing what a column means. More of these changes are now
12
+ written by AI coding agents, which makes "the job succeeded" an even weaker signal.
13
+
14
+ pipeverify compares your tables **before and after** a change and gives a verdict:
15
+
16
+ | Verdict | Meaning | Default CI behaviour |
17
+ |---|---|---|
18
+ | ✅ **PASS** | The data is the same where it should be. | Merge |
19
+ | 🟡 **REVIEW** | Something changed that tests would not catch. A person should look. | Merge allowed, flagged |
20
+ | ⛔ **BLOCK** | The change damages the data. | Fail the check |
21
+
22
+ It works with any tool that produces tables: SQL scripts, Spark jobs, dbt, Airflow tasks or an AI
23
+ agent's fix. It needs two snapshots, nothing else.
24
+
25
+ ## Why
26
+
27
+ In the [PipeMend benchmark](https://github.com/akshaysharma1088/pipemend)
28
+ ([DOI 10.5281/zenodo.23510784](https://doi.org/10.5281/zenodo.23510784)), LLM agents repaired
29
+ 64 data pipeline incidents. Production-style data quality monitors approved **every** harmful fix
30
+ the agents made. What caught them was comparing the data itself. pipeverify packages that check
31
+ so any team can run it on every change.
32
+
33
+ ## Quick start
34
+
35
+ ```bash
36
+ pip install pipeverify
37
+
38
+ # compare two snapshots of one table
39
+ pipeverify compare before/orders.parquet after/orders.parquet --key order_id
40
+ ```
41
+
42
+ ```
43
+ BLOCK orders.parquet
44
+ rows 1,200 -> 1,000, matched 1,000
45
+ BLOCK Table lost 200 rows (16.67%)
46
+ BLOCK 200 key(s) present before are gone after (16.67%)
47
+ BLOCK Total of 'revenue' moved 16.71% (1,383,131.25 -> 1,152,000.00)
48
+
49
+ Verdict: BLOCK This change damages the data. Do not merge as is.
50
+ ```
51
+
52
+ Try the bundled demo, five realistic changes to a retail sales table:
53
+
54
+ ```bash
55
+ git clone https://github.com/akshaysharma1088/pipeverify && cd pipeverify
56
+ pip install -e .
57
+ python examples/retail/make_demo.py
58
+ for s in examples/retail/scenarios/*/; do pipeverify run -c "$s/pipeverify.yml"; done
59
+ ```
60
+
61
+ | Scenario | What happened | Verdict |
62
+ |---|---|---|
63
+ | `1_safe_fix` | Revenue restated for late refunds on one day, as intended | ✅ PASS |
64
+ | `2_dedupe_drops_rows` | Duplicates removed on the wrong columns, real days dropped | ⛔ BLOCK |
65
+ | `3_join_fanout` | A join to a dimension with a duplicate row doubled one store | ⛔ BLOCK |
66
+ | `4_unit_change` | Upstream started sending one region's revenue in cents | ⛔ BLOCK |
67
+ | `5_null_creep` | A renamed source field left region empty for new stores | 🟡 REVIEW |
68
+
69
+ Every one of these runs successfully and keeps the same schema.
70
+
71
+ ## Sources
72
+
73
+ `before` and `after` can each be:
74
+
75
+ | Source | CLI form | Config form |
76
+ |---|---|---|
77
+ | CSV, Parquet, JSON file | `data/orders.parquet` | `path: data/orders.parquet` |
78
+ | DuckDB table | `duckdb:warehouse.db:gold.orders` | `{duckdb: warehouse.db, table: gold.orders}` |
79
+ | DuckDB query | `"duckdb:warehouse.db:SELECT ..."` | `{duckdb: warehouse.db, query: "SELECT ..."}` |
80
+ | Any SQLAlchemy database (Postgres, Snowflake, BigQuery, ...) | | `{url: "postgresql://${PGUSER}@host/db", table: gold.orders}` |
81
+ | pandas DataFrame | | Python API |
82
+
83
+ SQL databases need `pip install "pipeverify[sql]"` plus the driver for your database. Environment
84
+ variables in URLs are expanded, so credentials stay out of the config file.
85
+
86
+ ## Config
87
+
88
+ Check many tables at once with `pipeverify.yml` (`pipeverify init` writes a starter file):
89
+
90
+ ```yaml
91
+ thresholds: # optional, overrides the defaults below for every table
92
+ row_change_block_pct: 10
93
+ tables:
94
+ - name: gold.daily_sales
95
+ before: snapshots/main/daily_sales.parquet
96
+ after: snapshots/pr/daily_sales.parquet
97
+ key: [store_id, sale_date]
98
+ expect_change: [revenue] # columns this change is meant to modify
99
+ ignore: [loaded_at] # columns that always change
100
+ - name: gold.customers
101
+ before: {url: "${WAREHOUSE_URL}", table: prod.customers}
102
+ after: {url: "${WAREHOUSE_URL}", table: pr_123.customers}
103
+ key: [customer_id]
104
+ expect_row_change: true # this change is meant to add or remove rows
105
+ ```
106
+
107
+ ```bash
108
+ pipeverify run # uses ./pipeverify.yml
109
+ pipeverify run --fail-on review # stricter: fail CI on REVIEW too
110
+ pipeverify run --format markdown -o report.md
111
+ pipeverify run --json-out report.json
112
+ ```
113
+
114
+ Exit code is `1` when the verdict reaches `--fail-on` (default `block`), otherwise `0`.
115
+
116
+ ## What it checks
117
+
118
+ | Check | Catches | Default |
119
+ |---|---|---|
120
+ | Schema | Removed, added or retyped columns | removed: BLOCK, retyped: REVIEW |
121
+ | Row count | Rows lost or gained | REVIEW > 1%, BLOCK ≥ 10% |
122
+ | Missing keys | Rows that existed before and are gone | REVIEW on any, BLOCK ≥ 5% |
123
+ | New keys | Rows that did not exist before | REVIEW |
124
+ | Duplicate keys | Fan-out from joins, double loads | BLOCK on any new duplicate |
125
+ | Null rate | Columns going empty | REVIEW > 1 pt, BLOCK ≥ 10 pts |
126
+ | Changed values | Matched rows whose values changed, per column | REVIEW on any, BLOCK ≥ 10% |
127
+ | Column totals | Unit changes, partial loads, double counting | REVIEW > 0.5%, BLOCK ≥ 5% |
128
+ | Category values | New codes in low-cardinality text columns | REVIEW |
129
+
130
+ Columns listed in `expect_change` are reported but never raise the verdict. All thresholds can be
131
+ changed globally or per table; see [`pipeverify/checks.py`](pipeverify/checks.py) for every option.
132
+
133
+ ## GitHub Action
134
+
135
+ ```yaml
136
+ # .github/workflows/pipeverify.yml
137
+ on: pull_request
138
+ permissions:
139
+ contents: read
140
+ pull-requests: write
141
+ jobs:
142
+ verify:
143
+ runs-on: ubuntu-latest
144
+ steps:
145
+ - uses: actions/checkout@v4
146
+ # ... build the "after" snapshots for this PR here ...
147
+ - uses: akshaysharma1088/pipeverify@v0.1.0
148
+ with:
149
+ config: pipeverify.yml
150
+ fail-on: block # or review, or never
151
+ ```
152
+
153
+ The action posts the report as a PR comment and in the job summary, and exposes the verdict as an
154
+ output.
155
+
156
+ ## Python API
157
+
158
+ ```python
159
+ import pipeverify
160
+
161
+ result = pipeverify.verify(before_df, after_df, key="order_id", expect_change=["status"])
162
+ print(result.verdict) # "pass" | "review" | "block"
163
+ for f in result.findings:
164
+ print(f.severity, f.message)
165
+ ```
166
+
167
+ Useful inside an Airflow task, a notebook, or an AI agent's own loop: let the agent propose a fix,
168
+ run `verify`, and only apply the fix on PASS.
169
+
170
+ ## Optional AI explanation
171
+
172
+ ```bash
173
+ export ANTHROPIC_API_KEY=... # or OPENAI_API_KEY with PIPEVERIFY_LLM_MODEL
174
+ pip install "pipeverify[ai]"
175
+ pipeverify run --explain
176
+ ```
177
+
178
+ This adds a short plain-English explanation of what probably happened and what to check next.
179
+ It is off by default. Only the findings are sent (check names, counts, percentages, column names);
180
+ example values from your data are removed first. The verdict never depends on the LLM.
181
+
182
+ ## Roadmap
183
+
184
+ - Native adapters for dbt (compare a PR's models against production), Airflow and Spark
185
+ - Sampling and pushdown for very large tables, so checks run in the warehouse
186
+ - Rules learned from history: what "normal" change looks like for each table
187
+ - Agent integration: a guardrail that coding and data agents call before applying a change
188
+
189
+ Ideas and pull requests are welcome; see [CONTRIBUTING.md](CONTRIBUTING.md).
190
+
191
+ ## Status
192
+
193
+ Alpha. The checks and verdicts are stable enough to try in CI; options and output formats may
194
+ still change before 1.0.
195
+
196
+ ## Citation
197
+
198
+ If you use pipeverify in research, please cite the PipeMend benchmark that motivated it
199
+ (see [CITATION.cff](CITATION.cff)).
200
+
201
+ ## License
202
+
203
+ Apache-2.0
@@ -0,0 +1,8 @@
1
+ """pipeverify: check that a pipeline change left the data right, not just the job green."""
2
+
3
+ __version__ = "0.1.0"
4
+
5
+ from .checks import Finding, Thresholds # noqa: E402
6
+ from .core import RunResult, TableResult, run_config, verify # noqa: E402
7
+
8
+ __all__ = ["verify", "run_config", "Thresholds", "Finding", "TableResult", "RunResult", "__version__"]