Skip to main content

🔍 PipeTrace

PyPI version Python License: MIT Tests

A lightweight, non-intrusive pipeline debugger and automated story insight engine for Pandas.

Stop writing print(df.shape) after every single line of your Pandas pipelines. PipeTrace seamlessly traces row losses, column mutations, unexpected NaN introductions, and join explosions — giving you a clean visual X-ray and automated story insights at the end of your pipeline.


⚡ The Problem

When developers chain Pandas operations:

# Where did my rows go? Which step created duplicate keys? Why are there new NaNs?
clean_df = (
    df
    .drop_duplicates(subset=["id"])
    .query("age >= 18")
    .merge(orders, on="id", how="left")
    .dropna(subset=["email"])
)

Debugging this usually requires breaking the chain and adding dozens of temporary print() statements.

💡 The PipeTrace Solution

Wrap your DataFrame in trace() (or watch()). PipeTrace intercepts every step, records structural diffs, generates smart alerts, and prints a gorgeous audit report:

import pandas as pd
from pipetrace import trace

clean_df = (
    trace(raw_customers)
    .drop_duplicates(subset=["id"])
    .query("age >= 18")
    .merge(orders, on="id", how="left")
    .dropna(subset=["email"])
    .report(title="Customer Cleaning Pipeline") # 🔍 Audit report printed & clean DataFrame returned!
)

🖥️ Terminal Report Preview

┌─────────────────── ⚡ Customer Cleaning Pipeline ───────────────────────────┐
│ 🔍 PipeTrace Data Audit & Insights                                          │
│ Initial: 10,000 rows × 5 cols  ➔  Final: 8,420 rows × 8 cols                │
│ Net Row Change: -1,580 rows | Total Time: 42.1ms                            │
└─────────────────────────────────────────────────────────────────────────────┘
                        Pipeline Step-by-Step Execution                        
┌─────┬───────────────────────────┬───────────────────┬───────────┬──────────┬────────────────────────────────────────┐
│  #  │ Operation                 │              Rows │   Cols    │     Time │ Insights & Alerts                      │
├─────┼───────────────────────────┼───────────────────┼───────────┼──────────┼────────────────────────────────────────┤
│  1  │ .drop_duplicates(subset=… │        9,850 (-150)│     5     │    4.2ms │ 💡 Pattern: 70% drops had same email   │
│  2  │ .query('age >= 18')       │        9,100 (-750)│     5     │    8.1ms │ ⚠️ High loss: Dropped 750 records      │
│  3  │ .merge(orders, how='left')│      9,400 (+300)  │  8 (+3)   │   12.4ms │ ⚠️ Row explosion (+300 rows in join!)  │
│  4  │ .dropna(subset=['email']) │        8,420 (-980)│     8     │    3.1ms │ 💡 Missing values in 'email' caused drops│
└─────┴───────────────────────────┴───────────────────┴───────────┴──────────┴────────────────────────────────────────┘

🚀 Key Features

  • Zero-Friction Chaining: trace(df) wraps your DataFrame transparently. Any standard Pandas operation (query, drop_duplicates, merge, fillna, assign, etc.) works as normal.
  • Automated Insights & Alerts:
    • 🚨 Empty DataFrame Alert: Immediately warns if any filter wiped out all data (0 rows).
    • 💥 Join / Cartesian Explosion: Alerts if a merge multiplied rows due to duplicate join keys.
    • 📉 High Data Loss Alert: Highlights steps that dropped > 50% of records.
    • 🧩 Pattern Detection: Analyzes dropped records to find dominant categorical values causing drops.
    • ⚠️ New NaN Detector: Tracks columns that gained missing values during transformation.
  • Jupyter Notebook Ready: Native rich HTML rendering in Jupyter notebooks (_repr_html_).
  • Export to DataFrame: Call .summary() to get a pandas DataFrame containing step numbers, shapes, durations, and alerts for CI/CD logging.

📦 Installation

pip install pipetrace

Requirements: Python 3.8+, pandas, rich.


🛠️ Usage Examples

1. Basic Chaining with .report()

import pandas as pd
from pipetrace import trace

df = pd.read_csv("sales_data.csv")

clean_df = (
    trace(df)
    .drop_duplicates(subset=["transaction_id"])
    .query("amount > 0")
    .assign(tax=lambda d: d["amount"] * 0.18)
    .report()
)

2. Live Logging Mode

Want real-time console feedback as each step executes? Enable live=True:

clean_df = (
    trace(df, live=True)
    .drop_duplicates()
    .query("status == 'active'")
    .to_df()
)

🧪 Running Tests

python -m pytest tests/ -v

📄 License

MIT License. (c) 2026 Uttakaladeba Garnaik & Contributors.

Metadata

Release files for pipetrace 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pipetrace 0.1.0
File Size Uploaded Provenance Actions
pipetrace-0.1.0.tar.gz 15.5 kB Without provenance Details for pipetrace-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pipetrace 0.1.0
File Interpreter ABI Platform Actions
pipetrace-0.1.0-py3-none-any.whl Python 3 none any Details for pipetrace-0.1.0-py3-none-any.whl

Total release size: 27.9 kB

Release files / pipetrace-0.1.0.tar.gz

Download URL pipetrace-0.1.0.tar.gz
Size 15.5 kB
Tags Source
SHA-256 checksum
How to use checksums
820d6beb33a8c62ccf7b1db7783242f2955d4335e793e92d01eee8580cc86b7a
BLAKE2b-256 checksum
How to use checksums
51913d5e2f820df8410bd4737e3a150a3c80172d9dbfdf91a45712ec01fa373d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Release files / pipetrace-0.1.0-py3-none-any.whl

Download URL pipetrace-0.1.0-py3-none-any.whl
Size 12.4 kB
Tags Python 3
SHA-256 checksum
How to use checksums
a48bc2bcf143d2e4e94300df99caccb38d750d771b27450a2c709ffbc0f83f64
BLAKE2b-256 checksum
How to use checksums
d2b5cf17f7442e2cc76b267a27ca35f50b75f19496a226b361e951b9734a79b3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.11.0

Security for pipetrace 0.1.0

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No provenance

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page