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.2.0.tar.gz (28.5 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.2.0-py3-none-any.whl (37.2 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: lazyscribe-2.2.0.tar.gz
  • Upload date:
  • Size: 28.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.2.0.tar.gz
Algorithm Hash digest
SHA256 93ba1e889a480a55831ee9e133a77c06dc886e111348e5f299165122eaa068e6
MD5 4957402a8dafa809d1303648c4523e42
BLAKE2b-256 c869e6a2a2c56059a28f01d0ab5514b6942216987948b275a9e1a4263a3b59ad

See more details on using hashes here.

File details

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

File metadata

  • Download URL: lazyscribe-2.2.0-py3-none-any.whl
  • Upload date:
  • Size: 37.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","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.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 a21a4cac2055e561b2ede3f3b989b58012291818dd5c91a1f9c9d66f0e2980cd
MD5 a9d3f55d1888f8eccba6a94b5ec0c521
BLAKE2b-256 fdec958a667b57d2db9fbbd8b7db57fbd73c43eacb8543495e20746518c93ff0

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