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
# 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 = "uv run tom"
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.0.tar.gz
(40.2 kB
view hashes)
Built Distribution
Close
Hashes for tomlscript-0.1.0-py3-none-any.whl
Algorithm | Hash digest | |
---|---|---|
SHA256 | b4d0ae53b8f6b370dba45b817688e5fd3896f25ebc61b2483f4c011385880ae7 |
|
MD5 | 7926687b2255c16c071c03a6f5c0da39 |
|
BLAKE2b-256 | 02812354f65cfd6a03673c71749a5ff97edc6c435aea8a1e0b8a155e0003fec5 |