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.
- Define scripts in your
pyproject.toml - Easily run scripts with
run [name] - Cross-platform support using subprocess
- Supports
preandpostscripts - 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)
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-runFirst, 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)"Run scripts with the run command.
run buildList available scripts with --list.
run -lRun without installing using astral-sh/uv.
uvx toml-run buildTip
Automatically Format TOML with tombi
Try it out with: uvx tombi format
If you run into any issues or need help getting started, please do one of the following:
- Report an Issue: https://github.com/cssnr/toml-run/issues
- Q&A Discussion: https://github.com/cssnr/toml-run/discussions/categories/q-a
- Request a Feature: https://github.com/cssnr/toml-run/issues/new?template=1-feature.yaml
- Chat with us on Discord: https://discord.gg/wXy6m2X8wY
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.
For a full list of current projects visit: https://cssnr.github.io/