runproof-engine 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,151 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction, and
10
+ distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common control
17
+ with that entity. For the purposes of this definition, "control" means
18
+ (i) the power, direct or indirect, to cause the direction or management of
19
+ such entity, whether by contract or otherwise, or (ii) ownership of fifty
20
+ percent (50%) or more of the outstanding shares, or (iii) beneficial ownership
21
+ of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity exercising
24
+ permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation source,
28
+ and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical transformation
31
+ or translation of a Source form, including but not limited to compiled
32
+ object code, generated documentation, and conversions to other media types.
33
+
34
+ "Work" shall mean the work of authorship, whether in Source or Object form,
35
+ made available under the License, as indicated by a copyright notice that is
36
+ included in or attached to the work (an example is provided in the Appendix
37
+ below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object form,
40
+ that is based on (or derived from) the Work and for which the editorial
41
+ revisions, annotations, elaborations, or other modifications represent, as a
42
+ whole, an original work of authorship. For the purposes of this License,
43
+ Derivative Works shall not include works that remain separable from, or
44
+ merely link (or bind by name) to the interfaces of, the Work and Derivative
45
+ Works thereof.
46
+
47
+ "Contribution" shall mean any work of authorship, including the original
48
+ version of the Work and any modifications or additions to that Work or
49
+ Derivative Works thereof, that is intentionally submitted to Licensor for
50
+ inclusion in the Work by the copyright owner or by an individual or Legal
51
+ Entity authorized to submit on behalf of the copyright owner. For the purposes
52
+ of this definition, "submitted" means any form of electronic, verbal, or
53
+ written communication sent to the Licensor or its representatives, including
54
+ but not limited to communication on electronic mailing lists, source code
55
+ control systems, and issue tracking systems that are managed by, or on behalf
56
+ of, the Licensor for the purpose of discussing and improving the Work, but
57
+ excluding communication that is conspicuously marked or otherwise designated
58
+ in writing by the copyright owner as "Not a Contribution."
59
+
60
+ "Contributor" shall mean Licensor and any individual or Legal Entity on
61
+ behalf of whom a Contribution has been received by Licensor and subsequently
62
+ incorporated within the Work.
63
+
64
+ 2. Grant of Copyright License. Subject to the terms and conditions of this
65
+ License, each Contributor hereby grants to You a perpetual, worldwide,
66
+ non-exclusive, no-charge, royalty-free, irrevocable copyright license to
67
+ reproduce, prepare Derivative Works of, publicly display, publicly perform,
68
+ sublicense, and distribute the Work and such Derivative Works in Source or
69
+ Object form.
70
+
71
+ 3. Grant of Patent License. Subject to the terms and conditions of this
72
+ License, each Contributor hereby grants to You a perpetual, worldwide,
73
+ non-exclusive, no-charge, royalty-free, irrevocable (except as stated in
74
+ this section) patent license to make, have made, use, offer to sell, sell,
75
+ import, and otherwise transfer the Work, where such license applies only to
76
+ those patent claims licensable by such Contributor that are necessarily
77
+ infringed by their Contribution(s) alone or by combination of their
78
+ Contribution(s) with the Work to which such Contribution(s) was submitted.
79
+
80
+ 4. Redistribution. You may reproduce and distribute copies of the Work or
81
+ Derivative Works thereof in any medium, with or without modifications, and in
82
+ Source or Object form, provided that You meet the following conditions:
83
+
84
+ (a) You must give any other recipients of the Work or Derivative Works a copy
85
+ of this License; and
86
+
87
+ (b) You must cause any modified files to carry prominent notices stating
88
+ that You changed the files; and
89
+
90
+ (c) You must retain, in the Source form of any Derivative Works that You
91
+ distribute, all copyright, patent, trademark, and attribution notices from
92
+ the Source form of the Work, excluding those notices that do not pertain to
93
+ any part of the Derivative Works; and
94
+
95
+ (d) If the Work includes a "NOTICE" text file as part of its distribution,
96
+ then any Derivative Works that You distribute must include a readable copy
97
+ of the attribution notices contained within such NOTICE file, excluding
98
+ those notices that do not pertain to any part of the Derivative Works, in at
99
+ least one of the following places: within a NOTICE text file distributed as
100
+ part of the Derivative Works; within the Source form or documentation, if
101
+ provided along with the Derivative Works; or, within a display generated by
102
+ the Derivative Works, if and wherever such third-party notices normally
103
+ appear. The contents of the NOTICE file are for informational purposes only
104
+ and do not modify the License. You may add Your own attribution notices
105
+ within Derivative Works that You distribute, alongside or as an addendum to
106
+ the NOTICE text from the Work, provided that such additional attribution
107
+ notices cannot be construed as modifying the License.
108
+
109
+ 5. Submission of Contributions. Unless You explicitly state otherwise, any
110
+ Contribution intentionally submitted for inclusion in the Work by You to the
111
+ Licensor shall be under the terms and conditions of this License, without any
112
+ additional terms or conditions. Notwithstanding the above, nothing herein
113
+ shall supersede or modify the terms of any separate license agreement you may
114
+ have executed with Licensor regarding such Contributions.
115
+
116
+ 6. Trademarks. This License does not grant permission to use the trade names,
117
+ trademarks, service marks, or product names of the Licensor, except as required
118
+ for reasonable and customary use in describing the origin of the Work and
119
+ reproducing the content of the NOTICE file.
120
+
121
+ 7. Disclaimer of Warranty. Unless required by applicable law or agreed to in
122
+ writing, Licensor provides the Work (and each Contributor provides its
123
+ Contributions) on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
124
+ KIND, either express or implied, including, without limitation, any warranties
125
+ or conditions of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
126
+ PARTICULAR PURPOSE. You are solely responsible for determining the
127
+ appropriateness of using or redistributing the Work and assume any risks
128
+ associated with Your exercise of permissions under this License.
129
+
130
+ 8. Limitation of Liability. In no event and under no legal theory, whether in
131
+ tort (including negligence), contract, or otherwise, unless required by
132
+ applicable law (such as deliberate and grossly negligent acts) or agreed to in
133
+ writing, shall any Contributor be liable to You for damages, including any
134
+ direct, indirect, special, incidental, or consequential damages of any
135
+ character arising as a result of this License or out of the use or inability
136
+ to use the Work (including but not limited to damages for loss of goodwill,
137
+ work stoppage, computer failure or malfunction, or any and all other
138
+ commercial damages or losses), even if such Contributor has been advised of
139
+ the possibility of such damages.
140
+
141
+ 9. Accepting Warranty or Additional Liability. While redistributing the Work
142
+ or Derivative Works thereof, You may choose to offer, and charge a fee for,
143
+ acceptance of support, warranty, indemnity, or other liability obligations
144
+ and/or rights consistent with this License. However, in accepting such
145
+ obligations, You may act only on Your own behalf and on Your sole
146
+ responsibility, not on behalf of any other Contributor, and only if You agree
147
+ to indemnify, defend, and hold each Contributor harmless for any liability
148
+ incurred by, or claims asserted against, such Contributor by reason of your
149
+ accepting any such warranty or additional liability.
150
+
151
+ END OF TERMS AND CONDITIONS
@@ -0,0 +1,94 @@
1
+ Metadata-Version: 2.1
2
+ Name: runproof-engine
3
+ Version: 0.1.0
4
+ Summary: Evidence, replay, and explainable diffs for real Python runs
5
+ Author: RunProof Contributors
6
+ License: Apache-2.0
7
+ Keywords: reproducibility,provenance,data-lineage,observability,python,replay,explainable-diff
8
+ Classifier: Development Status :: 3 - Alpha
9
+ Classifier: Intended Audience :: Developers
10
+ Classifier: Intended Audience :: Science/Research
11
+ Classifier: License :: OSI Approved :: Apache Software License
12
+ Classifier: Programming Language :: Python :: 3
13
+ Classifier: Programming Language :: Python :: 3 :: Only
14
+ Classifier: Topic :: Software Development :: Testing
15
+ Classifier: Topic :: Scientific/Engineering :: Information Analysis
16
+ Requires-Python: >=3.10
17
+ Description-Content-Type: text/markdown
18
+ Provides-Extra: data
19
+ Provides-Extra: dev
20
+ License-File: LICENSE
21
+
22
+ # RunProof
23
+
24
+ RunProof is a Python library for recording, validating, replaying, and comparing real computational runs. It turns a Python execution into an inspectable artifact containing inputs, outputs, code references, environment metadata, checks, and an execution trace.
25
+
26
+ The distinctive feature is **Explainable Diff**: when two runs differ, RunProof compares input fingerprints, schemas, output summaries, step status, code fingerprints, and environment metadata, then reports evidence-backed causes instead of only saying that the runs are different.
27
+
28
+ ## What it is
29
+
30
+ RunProof is a local-first execution record and reproducibility layer for Python workflows. It is useful for data analysis, reports, ML experiments, research software, API workflows, and any process where the result must be explained later.
31
+
32
+ RunProof is not a reverse-engineering tool, a code generator, a replacement for Git, or a guarantee that a scientific conclusion is correct. It records and validates the execution that was declared to it.
33
+
34
+ ## Quick start
35
+
36
+ ```python
37
+ from runproof_engine import verified
38
+
39
+
40
+ def clean_rows(rows):
41
+ return [row for row in rows if row["amount"] >= 0]
42
+
43
+
44
+ def total(rows):
45
+ return sum(row["amount"] for row in rows)
46
+
47
+ with verified("sales_total", root="runs") as run:
48
+ rows = run.input("sales.json", name="sales")
49
+ cleaned = run.step("clean_rows", clean_rows, rows)
50
+ result = run.step("total", total, cleaned)
51
+ run.assert_true(result >= 0, "total must be non-negative")
52
+ run.output("total.json", {"total": result})
53
+
54
+ print(run.result.status)
55
+ print(run.result.artifact_dir)
56
+ ```
57
+
58
+ This creates a run directory with a manifest, input metadata, output metadata, trace events, checks, and an environment snapshot. The input is not silently replaced by generated data. File contents are fingerprinted, while copying full inputs is explicit and configurable.
59
+
60
+ ## Replay and comparison
61
+
62
+ ```python
63
+ from runproof_engine import load_run
64
+
65
+ previous = load_run("runs/sales_total/20260823-101500-abc123")
66
+ replayed = previous.replay(mode="strict")
67
+ print(replayed.status)
68
+
69
+ comparison = previous.diff(replayed)
70
+ print(comparison.to_dict())
71
+ print(comparison.render())
72
+ ```
73
+
74
+ `strict` replay uses the captured input when it is available and checks whether the new execution remains comparable. A fresh run can use current inputs and can be compared with a previous run to identify changes.
75
+
76
+ ## Statuses
77
+
78
+ - `verified`: execution completed and all declared checks passed.
79
+ - `verified_with_warnings`: execution completed but comparability or external-source evidence is limited.
80
+ - `failed`: execution or a required check failed.
81
+ - `blocked`: a declared policy prevented a sensitive action.
82
+ - `non_reproducible`: replay was attempted but did not match the captured run.
83
+
84
+ ## Privacy and real data
85
+
86
+ RunProof records metadata and hashes by default. Full input copying is opt-in. Secrets are redacted from environment snapshots and trace values. External adapters must provide privacy-safe request metadata instead of storing credentials or raw authorization headers.
87
+
88
+ ## Project status
89
+
90
+ The current repository implements the local core: run lifecycle, file fingerprints, JSON-safe artifacts, step tracing, assertions, replay, and explainable diffs. Optional integrations are intentionally separated from the core so the library remains useful without a cloud account or a specific AI provider.
91
+
92
+ ## License
93
+
94
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,73 @@
1
+ # RunProof
2
+
3
+ RunProof is a Python library for recording, validating, replaying, and comparing real computational runs. It turns a Python execution into an inspectable artifact containing inputs, outputs, code references, environment metadata, checks, and an execution trace.
4
+
5
+ The distinctive feature is **Explainable Diff**: when two runs differ, RunProof compares input fingerprints, schemas, output summaries, step status, code fingerprints, and environment metadata, then reports evidence-backed causes instead of only saying that the runs are different.
6
+
7
+ ## What it is
8
+
9
+ RunProof is a local-first execution record and reproducibility layer for Python workflows. It is useful for data analysis, reports, ML experiments, research software, API workflows, and any process where the result must be explained later.
10
+
11
+ RunProof is not a reverse-engineering tool, a code generator, a replacement for Git, or a guarantee that a scientific conclusion is correct. It records and validates the execution that was declared to it.
12
+
13
+ ## Quick start
14
+
15
+ ```python
16
+ from runproof_engine import verified
17
+
18
+
19
+ def clean_rows(rows):
20
+ return [row for row in rows if row["amount"] >= 0]
21
+
22
+
23
+ def total(rows):
24
+ return sum(row["amount"] for row in rows)
25
+
26
+ with verified("sales_total", root="runs") as run:
27
+ rows = run.input("sales.json", name="sales")
28
+ cleaned = run.step("clean_rows", clean_rows, rows)
29
+ result = run.step("total", total, cleaned)
30
+ run.assert_true(result >= 0, "total must be non-negative")
31
+ run.output("total.json", {"total": result})
32
+
33
+ print(run.result.status)
34
+ print(run.result.artifact_dir)
35
+ ```
36
+
37
+ This creates a run directory with a manifest, input metadata, output metadata, trace events, checks, and an environment snapshot. The input is not silently replaced by generated data. File contents are fingerprinted, while copying full inputs is explicit and configurable.
38
+
39
+ ## Replay and comparison
40
+
41
+ ```python
42
+ from runproof_engine import load_run
43
+
44
+ previous = load_run("runs/sales_total/20260823-101500-abc123")
45
+ replayed = previous.replay(mode="strict")
46
+ print(replayed.status)
47
+
48
+ comparison = previous.diff(replayed)
49
+ print(comparison.to_dict())
50
+ print(comparison.render())
51
+ ```
52
+
53
+ `strict` replay uses the captured input when it is available and checks whether the new execution remains comparable. A fresh run can use current inputs and can be compared with a previous run to identify changes.
54
+
55
+ ## Statuses
56
+
57
+ - `verified`: execution completed and all declared checks passed.
58
+ - `verified_with_warnings`: execution completed but comparability or external-source evidence is limited.
59
+ - `failed`: execution or a required check failed.
60
+ - `blocked`: a declared policy prevented a sensitive action.
61
+ - `non_reproducible`: replay was attempted but did not match the captured run.
62
+
63
+ ## Privacy and real data
64
+
65
+ RunProof records metadata and hashes by default. Full input copying is opt-in. Secrets are redacted from environment snapshots and trace values. External adapters must provide privacy-safe request metadata instead of storing credentials or raw authorization headers.
66
+
67
+ ## Project status
68
+
69
+ The current repository implements the local core: run lifecycle, file fingerprints, JSON-safe artifacts, step tracing, assertions, replay, and explainable diffs. Optional integrations are intentionally separated from the core so the library remains useful without a cloud account or a specific AI provider.
70
+
71
+ ## License
72
+
73
+ Apache-2.0. See `LICENSE`.
@@ -0,0 +1,46 @@
1
+ [build-system]
2
+ requires = ["setuptools>=68"]
3
+ build-backend = "setuptools.build_meta"
4
+
5
+ [project]
6
+ name = "runproof-engine"
7
+ version = "0.1.0"
8
+ description = "Evidence, replay, and explainable diffs for real Python runs"
9
+ readme = "README.md"
10
+ requires-python = ">=3.10"
11
+ license = { text = "Apache-2.0" }
12
+ authors = [
13
+ { name = "RunProof Contributors" }
14
+ ]
15
+ keywords = ["reproducibility", "provenance", "data-lineage", "observability", "python", "replay", "explainable-diff"]
16
+ classifiers = [
17
+ "Development Status :: 3 - Alpha",
18
+ "Intended Audience :: Developers",
19
+ "Intended Audience :: Science/Research",
20
+ "License :: OSI Approved :: Apache Software License",
21
+ "Programming Language :: Python :: 3",
22
+ "Programming Language :: Python :: 3 :: Only",
23
+ "Topic :: Software Development :: Testing",
24
+ "Topic :: Scientific/Engineering :: Information Analysis",
25
+ ]
26
+ dependencies = []
27
+
28
+ [project.optional-dependencies]
29
+ data = ["pandas>=2.0"]
30
+ dev = ["pytest>=8", "ruff>=0.6"]
31
+
32
+ [project.scripts]
33
+ runproof = "runproof_engine.cli:main"
34
+
35
+ [tool.setuptools]
36
+ package-dir = {"" = "src"}
37
+
38
+ [tool.setuptools.packages.find]
39
+ where = ["src"]
40
+
41
+ [tool.setuptools.package-data]
42
+ runproof_engine = ["py.typed"]
43
+
44
+ [tool.pytest.ini_options]
45
+ testpaths = ["tests"]
46
+ addopts = "-q"
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
@@ -0,0 +1,33 @@
1
+ from .core import (
2
+ CheckRecord,
3
+ ReplayUnavailable,
4
+ RunContext,
5
+ RunProofError,
6
+ RunResult,
7
+ StepRecord,
8
+ verified,
9
+ )
10
+ from .diff import Difference, RunDiff, compare_manifests
11
+ from .policy import Policy, PolicyDenied, safe_default_policy
12
+ from .replay import LoadedRun, ReplayReport, load_run
13
+
14
+ __all__ = [
15
+ "CheckRecord",
16
+ "Difference",
17
+ "LoadedRun",
18
+ "Policy",
19
+ "PolicyDenied",
20
+ "ReplayReport",
21
+ "ReplayUnavailable",
22
+ "RunContext",
23
+ "RunDiff",
24
+ "RunProofError",
25
+ "RunResult",
26
+ "StepRecord",
27
+ "compare_manifests",
28
+ "load_run",
29
+ "safe_default_policy",
30
+ "verified",
31
+ ]
32
+
33
+ __version__ = "0.1.0"
@@ -0,0 +1,69 @@
1
+ from __future__ import annotations
2
+
3
+ import argparse
4
+ import json
5
+ import sys
6
+ from pathlib import Path
7
+
8
+ from .replay import LoadedRun, load_run
9
+
10
+
11
+ def build_parser() -> argparse.ArgumentParser:
12
+ parser = argparse.ArgumentParser(prog="runproof", description="Inspect and compare RunProof artifacts")
13
+ subparsers = parser.add_subparsers(dest="command", required=True)
14
+
15
+ inspect_parser = subparsers.add_parser("inspect", help="inspect a run artifact")
16
+ inspect_parser.add_argument("path", type=Path)
17
+ inspect_parser.add_argument("--json", action="store_true", dest="as_json")
18
+
19
+ verify_parser = subparsers.add_parser("verify", help="verify input and output integrity")
20
+ verify_parser.add_argument("path", type=Path)
21
+ verify_parser.add_argument("--json", action="store_true", dest="as_json")
22
+
23
+ diff_parser = subparsers.add_parser("diff", help="compare two run artifacts")
24
+ diff_parser.add_argument("left", type=Path)
25
+ diff_parser.add_argument("right", type=Path)
26
+ diff_parser.add_argument("--json", action="store_true", dest="as_json")
27
+ return parser
28
+
29
+
30
+ def main(argv: list[str] | None = None) -> int:
31
+ parser = build_parser()
32
+ args = parser.parse_args(argv)
33
+ try:
34
+ if args.command == "inspect":
35
+ run = load_run(args.path)
36
+ payload = run.manifest
37
+ text = json.dumps(payload, indent=2, ensure_ascii=False) if args.as_json else _inspect_text(run)
38
+ elif args.command == "verify":
39
+ run = load_run(args.path)
40
+ report = run.verify_integrity()
41
+ payload = report.to_dict()
42
+ text = json.dumps(payload, indent=2, ensure_ascii=False) if args.as_json else str(report)
43
+ print(text)
44
+ return 0 if report.status == "verified" else 2
45
+ else:
46
+ left = load_run(args.left)
47
+ right = load_run(args.right)
48
+ comparison = left.diff(right)
49
+ payload = comparison.to_dict()
50
+ text = json.dumps(payload, indent=2, ensure_ascii=False) if args.as_json else comparison.render()
51
+ print(text)
52
+ return 0
53
+ except (OSError, ValueError, KeyError) as error:
54
+ print(f"runproof: {error}", file=sys.stderr)
55
+ return 2
56
+
57
+
58
+ def _inspect_text(run: LoadedRun) -> str:
59
+ manifest = run.manifest
60
+ run_info = manifest.get("run", {})
61
+ return "\n".join([
62
+ f"name: {run_info.get('name')}",
63
+ f"run_id: {run_info.get('run_id')}",
64
+ f"status: {run_info.get('status')}",
65
+ f"inputs: {len(manifest.get('inputs', []))}",
66
+ f"steps: {len(manifest.get('steps', []))}",
67
+ f"outputs: {len(manifest.get('outputs', []))}",
68
+ f"checks: {len(manifest.get('checks', []))}",
69
+ ])