pmprov 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.
pmprov-0.1.0/LICENSE ADDED
@@ -0,0 +1,187 @@
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,
10
+ and 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
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising 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
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship made available under
36
+ the License, as indicated by a copyright notice that is included in
37
+ or attached to the work (an example is provided in the Appendix below).
38
+
39
+ "Derivative Works" shall mean any work, whether in Source or Object
40
+ form, that is based on (or derived from) the Work and for which the
41
+ editorial revisions, annotations, elaborations, or other transformations
42
+ represent, as a whole, an original work of authorship. For the purposes
43
+ of this License, Derivative Works shall not include works that remain
44
+ separable from, or merely link (or bind by name) to the interfaces of,
45
+ the Work and Derivative Works thereof.
46
+
47
+ "Contribution" shall mean, as submitted to the Licensor for inclusion
48
+ in the Work by the copyright owner or by an individual or Legal Entity
49
+ authorized to submit on behalf of the copyright owner. For the purposes
50
+ of this definition, "submitted" means any form of electronic, verbal,
51
+ or written communication sent to the Licensor or its representatives,
52
+ including but not limited to communication on electronic mailing lists,
53
+ source code control systems, and issue tracking systems that are managed
54
+ by, or on behalf of, the Licensor for the purpose of discussing and
55
+ improving the Work, but excluding communication that is conspicuously
56
+ marked or designated in writing by the copyright owner as "Not a
57
+ Contribution."
58
+
59
+ "Contributor" shall mean Licensor and any Legal Entity on behalf of
60
+ whom a Contribution has been received by the Licensor and included
61
+ within the Work.
62
+
63
+ 2. Grant of Copyright License. Subject to the terms and conditions of
64
+ this License, each Contributor hereby grants to You a perpetual,
65
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
66
+ copyright license to reproduce, prepare Derivative Works of,
67
+ publicly display, publicly perform, sublicense, and distribute the
68
+ Work and such Derivative Works in Source or Object form.
69
+
70
+ 3. Grant of Patent License. Subject to the terms and conditions of
71
+ this License, each Contributor hereby grants to You a perpetual,
72
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
73
+ (except as stated in this section) patent license to make, have made,
74
+ use, offer to sell, sell, import, and otherwise transfer the Work,
75
+ where such license applies only to those patent claims licensable
76
+ by such Contributor that are necessarily infringed by their
77
+ Contribution(s) alone or by the combination of their Contribution(s)
78
+ with the Work to which such Contribution(s) was submitted. If You
79
+ institute patent litigation against any entity (including a cross-claim
80
+ or counterclaim in a lawsuit) alleging that the Work or any
81
+ Contribution embodied within the Work constitutes direct or
82
+ contributory patent infringement, then any patent licenses granted
83
+ to You under this License for that Work shall terminate as of the
84
+ date such litigation is filed.
85
+
86
+ 4. Redistribution. You may reproduce and distribute copies of the
87
+ Work or Derivative Works thereof in any medium, with or without
88
+ modifications, and in Source or Object form, provided that You
89
+ meet the following conditions:
90
+
91
+ (a) You must give any other recipients of the Work or Derivative
92
+ Works a copy of this License; and
93
+
94
+ (b) You must cause any modified files to carry prominent notices
95
+ stating that You changed the files; and
96
+
97
+ (c) You must retain, in the Source form of any Derivative Works
98
+ that You distribute, all copyright, patent, trademark, and
99
+ attribution notices from the Source form of the Work,
100
+ excluding those notices that do not pertain to any part of
101
+ the Derivative Works; and
102
+
103
+ (d) If the Work includes a "NOTICE" text file as part of its
104
+ distribution, You must include a readable copy of the
105
+ attribution notices contained within such NOTICE file, in
106
+ at least one of the following places: within a NOTICE text
107
+ file distributed as part of the Derivative Works; within
108
+ the Source form or documentation, if provided along with the
109
+ Derivative Works; or, within a display generated by the
110
+ Derivative Works, if and wherever such third-party notices
111
+ normally appear. The contents of the NOTICE file are for
112
+ informational purposes only and do not modify the License.
113
+ You may add Your own attribution notices within Derivative
114
+ Works that You distribute, alongside or in addition to the
115
+ NOTICE text from the Work, provided that such additional
116
+ attribution notices cannot be construed as modifying the
117
+ License.
118
+
119
+ You may add Your own license statement for Your modifications and
120
+ may provide additional grant of rights to use, copy, modify, merge,
121
+ publish, distribute, sublicense, and/or sell copies of the
122
+ Derivative Works, as separate terms and conditions for use,
123
+ reproduction, or distribution of such Derivative Works, as a whole,
124
+ provided Your use, reproduction, and distribution of the Work
125
+ otherwise complies with the conditions stated in this License.
126
+
127
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
128
+ any Contribution intentionally submitted for inclusion in the Work
129
+ by You to the Licensor shall be under the terms and conditions of
130
+ this License, without any additional terms or conditions.
131
+ Notwithstanding the above, nothing herein shall supersede or modify
132
+ the terms of any separate license agreement you may have executed
133
+ with Licensor regarding such Contributions.
134
+
135
+ 6. Trademarks. This License does not grant permission to use the trade
136
+ names, trademarks, service marks, or product names of the Licensor,
137
+ except as required for reasonable and customary use in describing the
138
+ origin of the Work and reproducing the content of the NOTICE file.
139
+
140
+ 7. Disclaimer of Warranty. Unless required by applicable law or
141
+ agreed to in writing, Licensor provides the Work (and each
142
+ Contributor provides its Contributions) on an "AS IS" BASIS,
143
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
144
+ implied, including, without limitation, any warranties or conditions
145
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
146
+ PARTICULAR PURPOSE. You are solely responsible for determining the
147
+ appropriateness of using or reproducing the Work and assume any
148
+ risks associated with Your exercise of permissions under this License.
149
+
150
+ 8. Limitation of Liability. In no event and under no legal theory,
151
+ whether in tort (including negligence), contract, or otherwise,
152
+ unless required by applicable law (such as deliberate and grossly
153
+ negligent acts) or agreed to in writing, shall any Contributor be
154
+ liable to You for damages, including any direct, indirect, special,
155
+ incidental, or exemplary damages of any character arising as a
156
+ result of this License or out of the use or inability to use the
157
+ Work (including but not limited to damages for loss of goodwill,
158
+ work stoppage, computer failure or malfunction, or all other
159
+ commercial damages or losses), even if such Contributor has been
160
+ advised of the possibility of such damages.
161
+
162
+ 9. Accepting Warranty or Additional Liability. While redistributing
163
+ the Work or Derivative Works thereof, You may offer, and charge a
164
+ fee for, acceptance of support, warranty, indemnity, or other
165
+ liability obligations and/or rights consistent with this License.
166
+ However, in accepting such obligations, You may offer such additional
167
+ terms only on Your own behalf and on Your sole responsibility, not on
168
+ behalf of any other Contributor, and only if You agree to indemnify,
169
+ defend, and hold each Contributor harmless for any liability
170
+ incurred by, or claims asserted against, such Contributor by reason
171
+ of your accepting any such warranty or additional liability.
172
+
173
+ END OF TERMS AND CONDITIONS
174
+
175
+ Copyright 2024 Álvaro Bernal Caunedo
176
+
177
+ Licensed under the Apache License, Version 2.0 (the "License");
178
+ you may not use this file except in compliance with the License.
179
+ You may obtain a copy of the License at
180
+
181
+ http://www.apache.org/licenses/LICENSE-2.0
182
+
183
+ Unless required by applicable law or agreed to in writing, software
184
+ distributed under the License is distributed on an "AS IS" BASIS,
185
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
186
+ See the License for the specific language governing permissions and
187
+ limitations under the License.
pmprov-0.1.0/PKG-INFO ADDED
@@ -0,0 +1,193 @@
1
+ Metadata-Version: 2.4
2
+ Name: pmprov
3
+ Version: 0.1.0
4
+ Summary: Analytic provenance tracking middleware for exploratory process mining.
5
+ Requires-Python: >=3.13
6
+ Description-Content-Type: text/markdown
7
+ License-File: LICENSE
8
+ Requires-Dist: ipywidgets==8.1.8
9
+ Requires-Dist: marimo==0.23.10
10
+ Requires-Dist: matplotlib==3.11.0
11
+ Requires-Dist: pandas==3.0.3
12
+ Requires-Dist: plotly==6.8.0
13
+ Requires-Dist: pyarrow==24.0.0
14
+ Requires-Dist: pydantic==2.13.4
15
+ Provides-Extra: duckdb
16
+ Requires-Dist: duckdb==1.5.4; extra == "duckdb"
17
+ Provides-Extra: parquet
18
+ Requires-Dist: pyarrow==24.0.0; extra == "parquet"
19
+ Provides-Extra: graph
20
+ Requires-Dist: networkx==3.6.1; extra == "graph"
21
+ Requires-Dist: matplotlib==3.11.0; extra == "graph"
22
+ Provides-Extra: widgets
23
+ Requires-Dist: ipywidgets==8.1.8; extra == "widgets"
24
+ Provides-Extra: full
25
+ Requires-Dist: duckdb==1.5.4; extra == "full"
26
+ Requires-Dist: pyarrow==24.0.0; extra == "full"
27
+ Requires-Dist: networkx==3.6.1; extra == "full"
28
+ Requires-Dist: matplotlib==3.11.0; extra == "full"
29
+ Requires-Dist: ipywidgets==8.1.8; extra == "full"
30
+ Dynamic: license-file
31
+
32
+ # pmprov
33
+
34
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/alvarobernal2412/pmprov)
35
+
36
+ **Analytic provenance tracking middleware for exploratory process mining notebooks.**
37
+
38
+ `pmprov` automatically records every meaningful decision an analyst makes during a Jupyter or Marimo session — which functions were called, with what arguments, on which data, and how the data changed — without requiring any modification to analyst code.
39
+
40
+ ---
41
+
42
+ ## How it works
43
+
44
+ ```
45
+ Your cell code → AST rewriter → trace_step() → DuckDB/SQLite + Parquet
46
+ (transparent) (non-blocking)
47
+ ```
48
+
49
+ Every top-level function call is intercepted at the AST level, wrapped with a lightweight tracer, and recorded as a node in a provenance tree. The analyst's variables contain exactly the same values they would without the middleware.
50
+
51
+ ---
52
+
53
+ ## Getting started
54
+
55
+ **Prerequisites:** Python ≥ 3.13, [`uv`](https://docs.astral.sh/uv/)
56
+
57
+ ```bash
58
+ git clone https://github.com/alvarobernal2412/pmprov.git
59
+ cd pmprov
60
+ uv pip install -e ".[full]"
61
+ ```
62
+
63
+ **In a Jupyter notebook:**
64
+
65
+ ```python
66
+ from tracker import init_jupyter, operation_type
67
+ import pandas as pd
68
+ import pm4py
69
+
70
+ # Register semantic labels for third-party functions (optional but recommended)
71
+ operation_type("data_loading", pd.read_csv)
72
+ operation_type("process_discovery", pm4py.discover_petri_net_inductive)
73
+
74
+ # Start tracking — one call, no other changes to your code
75
+ rt = init_jupyter(history_name="My analysis")
76
+
77
+ # Your normal analysis code below — provenance is captured automatically
78
+ event_log = pd.read_csv("data/log.csv", parse_dates=["time:timestamp"])
79
+ net, im, fm = pm4py.discover_petri_net_inductive(event_log)
80
+ ```
81
+
82
+ **In a Marimo notebook:**
83
+
84
+ Marimo support requires a one-time setup step. The middleware patches Marimo's AST compiler at Python startup via `sitecustomize.py`, which must be placed in your virtual environment (already in place if installed via `uv`).
85
+
86
+ **Structural requirement:** Marimo's reactive DAG is built from the original cell code *before* the AST rewriter runs. This means the rewriter cannot inject dependency edges automatically. To guarantee that `init_marimo()` runs before any tracked cell, **combine your path setup and `init_marimo()` call in one cell** and export all imports (`pd`, constants, etc.) from it. Downstream cells then depend on those names naturally, which implicitly orders them after init — no need to add `rt` to every cell's parameters.
87
+
88
+ ```python
89
+ # ── Setup + init (one cell) ───────────────────────────────────────────────────
90
+ @app.cell
91
+ def _():
92
+ import sys, pandas as pd
93
+ from pathlib import Path
94
+ from tracker import init_marimo, operation_type
95
+
96
+ # ... path setup ...
97
+
98
+ rt = init_marimo(history_name="My analysis")
99
+ operation_type("data_loading", pd.read_csv)
100
+
101
+ def settle():
102
+ rt.storage._executor.submit(lambda: None).result()
103
+
104
+ return pd, rt, settle, DATA_FILE # export everything downstream cells need
105
+
106
+
107
+ # ── Analysis cells — no `rt` needed in params ─────────────────────────────────
108
+ @app.cell
109
+ def _(DATA_FILE, pd): # depends on pd + DATA_FILE → init already ran
110
+ event_log = pd.read_csv(DATA_FILE, parse_dates=["time:timestamp"])
111
+ return (event_log,)
112
+ ```
113
+
114
+ Run with:
115
+ ```bash
116
+ uv run marimo run examples/marimo/provenance_demo.py
117
+ # or for interactive editing:
118
+ uv run marimo edit examples/marimo/provenance_demo.py
119
+ ```
120
+
121
+ > **Note:** Provenance capture works in Marimo. Some introspection features (interactive widget, manual checkout) are not yet validated in the Marimo environment.
122
+
123
+ **Inspect the provenance graph:**
124
+
125
+ ```python
126
+ rt.list_states() # table of all recorded steps
127
+ rt.show_graph() # static matplotlib tree
128
+ rt.show_graph_widget() # interactive Jupyter widget (Jupyter only)
129
+ ```
130
+
131
+ **Branch from a past state:**
132
+
133
+ ```python
134
+ branch = rt.checkout("paste-state-id-here", branch_name="experiment-v2")
135
+ ```
136
+
137
+ See [`examples/jupyter/provenance_demo.ipynb`](examples/jupyter/provenance_demo.ipynb) for a full Jupyter walkthrough and [`examples/marimo/provenance_demo.py`](examples/marimo/provenance_demo.py) for the Marimo equivalent, both using the RTFM dataset.
138
+
139
+ ---
140
+
141
+ ## Optional extras
142
+
143
+ | Extra | What it adds |
144
+ |---|---|
145
+ | `duckdb` | DuckDB storage backend (preferred) |
146
+ | `parquet` | DataFrame artifact persistence via pyarrow |
147
+ | `graph` | `show_graph()` via networkx + matplotlib |
148
+ | `widgets` | `show_graph_widget()` interactive panel |
149
+ | `marimo` | Marimo notebook support |
150
+ | `full` | Everything above |
151
+
152
+ ```bash
153
+ uv pip install -e ".[full]"
154
+ ```
155
+
156
+ ---
157
+
158
+ ## Project structure
159
+
160
+ ```
161
+ models/ Pydantic v2 domain models (provenance entities)
162
+ tracker/ Runtime middleware (AST rewriter, tracer, storage)
163
+ examples/ Demo notebook + RTFM dataset helpers
164
+ ```
165
+
166
+ ---
167
+
168
+ ## Running tests
169
+
170
+ ```bash
171
+ uv sync --all-extras --dev
172
+ uv run pytest
173
+ ```
174
+
175
+ ## Git hooks (optional)
176
+
177
+ Enforces the test suite and conventional commit format (≤ 45 chars) on every commit:
178
+
179
+ ```bash
180
+ uv run pre-commit install && uv run pre-commit install --hook-type commit-msg
181
+ ```
182
+
183
+ Skip this step if you prefer to run checks manually.
184
+
185
+ ---
186
+
187
+ ## Contributing
188
+
189
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
190
+
191
+ ## License
192
+
193
+ Apache 2.0 — see [LICENSE](LICENSE).
pmprov-0.1.0/README.md ADDED
@@ -0,0 +1,162 @@
1
+ # pmprov
2
+
3
+ [![Ask DeepWiki](https://deepwiki.com/badge.svg)](https://deepwiki.com/alvarobernal2412/pmprov)
4
+
5
+ **Analytic provenance tracking middleware for exploratory process mining notebooks.**
6
+
7
+ `pmprov` automatically records every meaningful decision an analyst makes during a Jupyter or Marimo session — which functions were called, with what arguments, on which data, and how the data changed — without requiring any modification to analyst code.
8
+
9
+ ---
10
+
11
+ ## How it works
12
+
13
+ ```
14
+ Your cell code → AST rewriter → trace_step() → DuckDB/SQLite + Parquet
15
+ (transparent) (non-blocking)
16
+ ```
17
+
18
+ Every top-level function call is intercepted at the AST level, wrapped with a lightweight tracer, and recorded as a node in a provenance tree. The analyst's variables contain exactly the same values they would without the middleware.
19
+
20
+ ---
21
+
22
+ ## Getting started
23
+
24
+ **Prerequisites:** Python ≥ 3.13, [`uv`](https://docs.astral.sh/uv/)
25
+
26
+ ```bash
27
+ git clone https://github.com/alvarobernal2412/pmprov.git
28
+ cd pmprov
29
+ uv pip install -e ".[full]"
30
+ ```
31
+
32
+ **In a Jupyter notebook:**
33
+
34
+ ```python
35
+ from tracker import init_jupyter, operation_type
36
+ import pandas as pd
37
+ import pm4py
38
+
39
+ # Register semantic labels for third-party functions (optional but recommended)
40
+ operation_type("data_loading", pd.read_csv)
41
+ operation_type("process_discovery", pm4py.discover_petri_net_inductive)
42
+
43
+ # Start tracking — one call, no other changes to your code
44
+ rt = init_jupyter(history_name="My analysis")
45
+
46
+ # Your normal analysis code below — provenance is captured automatically
47
+ event_log = pd.read_csv("data/log.csv", parse_dates=["time:timestamp"])
48
+ net, im, fm = pm4py.discover_petri_net_inductive(event_log)
49
+ ```
50
+
51
+ **In a Marimo notebook:**
52
+
53
+ Marimo support requires a one-time setup step. The middleware patches Marimo's AST compiler at Python startup via `sitecustomize.py`, which must be placed in your virtual environment (already in place if installed via `uv`).
54
+
55
+ **Structural requirement:** Marimo's reactive DAG is built from the original cell code *before* the AST rewriter runs. This means the rewriter cannot inject dependency edges automatically. To guarantee that `init_marimo()` runs before any tracked cell, **combine your path setup and `init_marimo()` call in one cell** and export all imports (`pd`, constants, etc.) from it. Downstream cells then depend on those names naturally, which implicitly orders them after init — no need to add `rt` to every cell's parameters.
56
+
57
+ ```python
58
+ # ── Setup + init (one cell) ───────────────────────────────────────────────────
59
+ @app.cell
60
+ def _():
61
+ import sys, pandas as pd
62
+ from pathlib import Path
63
+ from tracker import init_marimo, operation_type
64
+
65
+ # ... path setup ...
66
+
67
+ rt = init_marimo(history_name="My analysis")
68
+ operation_type("data_loading", pd.read_csv)
69
+
70
+ def settle():
71
+ rt.storage._executor.submit(lambda: None).result()
72
+
73
+ return pd, rt, settle, DATA_FILE # export everything downstream cells need
74
+
75
+
76
+ # ── Analysis cells — no `rt` needed in params ─────────────────────────────────
77
+ @app.cell
78
+ def _(DATA_FILE, pd): # depends on pd + DATA_FILE → init already ran
79
+ event_log = pd.read_csv(DATA_FILE, parse_dates=["time:timestamp"])
80
+ return (event_log,)
81
+ ```
82
+
83
+ Run with:
84
+ ```bash
85
+ uv run marimo run examples/marimo/provenance_demo.py
86
+ # or for interactive editing:
87
+ uv run marimo edit examples/marimo/provenance_demo.py
88
+ ```
89
+
90
+ > **Note:** Provenance capture works in Marimo. Some introspection features (interactive widget, manual checkout) are not yet validated in the Marimo environment.
91
+
92
+ **Inspect the provenance graph:**
93
+
94
+ ```python
95
+ rt.list_states() # table of all recorded steps
96
+ rt.show_graph() # static matplotlib tree
97
+ rt.show_graph_widget() # interactive Jupyter widget (Jupyter only)
98
+ ```
99
+
100
+ **Branch from a past state:**
101
+
102
+ ```python
103
+ branch = rt.checkout("paste-state-id-here", branch_name="experiment-v2")
104
+ ```
105
+
106
+ See [`examples/jupyter/provenance_demo.ipynb`](examples/jupyter/provenance_demo.ipynb) for a full Jupyter walkthrough and [`examples/marimo/provenance_demo.py`](examples/marimo/provenance_demo.py) for the Marimo equivalent, both using the RTFM dataset.
107
+
108
+ ---
109
+
110
+ ## Optional extras
111
+
112
+ | Extra | What it adds |
113
+ |---|---|
114
+ | `duckdb` | DuckDB storage backend (preferred) |
115
+ | `parquet` | DataFrame artifact persistence via pyarrow |
116
+ | `graph` | `show_graph()` via networkx + matplotlib |
117
+ | `widgets` | `show_graph_widget()` interactive panel |
118
+ | `marimo` | Marimo notebook support |
119
+ | `full` | Everything above |
120
+
121
+ ```bash
122
+ uv pip install -e ".[full]"
123
+ ```
124
+
125
+ ---
126
+
127
+ ## Project structure
128
+
129
+ ```
130
+ models/ Pydantic v2 domain models (provenance entities)
131
+ tracker/ Runtime middleware (AST rewriter, tracer, storage)
132
+ examples/ Demo notebook + RTFM dataset helpers
133
+ ```
134
+
135
+ ---
136
+
137
+ ## Running tests
138
+
139
+ ```bash
140
+ uv sync --all-extras --dev
141
+ uv run pytest
142
+ ```
143
+
144
+ ## Git hooks (optional)
145
+
146
+ Enforces the test suite and conventional commit format (≤ 45 chars) on every commit:
147
+
148
+ ```bash
149
+ uv run pre-commit install && uv run pre-commit install --hook-type commit-msg
150
+ ```
151
+
152
+ Skip this step if you prefer to run checks manually.
153
+
154
+ ---
155
+
156
+ ## Contributing
157
+
158
+ See [CONTRIBUTING.md](CONTRIBUTING.md).
159
+
160
+ ## License
161
+
162
+ Apache 2.0 — see [LICENSE](LICENSE).
@@ -0,0 +1,78 @@
1
+ """
2
+ Pydantic data model for Analytic Provenance in Exploratory Process Mining.
3
+
4
+ Derived from: "A Conceptual Model to Enhance Process Mining Analysis with Provenance"
5
+ (ER 2026, blinded for review)
6
+
7
+ Package layout
8
+ --------------
9
+ agents – Agent, AgentType, RuntimeEnvironment
10
+ artifacts – Artifact, ArtifactType, ArtifactState, Delta, DataFrameDelta, ModificationType
11
+ parameters – Parameter, ParameterValueType, and all ParameterValue subclasses / union
12
+ operations – OperationType, StepCategory, Operation, Version
13
+ analysis – AnalysisStep, AnalysisState, StateAbstraction
14
+ history – AnalysisBranch, AnalysisHistory
15
+ pipelines – PipelineFragment, Pipeline
16
+ """
17
+
18
+ from .agents import Agent, AgentType, RuntimeEnvironment
19
+ from .analysis import AnalysisState, AnalysisStep, StateAbstraction
20
+ from .artifacts import (
21
+ Artifact,
22
+ ArtifactState,
23
+ ArtifactType,
24
+ DataFrameDelta,
25
+ Delta,
26
+ ModificationType,
27
+ )
28
+ from .history import AnalysisBranch, AnalysisHistory
29
+ from .operations import Operation, OperationType, StepCategory, Version
30
+ from .parameters import (
31
+ ArtifactStateParameterValue,
32
+ DictParameterValue,
33
+ LambdaParameterValue,
34
+ ListParameterValue,
35
+ Parameter,
36
+ ParameterValue,
37
+ ParameterValueType,
38
+ ScalarParameterValue,
39
+ )
40
+ from .pipelines import Pipeline, PipelineFragment
41
+
42
+ __all__ = [
43
+ # agents
44
+ "AgentType",
45
+ "Agent",
46
+ "RuntimeEnvironment",
47
+ # artifacts
48
+ "ArtifactType",
49
+ "ModificationType",
50
+ "Artifact",
51
+ "ArtifactState",
52
+ "Delta",
53
+ "DataFrameDelta",
54
+ # parameters
55
+ "ParameterValueType",
56
+ "Parameter",
57
+ "ScalarParameterValue",
58
+ "ArtifactStateParameterValue",
59
+ "LambdaParameterValue",
60
+ "ListParameterValue",
61
+ "DictParameterValue",
62
+ "ParameterValue",
63
+ # operations
64
+ "OperationType",
65
+ "StepCategory",
66
+ "Operation",
67
+ "Version",
68
+ # analysis
69
+ "StateAbstraction",
70
+ "AnalysisState",
71
+ "AnalysisStep",
72
+ # history
73
+ "AnalysisBranch",
74
+ "AnalysisHistory",
75
+ # pipelines
76
+ "PipelineFragment",
77
+ "Pipeline",
78
+ ]
@@ -0,0 +1,59 @@
1
+ """Agent and execution-environment models."""
2
+
3
+ from __future__ import annotations
4
+
5
+ from enum import Enum
6
+ from typing import Optional
7
+
8
+ from pydantic import BaseModel, Field
9
+
10
+
11
+ class AgentType(str, Enum):
12
+ """Distinguishes human analysts from automated scripts / systems."""
13
+
14
+ HUMAN = "human"
15
+ AUTOMATED = "automated"
16
+
17
+
18
+ class Agent(BaseModel):
19
+ """
20
+ Represents the entity (human or system) that performs an AnalysisStep.
21
+
22
+ UML attributes: agentId, agentType
23
+ """
24
+
25
+ agent_id: str = Field(..., description="Unique identifier for the agent.")
26
+ agent_type: AgentType = Field(
27
+ ..., description="Whether the agent is a human analyst or an automated system."
28
+ )
29
+ username: Optional[str] = Field(
30
+ None, description="OS username of the agent, captured at session start."
31
+ )
32
+
33
+
34
+ class RuntimeEnvironment(BaseModel):
35
+ """
36
+ Captures the execution environment of an AnalysisStep to enable reproducibility (R2).
37
+
38
+ UML attributes: envId, toolVersion, libraryVersions, runtime
39
+ """
40
+
41
+ env_id: str = Field(..., description="Unique identifier for this environment snapshot.")
42
+ tool_version: str = Field(
43
+ ..., description="Version of the primary analysis tool (e.g., Python 3.11)."
44
+ )
45
+ library_versions: dict[str, str] = Field(
46
+ default_factory=dict,
47
+ description="Map of library name → version string (e.g., {'pandas': '2.2.1'}).",
48
+ )
49
+ runtime: Optional[str] = Field(
50
+ None,
51
+ description="Free-form description of the runtime platform (OS, hardware, etc.).",
52
+ )
53
+
54
+
55
+ __all__ = [
56
+ "AgentType",
57
+ "Agent",
58
+ "RuntimeEnvironment",
59
+ ]