⚡ sparklineage
A lightweight, zero-dependency, developer-first library for field-to-field column lineage, Catalyst pre-flight compiler lints, multi-cloud security redaction, and interactive DAG visualization in Apache Spark and PySpark.
Instead of heavy enterprise collectors (which require OpenLineage/Marquez servers or agent JARs), sparklineage runs directly inside your notebook or Python process with zero external infrastructure.
Authored and maintained by Pavan Badempet.
⚡ Why sparklineage?
- 🌱 Field-to-Field Column Lineage: Traces each output DataFrame column back through joins, projections, and mathematical expressions to its upstream source columns.
- 🚨 Pre-Flight Compiler Lints: Catches expensive bottlenecks before triggering actions:
- Cartesian / Cross-Join Hazards: Unintended Cartesian joins that trigger O(N*M) stage blowups.
- Un-broadcasted Join Candidates: Identifies dimension tables under size thresholds that can avoid SortMergeJoin shuffles.
- Lineage Depth Overflow: Warns before deep iterative pipelines trigger driver
StackOverflowError. - Partition Pushdown Invalidation: Flags WHERE clause type-casting that breaks file/partition pruning.
- Redundant Shuffles: Highlights consecutive exchange operations.
- 🔒 Multi-Cloud Security & PII Sanitization:
- Automatically detects and redacts database passwords in connection URIs (
jdbc:postgresql://user:pass@host), AWS keys (AKIA...), and Azure SAS tokens. - Masks sensitive PII literals (
ssn,credit_card,dob,password) before exporting diagrams or terminal reports.
- Automatically detects and redacts database passwords in connection URIs (
- 🦀 Sub-Millisecond Offline Static Linter (Powered by Rust):
- Scans entire codebases for Spark anti-patterns (
.collect()in loops, un-limited.toPandas(), explicit cross joins) in < 1 ms via Rayon multi-threading without booting a JVM.
- Scans entire codebases for Spark anti-patterns (
- 🎨 Zero-Dependency Interactive Visual DAG:
- Embeds a clean, dark-mode, zoomable SVG/HTML execution graph directly in Databricks and Jupyter notebooks, or exports to standalone
.html. - 100% self-contained: works inside strictly air-gapped VPCs with no CDN or internet access required.
- Embeds a clean, dark-mode, zoomable SVG/HTML execution graph directly in Databricks and Jupyter notebooks, or exports to standalone
📦 Installation
pip install sparklineage
🚀 Quickstart
1. Inspect & Visualize in a Single Line
import sparklineage as sl
# Inspect any PySpark DataFrame
inspector = sl.inspect(my_df)
# Render interactive DAG inside Databricks or Jupyter notebook
inspector.display()
# Or save standalone HTML
inspector.save_html("lineage_graph.html")
2. Pre-Flight Compiler Linter
Catch expensive mistakes before calling .write() or .collect():
from sparklineage import lint
report = lint(my_df)
if report.has_critical:
print("Execution blocked: Critical Catalyst hazards detected!")
Sample Terminal Output:
╭─────────────────────────────────────────────────────────────╮
│ ⚡ sparklineage v0.2.0 • Plan Diagnostic & Lineage Summary │
╰─────────────────────────────────────────────────────────────╯
📊 Plan Metrics:
• Plan Depth: 6 stages
• Shuffle Stages: 2
• Joins Analyzed: 1
• Issues Detected: 1 (0 Critical, 1 Warnings)
🚨 Pre-Flight Compiler Warnings:
[WARNING] Un-broadcasted Join Candidate
Problem: Execution plan utilizes SortMergeJoin with cluster-wide shuffle.
Fix: Wrap dimension tables with broadcast(dim_df).
🌱 Column-Level Lineage Mapping:
• total ⟵ Source(Range).id, Source(Range).val
Transforms: (val#1L + 100)
3. Field-to-Field Column Lineage
col_lineage = inspector.get_column_lineage()
for col, details in col_lineage.items():
print(f"{col} originates from: {details.sources}")
print(f"Transformations applied: {details.transformations}")
4. High-Speed Offline Code Linter (Pre-Commit / CI)
Lint Python files and notebooks for PySpark anti-patterns without starting a SparkSession:
import sparklineage as sl
# Lint a code string in 0.5 milliseconds
issues = sl.lint_code("""
for batch in batches:
df.collect()
""")
# Or scan an entire repository in parallel across all CPU cores
repo_issues = sl.lint_directory(".")
5. Multi-Cloud Security Sanitization
# Automatically sanitizes AWS keys, JDBC passwords, and PII literals in memory
inspector.sanitize()
# Safe for public PR comments or Slack posts:
inspector.show()
inspector.to_markdown()
6. Backwards Compatibility (v0.1.0 API)
Full compatibility with v0.1.0 is preserved:
from sparklineage import PlanInspector
inspector = PlanInspector(my_df)
inspector.check_broadcast_opportunities(threshold_mb=100)
summary = inspector.summarize()
📄 License
MIT License. Copyright (c) 2026 Pavan Badempet.
Metadata
Release files for sparklineage 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| sparklineage-0.2.1.tar.gz | 27.5 kB | Without provenance | Details for sparklineage-0.2.1.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| sparklineage-0.2.1-py3-none-any.whl | Python 3 | none | any | Details for sparklineage-0.2.1-py3-none-any.whl |
Total release size: 52.4 kB
Release files / sparklineage-0.2.1.tar.gz
| Download URL | sparklineage-0.2.1.tar.gz |
|---|---|
| Size | 27.5 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
1e838a8c4a1a360ff4668c820ffa9c26be968885bec2bc23cbc026ff77282f9b
|
|
BLAKE2b-256 checksum How to use checksums |
0f1e24479ef17ff1336e0857ccfb5f3c11e0c6da025f8d6a0ced67270fcaf8ca
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Release files / sparklineage-0.2.1-py3-none-any.whl
| Download URL | sparklineage-0.2.1-py3-none-any.whl |
|---|---|
| Size | 24.9 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
a85e84ee6e2029dd98d875c736cc1f7366f01c3fc7c19b4383988ac25ea70edf
|
|
BLAKE2b-256 checksum How to use checksums |
a8f335ea1a809b5f488dffd2d960f8c73aaaf8bb79253a5b1e4f4acb60285185
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.14.6
|
Security for sparklineage 0.2.1
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.