tracepipe 0.3.2__tar.gz → 0.3.4__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.
- {tracepipe-0.3.2 → tracepipe-0.3.4}/CHANGELOG.md +25 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/PKG-INFO +1 -1
- {tracepipe-0.3.2 → tracepipe-0.3.4}/pyproject.toml +1 -1
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_lineage_through_merge.py +124 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/__init__.py +1 -1
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/convenience.py +49 -2
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/series_capture.py +13 -4
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/storage/lineage_store.py +37 -2
- {tracepipe-0.3.2 → tracepipe-0.3.4}/uv.lock +1 -1
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.github/PULL_REQUEST_TEMPLATE.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.github/workflows/ci.yml +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.github/workflows/docs.yml +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.github/workflows/release.yml +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.gitignore +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/.pre-commit-config.yaml +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/CONTRIBUTING.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/LICENSE +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/README.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/benchmarks/README.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/benchmarks/bench_memory.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/benchmarks/bench_overhead.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/benchmarks/bench_scale.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/benchmarks/run_all.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/api/contracts.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/api/core.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/api/debug.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/api/index.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/changelog.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/contributing.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/examples/data-validation.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/examples/ml-pipeline.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/getting-started/installation.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/getting-started/modes.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/getting-started/quickstart.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/cell-provenance.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/concepts.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/contracts.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/health-checks.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/reports.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/row-tracing.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/guide/snapshots.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/docs/index.md +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/examples/comprehensive_demo.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/examples/demo.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/examples/ml_pipeline_demo.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/examples/red_team_test.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/mkdocs.yml +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/404.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/api/contracts/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/api/core/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/api/debug/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/api/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/_mkdocstrings.css +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/images/favicon.png +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/bundle.79ae519e.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/bundle.79ae519e.min.js.map +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.ar.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.da.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.de.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.du.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.el.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.es.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.fi.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.fr.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.he.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.hi.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.hu.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.hy.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.it.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.ja.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.jp.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.kn.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.ko.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.multi.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.nl.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.no.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.pt.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.ro.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.ru.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.sa.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.stemmer.support.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.sv.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.ta.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.te.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.th.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.tr.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.vi.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.zh.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/tinyseg.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/wordcut.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/workers/search.2c215733.min.js +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/workers/search.2c215733.min.js.map +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/stylesheets/main.484c7ddc.min.css +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/stylesheets/main.484c7ddc.min.css.map +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/stylesheets/palette.ab4e12ef.min.css +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/stylesheets/palette.ab4e12ef.min.css.map +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/changelog/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/contributing/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/examples/data-validation/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/examples/ml-pipeline/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/getting-started/installation/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/getting-started/modes/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/getting-started/quickstart/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/cell-provenance/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/concepts/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/contracts/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/health-checks/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/reports/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/row-tracing/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/guide/snapshots/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/index.html +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/objects.inv +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/search/search_index.json +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/sitemap.xml +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/site/sitemap.xml.gz +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/__init__.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/conftest.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_api.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_concurrency.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_contracts.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_convenience_debug.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_edge_cases.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_integration.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_io_operations.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_pandas_inst.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_public_api.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_snapshot.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tests/test_version_matrix.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/api.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/context.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/contracts.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/core.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/debug.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/__init__.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/apply_capture.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/filter_capture.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/indexer_capture.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/merge_capture.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/instrumentation/pandas_inst.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/safety.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/snapshot.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/storage/__init__.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/storage/base.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/storage/row_identity.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/utils/__init__.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/utils/value_capture.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/value_provenance.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/visualization/__init__.py +0 -0
- {tracepipe-0.3.2 → tracepipe-0.3.4}/tracepipe/visualization/html_export.py +0 -0
|
@@ -5,6 +5,31 @@ All notable changes to TracePipe will be documented in this file.
|
|
|
5
5
|
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
6
6
|
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
7
|
|
|
8
|
+
## 0.3.4 - 2026-02-03
|
|
9
|
+
|
|
10
|
+
### Fixed
|
|
11
|
+
- **Event deduplication**: Identical events from parallel pipelines are now deduplicated
|
|
12
|
+
- When multiple DataFrames share row IDs (e.g., from `df.copy()`), same changes are recorded once
|
|
13
|
+
- Events deduplicated by `(col, old_val, new_val, operation)` signature
|
|
14
|
+
- Prevents "4 events" when only 1 logical change occurred
|
|
15
|
+
|
|
16
|
+
### Added
|
|
17
|
+
- `_stable_repr()` helper for robust value comparison in deduplication
|
|
18
|
+
- Tests for cross-pipeline event deduplication behavior
|
|
19
|
+
|
|
20
|
+
## 0.3.3 - 2026-02-03
|
|
21
|
+
|
|
22
|
+
### Fixed
|
|
23
|
+
- **Double-logging bug**: `df['col'] = df['col'].fillna()` now logs exactly one event, not two
|
|
24
|
+
- Fixed duplicate capture from both `_wrap_setitem` and `wrap_series_assignment`
|
|
25
|
+
- **Merge warning scoping**: `tp.check(df)` now only shows warnings for merges in df's lineage
|
|
26
|
+
- Previously showed warnings from ALL merges in the session (cross-contamination)
|
|
27
|
+
- Now filters by tracking which merge steps produced the queried DataFrame's rows
|
|
28
|
+
|
|
29
|
+
### Added
|
|
30
|
+
- `_get_merge_stats_for_df()` helper to scope merge warnings to df's lineage
|
|
31
|
+
- Tests for double-logging prevention and merge warning scoping
|
|
32
|
+
|
|
8
33
|
## 0.3.2 - 2026-02-03
|
|
9
34
|
|
|
10
35
|
### Fixed
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: tracepipe
|
|
3
|
-
Version: 0.3.
|
|
3
|
+
Version: 0.3.4
|
|
4
4
|
Summary: Row-level data lineage tracking for pandas pipelines
|
|
5
5
|
Project-URL: Homepage, https://github.com/tracepipe/tracepipe
|
|
6
6
|
Project-URL: Documentation, https://tracepipe.github.io/tracepipe/
|
|
@@ -318,6 +318,130 @@ class TestMergeWarningLabeling:
|
|
|
318
318
|
)
|
|
319
319
|
|
|
320
320
|
|
|
321
|
+
class TestNoDoubleLogging:
|
|
322
|
+
"""Tests to verify no duplicate events are logged."""
|
|
323
|
+
|
|
324
|
+
def test_fillna_logs_once_not_twice(self):
|
|
325
|
+
"""df['col'] = df['col'].fillna() should log exactly one event per row."""
|
|
326
|
+
tp.enable(mode="debug", watch=["income"])
|
|
327
|
+
|
|
328
|
+
df = pd.DataFrame({"id": [1], "income": [None]})
|
|
329
|
+
df["income"] = df["income"].fillna(0)
|
|
330
|
+
|
|
331
|
+
result = tp.why(df, col="income", row=0)
|
|
332
|
+
|
|
333
|
+
# Should have exactly 1 change event, not 2 (no double-logging)
|
|
334
|
+
assert result.n_changes == 1, (
|
|
335
|
+
f"Expected exactly 1 change event, got {result.n_changes}. "
|
|
336
|
+
f"Double-logging bug if > 1. History: {result.history}"
|
|
337
|
+
)
|
|
338
|
+
|
|
339
|
+
def test_setitem_logs_once(self):
|
|
340
|
+
"""Direct column assignment should log exactly once."""
|
|
341
|
+
tp.enable(mode="debug", watch=["val"])
|
|
342
|
+
|
|
343
|
+
df = pd.DataFrame({"id": [1], "val": [10]})
|
|
344
|
+
df["val"] = df["val"] * 2
|
|
345
|
+
|
|
346
|
+
result = tp.why(df, col="val", row=0)
|
|
347
|
+
|
|
348
|
+
assert result.n_changes == 1, (
|
|
349
|
+
f"Expected exactly 1 change event, got {result.n_changes}. "
|
|
350
|
+
f"History: {result.history}"
|
|
351
|
+
)
|
|
352
|
+
|
|
353
|
+
def test_cross_pipeline_identical_change_deduplication(self):
|
|
354
|
+
"""Identical changes from parallel pipelines should be deduplicated.
|
|
355
|
+
|
|
356
|
+
When multiple pipelines from the same source do the SAME transformation
|
|
357
|
+
(e.g., both do fillna(0)), the event should only appear once.
|
|
358
|
+
"""
|
|
359
|
+
tp.enable(mode="debug", watch=["income"])
|
|
360
|
+
|
|
361
|
+
# Source data with a row that has None income
|
|
362
|
+
customers = pd.DataFrame({"id": ["A", "B"], "income": [None, 100.0]})
|
|
363
|
+
|
|
364
|
+
# Two parallel pipelines doing the SAME transformation
|
|
365
|
+
df1 = customers.copy()
|
|
366
|
+
df1["income"] = df1["income"].fillna(0) # Records None -> 0
|
|
367
|
+
|
|
368
|
+
df2 = customers.copy()
|
|
369
|
+
df2["income"] = df2["income"].fillna(0) # Records SAME None -> 0
|
|
370
|
+
|
|
371
|
+
# Query df1 - should deduplicate identical events
|
|
372
|
+
result1 = tp.why(df1, col="income", row=0)
|
|
373
|
+
assert result1.n_changes == 1, (
|
|
374
|
+
f"Identical events should be deduplicated. Got {result1.n_changes}. "
|
|
375
|
+
f"History: {result1.history}"
|
|
376
|
+
)
|
|
377
|
+
|
|
378
|
+
def test_cross_pipeline_different_changes_preserved(self):
|
|
379
|
+
"""Different changes from parallel pipelines should NOT be deduplicated.
|
|
380
|
+
|
|
381
|
+
When pipelines do DIFFERENT transformations on the same row,
|
|
382
|
+
both events should be visible (this is expected behavior - row IDs
|
|
383
|
+
are shared, so history includes all changes to that row ID).
|
|
384
|
+
"""
|
|
385
|
+
tp.enable(mode="debug", watch=["income"])
|
|
386
|
+
|
|
387
|
+
customers = pd.DataFrame({"id": ["A", "B"], "income": [None, 100.0]})
|
|
388
|
+
|
|
389
|
+
# Two pipelines doing DIFFERENT transformations
|
|
390
|
+
df1 = customers.copy()
|
|
391
|
+
df1["income"] = df1["income"].fillna(0) # None -> 0
|
|
392
|
+
|
|
393
|
+
df2 = customers.copy()
|
|
394
|
+
df2["income"] = df2["income"].fillna(99) # None -> 99
|
|
395
|
+
|
|
396
|
+
# Query df1 - since row ID is shared, both changes are visible
|
|
397
|
+
# This is expected: deduplication only removes IDENTICAL events
|
|
398
|
+
result1 = tp.why(df1, col="income", row=0)
|
|
399
|
+
assert result1.n_changes == 2, (
|
|
400
|
+
f"Different changes should both be visible. Got {result1.n_changes}. "
|
|
401
|
+
f"History: {result1.history}"
|
|
402
|
+
)
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class TestMergeWarningScoping:
|
|
406
|
+
"""Tests for merge warnings being scoped to df's lineage."""
|
|
407
|
+
|
|
408
|
+
def test_check_only_shows_warnings_for_df_lineage(self):
|
|
409
|
+
"""check(df) should only show warnings from merges that produced df."""
|
|
410
|
+
tp.enable(mode="debug")
|
|
411
|
+
|
|
412
|
+
# First pipeline - merge with unique right
|
|
413
|
+
left1 = pd.DataFrame({"k": ["a", "a", "b"], "v": [1, 2, 3]}) # Dup left
|
|
414
|
+
right1 = pd.DataFrame({"k": ["a", "b", "c"], "r": [10, 20, 30]}) # Unique
|
|
415
|
+
df1 = left1.merge(right1, on="k", how="left")
|
|
416
|
+
|
|
417
|
+
# Second pipeline - merge with duplicate right
|
|
418
|
+
left2 = pd.DataFrame({"k": ["x", "y"], "v": [1, 2]}) # Unique
|
|
419
|
+
right2 = pd.DataFrame({"k": ["x", "x", "y"], "r": [10, 11, 20]}) # Dup right
|
|
420
|
+
df2 = left2.merge(right2, on="k", how="left")
|
|
421
|
+
|
|
422
|
+
# check(df1) should only show warnings about LEFT duplicates (from df1's merge)
|
|
423
|
+
result1 = tp.check(df1)
|
|
424
|
+
dup_warnings1 = [w for w in result1.warnings if "duplicate" in w.message.lower()]
|
|
425
|
+
|
|
426
|
+
# check(df2) should only show warnings about RIGHT duplicates (from df2's merge)
|
|
427
|
+
result2 = tp.check(df2)
|
|
428
|
+
dup_warnings2 = [w for w in result2.warnings if "duplicate" in w.message.lower()]
|
|
429
|
+
|
|
430
|
+
# df1's check should NOT include df2's "Right table" warning
|
|
431
|
+
right_in_df1 = [w for w in dup_warnings1 if "right" in w.message.lower()]
|
|
432
|
+
assert len(right_in_df1) == 0, (
|
|
433
|
+
f"df1 check should not have Right table warnings (from df2). "
|
|
434
|
+
f"Got: {[w.message for w in dup_warnings1]}"
|
|
435
|
+
)
|
|
436
|
+
|
|
437
|
+
# df2's check should NOT include df1's "Left table" warning
|
|
438
|
+
left_in_df2 = [w for w in dup_warnings2 if "left" in w.message.lower()]
|
|
439
|
+
assert len(left_in_df2) == 0, (
|
|
440
|
+
f"df2 check should not have Left table warnings (from df1). "
|
|
441
|
+
f"Got: {[w.message for w in dup_warnings2]}"
|
|
442
|
+
)
|
|
443
|
+
|
|
444
|
+
|
|
321
445
|
class TestLineageDepthLimit:
|
|
322
446
|
"""Tests for lineage traversal depth limiting."""
|
|
323
447
|
|
|
@@ -361,8 +361,8 @@ def check(
|
|
|
361
361
|
facts["rows_dropped"] = len(dropped)
|
|
362
362
|
facts["total_steps"] = len(ctx.store.steps)
|
|
363
363
|
|
|
364
|
-
# Merge statistics
|
|
365
|
-
merge_stats_list =
|
|
364
|
+
# Merge statistics - filter to df's lineage to avoid cross-contamination
|
|
365
|
+
merge_stats_list = _get_merge_stats_for_df(df, ctx)
|
|
366
366
|
|
|
367
367
|
for i, (step_id, stats) in enumerate(merge_stats_list):
|
|
368
368
|
facts[f"merge_{i}_expansion"] = stats.expansion_ratio
|
|
@@ -658,6 +658,53 @@ def find(
|
|
|
658
658
|
# ============ HELPERS ============
|
|
659
659
|
|
|
660
660
|
|
|
661
|
+
def _get_merge_stats_for_df(df: pd.DataFrame, ctx) -> list[tuple[int, Any]]:
|
|
662
|
+
"""
|
|
663
|
+
Get merge stats relevant to df's lineage only.
|
|
664
|
+
|
|
665
|
+
This prevents cross-contamination where check(df) would show warnings
|
|
666
|
+
from merges that produced OTHER DataFrames in the same session.
|
|
667
|
+
"""
|
|
668
|
+
if not hasattr(ctx.store, "get_merge_stats"):
|
|
669
|
+
return []
|
|
670
|
+
|
|
671
|
+
all_stats = ctx.store.get_merge_stats()
|
|
672
|
+
if not all_stats:
|
|
673
|
+
return []
|
|
674
|
+
|
|
675
|
+
# Get row IDs from df
|
|
676
|
+
rids = ctx.row_manager.get_ids_array(df)
|
|
677
|
+
if rids is None:
|
|
678
|
+
return []
|
|
679
|
+
|
|
680
|
+
# Find which merge steps produced rows in df
|
|
681
|
+
relevant_step_ids = set()
|
|
682
|
+
|
|
683
|
+
# Check merge mappings to find which merges produced df's rows
|
|
684
|
+
if hasattr(ctx.store, "merge_mappings"):
|
|
685
|
+
for mapping in ctx.store.merge_mappings:
|
|
686
|
+
# Check if any of df's row IDs are in this merge's output
|
|
687
|
+
for rid in rids:
|
|
688
|
+
# Binary search in sorted out_rids
|
|
689
|
+
i = np.searchsorted(mapping.out_rids, rid)
|
|
690
|
+
if i < len(mapping.out_rids) and mapping.out_rids[i] == rid:
|
|
691
|
+
relevant_step_ids.add(mapping.step_id)
|
|
692
|
+
break # Found at least one match, this merge is relevant
|
|
693
|
+
|
|
694
|
+
# If no merge mappings found, fall back to checking if df was just merged
|
|
695
|
+
# by seeing if it has more columns than typical (heuristic)
|
|
696
|
+
if not relevant_step_ids and all_stats:
|
|
697
|
+
# Fallback: return only the most recent merge that could have produced df
|
|
698
|
+
# This handles the case where merge_mappings aren't available
|
|
699
|
+
for step_id, stats in reversed(all_stats):
|
|
700
|
+
if stats.result_rows == len(df):
|
|
701
|
+
relevant_step_ids.add(step_id)
|
|
702
|
+
break
|
|
703
|
+
|
|
704
|
+
# Filter stats to relevant merges only
|
|
705
|
+
return [(sid, stats) for sid, stats in all_stats if sid in relevant_step_ids]
|
|
706
|
+
|
|
707
|
+
|
|
661
708
|
def _json_safe(val: Any) -> Any:
|
|
662
709
|
"""Convert value to JSON-serializable form."""
|
|
663
710
|
if pd.isna(val):
|
|
@@ -116,6 +116,10 @@ def wrap_series_assignment():
|
|
|
116
116
|
"""
|
|
117
117
|
Wrap DataFrame.__setitem__ to capture diffs when assigning Series.
|
|
118
118
|
|
|
119
|
+
Note: For watched columns, _wrap_setitem (pandas_inst.py) already captures
|
|
120
|
+
the assignment. This wrapper only captures for NON-watched columns when
|
|
121
|
+
a TrackedSeries is assigned, to avoid double-logging.
|
|
122
|
+
|
|
119
123
|
Handles:
|
|
120
124
|
- df['col'] = series (where series may have been modified)
|
|
121
125
|
- df['col'] = scalar (broadcast assignment)
|
|
@@ -127,28 +131,33 @@ def wrap_series_assignment():
|
|
|
127
131
|
def tracked_setitem(self, key, value):
|
|
128
132
|
ctx = get_context()
|
|
129
133
|
|
|
130
|
-
#
|
|
134
|
+
# For watched columns, _wrap_setitem already captures - skip to avoid double-logging
|
|
135
|
+
# We only capture here for NON-watched columns when a TrackedSeries is involved
|
|
136
|
+
should_capture_here = False
|
|
131
137
|
before_values = None
|
|
138
|
+
|
|
132
139
|
if (
|
|
133
140
|
ctx.enabled
|
|
134
141
|
and isinstance(key, str)
|
|
135
|
-
and key in ctx.watched_columns
|
|
136
142
|
and key in self.columns
|
|
143
|
+
and key not in ctx.watched_columns # Only capture NON-watched columns here
|
|
144
|
+
and isinstance(value, TrackedSeries) # Only for TrackedSeries assignments
|
|
137
145
|
):
|
|
138
146
|
rids = ctx.row_manager.get_ids_array(self)
|
|
139
147
|
if rids is not None:
|
|
148
|
+
should_capture_here = True
|
|
140
149
|
before_values = {
|
|
141
150
|
"rids": rids.copy(),
|
|
142
151
|
"values": self[key].values.copy(),
|
|
143
152
|
}
|
|
144
153
|
|
|
145
|
-
# Always run original
|
|
154
|
+
# Always run original (which may be _wrap_setitem's wrapper)
|
|
146
155
|
original_setitem(self, key, value)
|
|
147
156
|
|
|
148
157
|
if not ctx.enabled:
|
|
149
158
|
return
|
|
150
159
|
|
|
151
|
-
if before_values is None:
|
|
160
|
+
if not should_capture_here or before_values is None:
|
|
152
161
|
return
|
|
153
162
|
|
|
154
163
|
try:
|
|
@@ -32,6 +32,22 @@ from ..core import (
|
|
|
32
32
|
from ..utils.value_capture import capture_typed_value
|
|
33
33
|
|
|
34
34
|
|
|
35
|
+
def _stable_repr(val) -> str:
|
|
36
|
+
"""Create a stable string representation for deduplication.
|
|
37
|
+
|
|
38
|
+
Handles NaN, None, and other values that don't compare equal to themselves.
|
|
39
|
+
"""
|
|
40
|
+
if val is None:
|
|
41
|
+
return "None"
|
|
42
|
+
# Handle NaN (which doesn't equal itself)
|
|
43
|
+
try:
|
|
44
|
+
if isinstance(val, float) and val != val: # NaN check
|
|
45
|
+
return "NaN"
|
|
46
|
+
except (TypeError, ValueError):
|
|
47
|
+
pass
|
|
48
|
+
return repr(val)
|
|
49
|
+
|
|
50
|
+
|
|
35
51
|
class InMemoryLineageStore:
|
|
36
52
|
"""
|
|
37
53
|
Columnar storage for lineage data using Structure of Arrays (SoA).
|
|
@@ -556,12 +572,15 @@ class InMemoryLineageStore:
|
|
|
556
572
|
Follows merge lineage recursively to build complete cell provenance.
|
|
557
573
|
This is essential for tracking changes that happened before merge operations.
|
|
558
574
|
|
|
575
|
+
Deduplicates events by (col, old_val, new_val, operation) signature to prevent
|
|
576
|
+
cross-pipeline contamination when multiple DataFrames share row IDs.
|
|
577
|
+
|
|
559
578
|
Args:
|
|
560
579
|
row_id: Row ID to trace
|
|
561
580
|
max_depth: Maximum merge depth to follow (prevents infinite loops)
|
|
562
581
|
|
|
563
582
|
Returns:
|
|
564
|
-
List of events in chronological order, including parent row events.
|
|
583
|
+
List of UNIQUE events in chronological order, including parent row events.
|
|
565
584
|
"""
|
|
566
585
|
visited: set[int] = set()
|
|
567
586
|
|
|
@@ -589,7 +608,23 @@ class InMemoryLineageStore:
|
|
|
589
608
|
# Sort by step_id to ensure chronological order across lineage
|
|
590
609
|
all_events.sort(key=lambda e: e["step_id"])
|
|
591
610
|
|
|
592
|
-
|
|
611
|
+
# Deduplicate by (col, old_val, new_val, operation) signature
|
|
612
|
+
# This prevents cross-pipeline contamination when multiple DataFrames
|
|
613
|
+
# share the same row IDs (e.g., df.copy() followed by parallel transforms)
|
|
614
|
+
seen_signatures: set[tuple] = set()
|
|
615
|
+
unique_events = []
|
|
616
|
+
for event in all_events:
|
|
617
|
+
sig = (
|
|
618
|
+
event.get("col"),
|
|
619
|
+
_stable_repr(event.get("old_val")),
|
|
620
|
+
_stable_repr(event.get("new_val")),
|
|
621
|
+
event.get("operation"),
|
|
622
|
+
)
|
|
623
|
+
if sig not in seen_signatures:
|
|
624
|
+
seen_signatures.add(sig)
|
|
625
|
+
unique_events.append(event)
|
|
626
|
+
|
|
627
|
+
return unique_events
|
|
593
628
|
|
|
594
629
|
def get_cell_history_with_lineage(
|
|
595
630
|
self, row_id: int, column: str, max_depth: int = 10
|
|
@@ -2051,7 +2051,7 @@ wheels = [
|
|
|
2051
2051
|
|
|
2052
2052
|
[[package]]
|
|
2053
2053
|
name = "tracepipe"
|
|
2054
|
-
version = "0.3.
|
|
2054
|
+
version = "0.3.2"
|
|
2055
2055
|
source = { editable = "." }
|
|
2056
2056
|
dependencies = [
|
|
2057
2057
|
{ name = "numpy", version = "2.0.2", source = { registry = "https://pypi.org/simple" }, marker = "python_full_version < '3.10'" },
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/lunr/min/lunr.stemmer.support.min.js
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{tracepipe-0.3.2 → tracepipe-0.3.4}/site/assets/javascripts/workers/search.2c215733.min.js.map
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|