Skip to main content

Cookiecutter template for Thoughtful pip package

Project description

A lightweight Python library for robust record tracing, status tracking, and detailed logging — built for automation pipelines and data integrity.

Features

  • ThoughtfulRecord model Track each record’s status, lifecycle, and traces with robust JSON-serializable objects.

  • Automatic history Dumps detailed logs, merges previous runs seamlessly, preserving full audit history.

  • Enhanced HTML reports Auto-generates beautiful HTML reports with status summary, traces, diffs, and screenshots.

  • Portable archive Packs all data (logs + images + HTML) into a shareable ZIP file.

  • Fail-safe logging Internally uses try/except to ensure tracing never crashes your main process.

Installation

Install via pip:

pip install t-record-lib

Or for local development:

git clone https://github.com/YOUR_ORG/t_record.git
cd t_record
pip install -e .

Quickstart

from t_record.record import configure_records_tracing, ThoughtfulRecord, dump_records, pack_sharable_zip, RecordStatus

# 1. Configure
configure_records_tracing("records_folder")

# 2. Create your record
class MyRecord(ThoughtfulRecord):
    id: str
    status: RecordStatus = ""

record = MyRecord(id="rec_001")

# 3. Change status or add traces
record.status = Status.RUNNING
record.log_trace("Started processing", reason="Data loaded")

# 4. Save everything
dump_records()

# 5. Create shareable ZIP
pack_sharable_zip("records.zip")

Output files

By default, each run will produce:

/records_folder/{process_name}/{run_id}/
    records_logs.json     # full structured logs (merged from previous runs)
    records_report.html   # human-readable dashboard
    /images/              # attached screenshots

Plus a zip archive on demand.

Advanced usage

  • Continue an existing run (merges history automatically):

    configure_record_tracing("records_folder")
    record = MyRecord(id="rec_001")  # picks up previous traces
    record.status = Status.COMPLETED
    dump_records()
  • Add an image trace:

    record.log_trace("Reviewed", reason="Visual QC", image="path/to/image.png")

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

t_record_lib-0.1.3.tar.gz (16.3 kB view details)

Uploaded Source

File details

Details for the file t_record_lib-0.1.3.tar.gz.

File metadata

  • Download URL: t_record_lib-0.1.3.tar.gz
  • Upload date:
  • Size: 16.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.11.5

File hashes

Hashes for t_record_lib-0.1.3.tar.gz
Algorithm Hash digest
SHA256 7aed41a25e8f0d0f7ea06bd4b637f32b6f442a10523f757d749aba0b49124f1b
MD5 3d82cebc01b0e99ab3da4ef54d93f5a8
BLAKE2b-256 1a6d4b066730c823c913e320a812505f33809b07a080edbfc037bcc23f14fc69

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