Skip to content

mykytahordia/mhpy

Repository files navigation

mhpy

Python PyTorch Hydra Weights & Biases Loguru Jinja2 NumPy Matplotlib GitPython pytest pre-commit

A scaffolding library and CLI for quickly spinning up ML projects with all the good stuff already configured.

What is this?

mhpy (MykytaHordiaPY) is a project scaffolder that sets up a complete ML project structure with:

  • Hydra for config management
  • W&B for experiment tracking
  • DVC for data versioning
  • pre-commit hooks for code quality
  • pytest for testing
  • Common ML utilities (PyTorch helpers, metrics, plotting, etc.)

Basically, it saves you from copy-pasting the same boilerplate across projects.

Installation

Basic install (just the CLI)

pip:

pip install git+https://github.com/mykytahordia/mhpy.git

uv:

uv tool install git+https://github.com/mykytahordia/mhpy.git

With ML dependencies and utils (PyTorch, W&B, etc.)

pip install "mhpy[ml] @ git+https://github.com/mykytahordia/mhpy.git"

With dev dependencies (pytest, pre-commit, etc.)

pip install "mhpy[dev] @ git+https://github.com/mykytahordia/mhpy.git"

Everything

pip install "mhpy[all] @ git+https://github.com/mykytahordia/mhpy.git"

For development

If you want to try it youself:

git clone https://github.com/mykytahordia/mhpy.git
cd mhpy
pip install uv  # if you don't have it
uv sync --all-extras

Install changes with:

uv run pip install -e ".[all]"
# or
make reinstall

Run in debug mode:

mhpy command=init_no_prompts command.package_name=mlproj command.debug=true

Clean test directory:

find . -mindepth 1 -delete # Be careful!

Usage

Initialize a new ML project

mhpy command.package_name=myproj

This will scaffold a complete project with:

  • Git repo initialized
  • Virtual environment with uv
  • Project structure (src/, tests/, notebooks/, data/, etc.)
  • Hydra configs
  • DVC setup
  • pre-commit hooks
  • Makefile with common commands
  • All dependencies installed

After running, just:

source .venv/bin/activate
wandb login  # if you use W&B

Requirements

  • Python ≥3.12
  • uv package manager

License

Check the LICENSE file in the repo.

About

Python lib for scaffolding ML projects and common utils

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Contributors