Skip to content

Get Started

TOML Run

PyPI Version TOML Python Version PyPI Downloads Pepy Total Downloads Codecov Workflow Test GitHub Last Commit GitHub Issues GitHub Discussions GitHub Forks GitHub Repo Stars GitHub Org Stars Discord Ko-fi

Define custom scripts in your pyproject.toml and easily run them with this dependency free tool. This tool is both inspired by and similar to NPM Scripts .

To get started see the Quick Start section or check out the Features.

uv tool install toml-run
uv add --dev toml-run
pip install toml-run
pip install --group dev toml-run
brew install cssnr/tap/toml-run
pyproject.toml
[tool.scripts]
build = "uv run hatch build"
run build

If you run into any issues or have any questions, support is available.

There are detailed Install, Script and Usage guides available.

Features

  • Define scripts in your pyproject.toml
  • Easily run scripts with run [name]
  • Cross-platform support using subprocess
  • Supports pre and post scripts
  • Supports multiple commands per script
  • Pass additional arguments to scripts
  • Automatically finds the pyproject.toml
  • Runs scripts relative to the root directory
  • Evaluate python code

For more details see the full reference.

Quick Start

First, install the package from PyPi or GitHub .

uv tool install toml-run
uv add --dev toml-run
pip install toml-run
pip install --group dev toml-run
brew install cssnr/tap/toml-run

Then, add some scripts to the pyproject.toml.

pyproject.toml
[tool.scripts]
clean = "rm -rf dist"
build = "run clean && uv run hatch build"
prelint = "echo always runs before lint"
lint = ["uv run ruff check .", "uv run ty check ."]
postlint = "echo always runs after lint"

Finally, run a script.

run build

Or, run without installing using astral-sh/uv .

uvx toml-run build

Script Reference

Usage Reference

 

Question

If you need help getting started or run into any issues, support is available!