Skip to main content

A decorator-based data lineage tracker.

Project description

LiteLineage 🕸️

Zero-Infrastructure Data Lineage for Python.

LiteLineage is a lightweight, decorator-based library that tracks data dependencies in your Python pipelines. It stores lineage metadata in a local SQLite file and generates professional Mermaid.js graphs instantly.

Perfect for: Solo Data Engineers, Local ETL scripts, and POCs where setting up DataHub or Amundsen is overkill.

🚀 Key Features

  • Zero Setup: No servers to run. Just install and import.
  • Decorator Driven: Add @tracker.track to your existing functions.
  • Visual Graphs: Auto-generates an HTML interactive graph of your data flow.
  • Standard Tech: Uses SQLite for storage and Mermaid.js for rendering.

📦 Installation

pip install litelineage

⚡ Quick Start

1. Track Your Functions

Import the tracker and use the decorator. You simply declare what the function reads (inputs) and what it creates (outputs).

import time
from litelineage import tracker

# Example: Ingesting data
@tracker.track(inputs=["s3://raw-bucket/users.csv"], outputs=["local/users_clean.parquet"])
def clean_users():
    print("Cleaning user data...")
    time.sleep(1)

# Example: Creating a report
@tracker.track(inputs=["local/users_clean.parquet"], outputs=["reports/daily_users.pdf"])
def generate_report():
    print("Generating PDF...")
    time.sleep(1)

if __name__ == "__main__":
    clean_users()
    generate_report()
    print("Pipeline finished!")

2. View the Lineage

After running your script, a lineage.db file is created automatically. To see the graph, run the CLI command:

litelineage-show

This will generate lineage.html. Open it in your browser to see your data flow diagram.

Open your browser :

python -m http.server 8000

🛠️ CLI Reference

The package includes a command-line tool to visualize your database.

# Default (looks for lineage.db in current folder)
litelineage-show

# Specify custom file paths (Python usage)
# python -m litelineage.visualizer --db my_custom.db --out my_graph.html

📖 How It Works

  1. Capture: When a decorated function finishes successfully, LiteLineage logs a row to a local SQLite file (lineage.db).
  2. Store: It records the timestamp, function_name, input_asset, and output_asset.
  3. Visualize: The visualizer reads the SQLite rows and converts them into Mermaid.js syntax (standard "Flowchart" logic), creating a standalone HTML file you can share with stakeholders.

🛡️ FAQ

Q: Does it affect performance? A: Negligible. It performs one quick SQLite write after your function finishes.

Q: Can I use it in production? A: Yes. Since it uses SQLite, it works perfectly on single-node Airflow, cron jobs, or containerized scripts. For distributed systems (Spark/Databricks), a centralized DB would be needed (roadmap feature).


License

MIT License. Free to use for personal and commercial projects.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

litelineage-0.1.2.tar.gz (4.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

litelineage-0.1.2-py3-none-any.whl (5.4 kB view details)

Uploaded Python 3

File details

Details for the file litelineage-0.1.2.tar.gz.

File metadata

  • Download URL: litelineage-0.1.2.tar.gz
  • Upload date:
  • Size: 4.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for litelineage-0.1.2.tar.gz
Algorithm Hash digest
SHA256 984b2704b0174e3f2dd2cdd64c8738e2b7ca3ae9baba0de9b805a70ea082ef94
MD5 1915c3c6c12f3a6ded9bf039f5dbe07e
BLAKE2b-256 5d43647136afb683d5a3b48eb9dc8f6533bc17a3e26827a2c0673cac033add79

See more details on using hashes here.

File details

Details for the file litelineage-0.1.2-py3-none-any.whl.

File metadata

  • Download URL: litelineage-0.1.2-py3-none-any.whl
  • Upload date:
  • Size: 5.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.10.12

File hashes

Hashes for litelineage-0.1.2-py3-none-any.whl
Algorithm Hash digest
SHA256 0192f23ea1e4bccae28ced0ba4d4866a91895d8b2174a501e4704f8a9a833acf
MD5 beadb28b5f3c1df6c298b7b304ee111f
BLAKE2b-256 d6b61ee1efaf5d90477f8a909f8452a3215b9396d355d7b2637c56c095629fe1

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page