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
Release history Release notifications | RSS feed
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)
Built Distribution
Close
Hashes for tomlscript-0.1.1-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | 286948284ed2e12bcb1ae4a0fd49eede3b5f5fcbb87ea6e398ab539df9398711 |
|
MD5 | a7a10da006b68e10b1216a9567efb97f |
|
BLAKE2b-256 | f04012dde8f5979fdd204efea3be8347f153b8106528f8092cbaf049e0236c50 |