Skip to main content

A lightweight, dependency-free tool to manage your scripts directly from pyproject.toml

Project description

Tomlscript

A lightweight, dependency-free tool to manage your scripts directly from pyproject.toml

Usage

# alias tom = "uvx tomlscript"
# List commands
tom

# Run a command
tom publish
tom dev
tom pyi

Example Configuration

# pyproject.toml
[tool.tomlscript]
# Start dev server
dev = "uv run uvicorn --port 5001 superapp.main:app --reload"

# Publish to PyPI
publish = "rm -rf dist && uv build && uvx twine upload dist/*"

# Generate pyi stubs (python function)
pyi = "mypackage.typing:generate_pyi"

Installation

pip install tomlscript
uv add --dev tomlscript

Running Commands

Directly

# alias tom = "uvx tomlscript"
tom
tom function
tom function arg1 --k2 v2

Using uv / uvx

uvx tomlscript
uvx tomlscript function arg1 --k2 v2

uv run tom
uv run tom function arg1 --k2 v2

Configuration

For real world examples, see pyproject.toml file.

[tool.tomlscript]
# This line is the documentation for `hello` function
hello = 'say_ "Hello world"'

# Run python function run2 from tests.myscript module
run2 = "tests.myscript:run2"

# Lint and test
test = """
uv run ruff check
uv run pytest --inline-snapshot=review
"""

# Define multiple functions in the `[tool.tomlscript.source]` sections
source = """
# Documentation for `doc` function
doc() {
  say_ "Rendering documentation..."
}

# Functions end with _ will not show in the list
say_() {
  echo "$1"
}
"""

Development

# Install dependencies
uv sync
alias tom="uv run tom"

# List the commands
tom

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

tomlscript-0.1.1.tar.gz (41.2 kB view hashes)

Uploaded Source

Built Distribution

tomlscript-0.1.1-py3-none-any.whl (6.3 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page