Skip to main content

Git-based experiment tracking with semantic metadata.

Project description

Features

mthd turns your commit history into a searchable scientific log.

Every time you run an experiment, your code will be auto-committed with metadata in the commit message.

Installation

  • uv add mthd

Usage

  • Put the @commit decorator on your experiment function.
  • mthd will store hyperparameters and metrics as metadata in the commit message.
  • Query your scientific log, e.g. mthd query metrics.accuracy < 0.8.
from mthd import commit, Run
from pydantic import BaseModel

class Hypers(BaseModel):

    lr: float
    epochs: int


class Metrics(BaseModel):

    accuracy: float


@commit
def my_experiment(run: Run) -> Metrics:
    ...

    run.set_hyperparameters({ ... })

    ...

    run.set_metrics({ ... })

if __name__ == "__main__":
    my_experiment()

Then run your experiment:

$ python experiment.py

Generating commit with message:

    exp: run my_experiment at 2025-02-10 18:39:18.759230

    ---

    {
      "experiment": "my_experiment",
      "hyperparameters": {
        "lr": 0.001,
        "epochs": 100,
      },
      "metrics": {
        "accuracy": 0.9,
      },
      "uuid": "94871de1-4d6c-4e70-9c9d-60ec11df1159",
      "artifacts": null,
      "annotations": null,
      "timestamp": "2025-02-10T18:39:18.759230"
    }

Finally, query for relevant commits:

$ mthd query metrics.accuracy > 0.8

Found 1 commit(s):

    af6cd7

Development

  • git clone https://github.com/flywhl/mthd.git
  • cd mthd
  • uv sync
  • just test

Flywheel

Science needs better software tools. Flywheel is an open source collective building simple tools to preserve scientific momentum, inspired by devtools and devops culture. Join our Discord here.

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

mthd-0.2.0.tar.gz (47.5 kB view details)

Uploaded Source

Built Distribution

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

mthd-0.2.0-py3-none-any.whl (13.2 kB view details)

Uploaded Python 3

File details

Details for the file mthd-0.2.0.tar.gz.

File metadata

  • Download URL: mthd-0.2.0.tar.gz
  • Upload date:
  • Size: 47.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.0

File hashes

Hashes for mthd-0.2.0.tar.gz
Algorithm Hash digest
SHA256 ad608ccdc5fa124cc995803303961b799d8e614002a75206865ce29a784cc771
MD5 343f790f13dbbb6a3280856272341d95
BLAKE2b-256 41eb0ee8d98e40b009c07d931a6b52843e3a414c09b429d7d7302baa5d3d570b

See more details on using hashes here.

File details

Details for the file mthd-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: mthd-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 13.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: uv/0.6.0

File hashes

Hashes for mthd-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 29227ab6b1a8eb0b77e0b34031ed19fde419eb99ddaaadd3736e3928dff85d30
MD5 8415ef13f7178b9659b32165ab472e43
BLAKE2b-256 10d6fc064a8a4a0640e91749d4e728c3181ee6cf7577fb91a95d94069f3ae222

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