t-record-lib


Namet-record-lib JSON
Version 0.2.3 PyPI version JSON
download
home_pagehttps://www.thoughtful.ai/
SummaryCookiecutter template for Thoughtful pip package
upload_time2025-07-15 16:44:17
maintainerNone
docs_urlNone
authorThoughtful
requires_python>=3.11
licenseNone
keywords t_record
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            T-Record
========

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
----------

.. code-block:: python

    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")





            

Raw data

            {
    "_id": null,
    "home_page": "https://www.thoughtful.ai/",
    "name": "t-record-lib",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": null,
    "keywords": "t_record",
    "author": "Thoughtful",
    "author_email": "support@thoughtful.ai",
    "download_url": "https://files.pythonhosted.org/packages/73/01/5e0305ba6dfb1e8607bd529aebfd7f3f50eb2b12a4daea147d2c90d28e1f/t_record_lib-0.2.3.tar.gz",
    "platform": null,
    "description": "T-Record\n========\n\nA lightweight Python library for robust record tracing, status tracking, and detailed logging \u2014\nbuilt for automation pipelines and data integrity.\n\nFeatures\n--------\n\n* **ThoughtfulRecord model**\n  Track each record's status, lifecycle, and traces with robust JSON-serializable objects.\n\n* **Automatic history**\n  Dumps detailed logs, merges previous runs seamlessly, preserving full audit history.\n\n* **Enhanced HTML reports**\n  Auto-generates beautiful HTML reports with status summary, traces, diffs, and screenshots.\n\n* **Portable archive**\n  Packs all data (logs + images + HTML) into a shareable ZIP file.\n\n* **Fail-safe logging**\n  Internally uses ``try/except`` to ensure tracing never crashes your main process.\n\nInstallation\n------------\n\nInstall via pip::\n\n    pip install t-record-lib\n\nOr for local development::\n\n    git clone https://github.com/YOUR_ORG/t_record.git\n    cd t_record\n    pip install -e .\n\nQuickstart\n----------\n\n.. code-block:: python\n\n    from t_record.record import configure_records_tracing, ThoughtfulRecord, dump_records, pack_sharable_zip, RecordStatus\n\n    # 1. Configure\n    configure_records_tracing(\"records_folder\")\n\n    # 2. Create your record\n    class MyRecord(ThoughtfulRecord):\n        id: str\n        status: RecordStatus = \"\"\n\n    record = MyRecord(id=\"rec_001\")\n\n    # 3. Change status or add traces\n    record.status = Status.RUNNING\n    record.log_trace(\"Started processing\", reason=\"Data loaded\")\n\n    # 4. Save everything\n    dump_records()\n\n    # 5. Create shareable ZIP\n    pack_sharable_zip(\"records.zip\")\n\nOutput files\n------------\n\nBy default, each run will produce::\n\n    /records_folder/{process_name}/{run_id}/\n        records_logs.json     # full structured logs (merged from previous runs)\n        records_report.html   # human-readable dashboard\n        /images/              # attached screenshots\n\nPlus a zip archive on demand.\n\nAdvanced usage\n--------------\n\n* Continue an existing run (merges history automatically)::\n\n    configure_record_tracing(\"records_folder\")\n    record = MyRecord(id=\"rec_001\")  # picks up previous traces\n    record.status = Status.COMPLETED\n    dump_records()\n\n* Add an image trace::\n\n    record.log_trace(\"Reviewed\", reason=\"Visual QC\", image=\"path/to/image.png\")\n\n\n\n\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Cookiecutter template for Thoughtful pip package",
    "version": "0.2.3",
    "project_urls": {
        "Homepage": "https://www.thoughtful.ai/"
    },
    "split_keywords": [
        "t_record"
    ],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "73015e0305ba6dfb1e8607bd529aebfd7f3f50eb2b12a4daea147d2c90d28e1f",
                "md5": "c479b6733bf3e23e0341349febef52fe",
                "sha256": "eec30de0e6ab84b8778e09ed6591a827ecc204e6c960fa30e11b6773c6693091"
            },
            "downloads": -1,
            "filename": "t_record_lib-0.2.3.tar.gz",
            "has_sig": false,
            "md5_digest": "c479b6733bf3e23e0341349febef52fe",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 19584,
            "upload_time": "2025-07-15T16:44:17",
            "upload_time_iso_8601": "2025-07-15T16:44:17.296584Z",
            "url": "https://files.pythonhosted.org/packages/73/01/5e0305ba6dfb1e8607bd529aebfd7f3f50eb2b12a4daea147d2c90d28e1f/t_record_lib-0.2.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-07-15 16:44:17",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "t-record-lib"
}
        
Elapsed time: 0.85359s