Skip to content
/ toml-run Public

Define custom scripts in your pyproject.toml and easily run them with this dependency free tool.

License

Notifications You must be signed in to change notification settings

cssnr/toml-run

Repository files navigation

PyPI Version GitHub Release Version TOML Python Version PyPI Downloads Pepy Total Downloads Codecov Workflow Lint Workflow Test Deployment PyPi Deployment Docs GitHub Last Commit GitHub Repo Size GitHub Top Language GitHub Contributors GitHub Issues GitHub Discussions GitHub Forks GitHub Repo Stars GitHub Org Stars Discord Ko-fi

TOML Run

TOML Run

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.

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

To get started Install the cli and view the Usage.

View Documentation

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 🧪 (experimental)

View Full Reference

Install

From PyPI: https://pypi.org/p/toml-run

pip install toml-run
pip install --group dev toml-run

uv tool install toml-run
uv add --dev toml-run

brew install cssnr/tap/toml-run

View Install Guide

Usage

First, add some scripts to the pyproject.toml using the [tool.scripts] section.

[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"
format = """
uv run black .
uv run ruff format .
"""
rmtree = "#py shutil.rmtree('.cache', True)"

View Scripts Guide

Run scripts with the run command.

run build

List available scripts with --list.

run -l

Run without installing using astral-sh/uv.

uvx toml-run build

View Usage Guide

Tip

Automatically Format TOML with tombi Try it out with: uvx tombi format

Support

If you run into any issues or need help getting started, please do one of the following:

Features Issues Discussions Discord

Contributing

If you would like to submit a PR, please review the CONTRIBUTING.md.

Please consider making a donation to support the development of this project and additional open source projects.

Ko-fi

For a full list of current projects visit: https://cssnr.github.io/

About

Define custom scripts in your pyproject.toml and easily run them with this dependency free tool.

Topics

Resources

License

Contributing

Stars

Watchers

Forks

Sponsor this project

Languages