Skip to main content

Lightweight and lazy experiment logging

Project description

License PyPI PyPI - Python Version Documentation Status Coverage badge

Lightweight, lazy experiment logging

lazyscribe is a lightweight package for model experiment logging. It creates a single JSON file per project, and an experiment is only added to the file when code finishes (errors won't result in partially finished experiments in your project log).

lazyscribe also has functionality to allow for multiple people to work on a single project. You can merge projects together and update the list of experiments to create a single, authoritative view of all executed experiments.

Installation

Python 3.10 and above is required. Use pip to install:

$ python -m pip install lazyscribe

Basic Usage

The basic usage involves instantiating a Project and using the context manager to log an experiment:

import json

from lazyscribe import Project

project = Project(fpath="project.json")
with project.log(name="My experiment") as exp:
    exp.log_metric("auroc", 0.5)
    exp.log_parameter("algorithm", "lightgbm")

You've created an experiment! You can view the experimental data by using list:

print(json.dumps(list(project), indent=4))
[
    {
        "name": "My experiment",
        "author": "<AUTHOR>",
        "last_updated_by": "<AUTHOR>",
        "metrics": {
            "auroc": 0.5
        },
        "parameters": {
            "algorithm": "lightgbm"
        },
        "created_at": "<CREATED_AT>",
        "last_updated": "<LAST_UPDATED>",
        "dependencies": [],
        "short_slug": "my-experiment",
        "slug": "my-experiment-<CREATED_AT>",
        "tests": [],
        "artifacts": []
    }
]

Once you've finished, save the project to project.json:

project.save()

Later on, you can read the project back in read-only mode ("r"), append mode ("a"), or editable mode ("w+"):

project = Project("project.json", mode="r")
with project.log(name="New experiment") as exp:  # Raises a ReadOnlyError
    ...

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

lazyscribe-2.1.0.tar.gz (28.1 kB view details)

Uploaded Source

Built Distribution

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

lazyscribe-2.1.0-py3-none-any.whl (36.6 kB view details)

Uploaded Python 3

File details

Details for the file lazyscribe-2.1.0.tar.gz.

File metadata

  • Download URL: lazyscribe-2.1.0.tar.gz
  • Upload date:
  • Size: 28.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lazyscribe-2.1.0.tar.gz
Algorithm Hash digest
SHA256 87071b119c6e52f95f88d1e58b916f575f574d54dfdee4fc85fac524a7b49f44
MD5 3434b655f0ed888513128856b89e54d2
BLAKE2b-256 ae5adccafa16abaa341d77056578b011b400d9b5db5486bfa2293e037dd70806

See more details on using hashes here.

File details

Details for the file lazyscribe-2.1.0-py3-none-any.whl.

File metadata

  • Download URL: lazyscribe-2.1.0-py3-none-any.whl
  • Upload date:
  • Size: 36.6 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.6 {"installer":{"name":"uv","version":"0.11.6","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}

File hashes

Hashes for lazyscribe-2.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 3538aa758b8f95c1e5076489b98b6af8e79157f63888b781c281cbc807f5befa
MD5 773fe351a9857e08319f770c3d4c07bd
BLAKE2b-256 c923f0b7a34e250b556f2280b07db5fdca9f62488534e1e59cd6ebe5c1ae7452

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