mthd


Namemthd JSON
Version 0.2.1 PyPI version JSON
download
home_pageNone
SummaryGit-based experiment tracking with semantic metadata.
upload_time2025-02-15 00:38:18
maintainerNone
docs_urlNone
authorNone
requires_python>=3.10
licenseNone
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            <div align="center">
  
  ![logo](https://github.com/user-attachments/assets/cb3ddb4f-5f40-4231-9efe-29e045705dda)

  [Discord](https://discord.gg/kTkF2e69fH) • [Website](https://flywhl.dev) • [Installation](#installation)
  <br/>
  <br/>
</div>

## 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`.

```python
from mthd import commit, Run

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

    run.set_hyperparameters({
        "lr": 0.001,
        "epochs": 100,
    })

    ...

    run.set_metrics({
        "accuracy": 0.9,
    })

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](https://flywhl.dev/) is an open source collective building simple tools to preserve scientific momentum, inspired by devtools and devops culture. Join our Discord [here](discord.gg/fd37MFZ7RS).

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "mthd",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.10",
    "maintainer_email": null,
    "keywords": null,
    "author": null,
    "author_email": "Rory Byrne <rory@rory.bio>",
    "download_url": "https://files.pythonhosted.org/packages/e2/9e/70eb6811d10df276b784c965e4946acdfe72cf9c1ca177cccfea76f77909/mthd-0.2.1.tar.gz",
    "platform": null,
    "description": "<div align=\"center\">\n  \n  ![logo](https://github.com/user-attachments/assets/cb3ddb4f-5f40-4231-9efe-29e045705dda)\n\n  [Discord](https://discord.gg/kTkF2e69fH) \u2022 [Website](https://flywhl.dev) \u2022 [Installation](#installation)\n  <br/>\n  <br/>\n</div>\n\n## Features\n\n`mthd` turns your commit history into a searchable scientific log.\n\nEvery time you run an experiment, your code will be auto-committed with metadata in the commit message.\n\n\n## Installation\n\n* `uv add mthd`\n\n## Usage\n\n* Put the `@commit` decorator on your experiment function.\n* `mthd` will store hyperparameters and metrics as metadata in the commit message.\n* Query your scientific log, e.g. `mthd query metrics.accuracy < 0.8`.\n\n```python\nfrom mthd import commit, Run\n\n@commit\ndef my_experiment(run: Run) -> Metrics:\n    ...\n\n    run.set_hyperparameters({\n        \"lr\": 0.001,\n        \"epochs\": 100,\n    })\n\n    ...\n\n    run.set_metrics({\n        \"accuracy\": 0.9,\n    })\n\nif __name__ == \"__main__\":\n    my_experiment()\n```\n\nThen run your experiment:\n\n```\n$ python experiment.py\n\nGenerating commit with message:\n\n    exp: run my_experiment at 2025-02-10 18:39:18.759230\n\n    ---\n\n    {\n      \"experiment\": \"my_experiment\",\n      \"hyperparameters\": {\n        \"lr\": 0.001,\n        \"epochs\": 100,\n      },\n      \"metrics\": {\n        \"accuracy\": 0.9,\n      },\n      \"uuid\": \"94871de1-4d6c-4e70-9c9d-60ec11df1159\",\n      \"artifacts\": null,\n      \"annotations\": null,\n      \"timestamp\": \"2025-02-10T18:39:18.759230\"\n    }\n```\n\nFinally, query for relevant commits:\n\n```\n$ mthd query metrics.accuracy > 0.8\n\nFound 1 commit(s):\n\n    af6cd7\n```\n\n\n## Development\n\n* `git clone https://github.com/flywhl/mthd.git`\n* `cd mthd`\n* `uv sync`\n* `just test`\n\n## Flywheel\n\nScience needs better software tools. [Flywheel](https://flywhl.dev/) is an open source collective building simple tools to preserve scientific momentum, inspired by devtools and devops culture. Join our Discord [here](discord.gg/fd37MFZ7RS).\n",
    "bugtrack_url": null,
    "license": null,
    "summary": "Git-based experiment tracking with semantic metadata.",
    "version": "0.2.1",
    "project_urls": {
        "Bug Tracker": "https://github.com/flywhl/mthd/issues",
        "Documentation": "https://github.com/flywhl/mthd#readme",
        "Homepage": "https://github.com/flywhl/mthd",
        "Repository": "https://github.com/flywhl/mthd"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "1af48c13269a16bf249161df4bb4d55652afeb8785780cf73bd672daab852395",
                "md5": "f40c022da247586e7b3a71180482c9be",
                "sha256": "b6e60f2e767210d4169efa4a14f034140e1d9e79472695ae3bd6f127bb55ddd6"
            },
            "downloads": -1,
            "filename": "mthd-0.2.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f40c022da247586e7b3a71180482c9be",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.10",
            "size": 13284,
            "upload_time": "2025-02-15T00:38:16",
            "upload_time_iso_8601": "2025-02-15T00:38:16.474429Z",
            "url": "https://files.pythonhosted.org/packages/1a/f4/8c13269a16bf249161df4bb4d55652afeb8785780cf73bd672daab852395/mthd-0.2.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": null,
            "digests": {
                "blake2b_256": "e29e70eb6811d10df276b784c965e4946acdfe72cf9c1ca177cccfea76f77909",
                "md5": "0af522989a5a316ebc940c74560c990c",
                "sha256": "8935e9f421f33372a540c5cd59f4c6ee3e776507103ceec6e0592cd8f9c534e2"
            },
            "downloads": -1,
            "filename": "mthd-0.2.1.tar.gz",
            "has_sig": false,
            "md5_digest": "0af522989a5a316ebc940c74560c990c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.10",
            "size": 47534,
            "upload_time": "2025-02-15T00:38:18",
            "upload_time_iso_8601": "2025-02-15T00:38:18.507952Z",
            "url": "https://files.pythonhosted.org/packages/e2/9e/70eb6811d10df276b784c965e4946acdfe72cf9c1ca177cccfea76f77909/mthd-0.2.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2025-02-15 00:38:18",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "flywhl",
    "github_project": "mthd",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "mthd"
}
        
Elapsed time: 5.76402s