Skip to main content

A lightweight script runner for uv — define and run project scripts from pyproject.toml

Project description

uv-script

PyPI

A lightweight, zero-dependency script runner for uv. Define project scripts in pyproject.toml and run them through uv run.

$ uvs --list
  check   lint -> test
  format  ruff format src/
  lint    ruff check src/
  test    pytest tests/ -v

Why?

uv is a fantastic package manager but has no built-in task runner. If you've been using Hatch just for its scripts, or reaching for Poe the Poet / Taskipy to fill the gap, uvs offers a simpler alternative:

  • Zero runtime dependencies — stdlib only (tomllib, argparse, subprocess)
  • uv-native — every command runs through uv run, so your venv, lockfile, and Python version are always in sync
  • Familiar — if you've used npm scripts or Hatch scripts, you already know how this works

Installation

# As a dev dependency in your project
uv add --dev uv-script

# Or run without installing
uvx uv-script --list

Quick start

Add a [tool.uvs.scripts] section to your pyproject.toml:

[tool.uvs.scripts]
test = "pytest tests/ -v"
lint = "ruff check src/"
format = "ruff format src/"
check = ["lint", "test"]

Then run:

uvs test       # runs: uv run pytest tests/ -v
uvs check      # runs lint, then test (stops on first failure)
uvs --list     # shows all available scripts

Configuration

Scripts are defined under [tool.uvs.scripts] in pyproject.toml. Three formats are supported:

Simple command

A string value runs a single command through uv run:

[tool.uvs.scripts]
test = "pytest tests/ -v"
lint = "ruff check ."

Composite script

An array of strings runs multiple steps sequentially. Items can reference other script names or be raw commands. Execution stops on the first non-zero exit code.

[tool.uvs.scripts]
lint = "ruff check ."
test = "pytest tests/"
check = ["lint", "test"]
full = ["ruff format --check .", "lint", "test"]

Table with options

A table gives you control over environment variables and help text:

[tool.uvs.scripts.serve]
cmd = "python -m flask run"
env = { FLASK_DEBUG = "1", FLASK_APP = "app.py" }
help = "Start the development server"

[tool.uvs.scripts.deploy]
cmd = "python scripts/deploy.py"
env = { ENV = "production" }
help = "Deploy to production"
Key Type Required Description
cmd string yes The command to run
env table of strings no Environment variables (overlays current)
help string no Description shown in --list output

Usage

uvs [options] <script> [-- extra-args...]
Flag Description
-l, --list List all available scripts
-v, --verbose Print each command before running
-V, --version Show version and exit

Passing extra arguments

Use -- to forward arguments to the underlying command:

uvs test -- -k "test_parse" --no-header
# runs: uv run pytest tests/ -v -k test_parse --no-header

For composite scripts, extra arguments are appended to the last command in the chain.

Running from subdirectories

uvs walks up from your current directory to find the nearest pyproject.toml, just like uv does. You can run uvs test from anywhere inside your project.

How it works

uvs is a thin orchestration layer. Every command is prefixed with uv run, which means:

  1. Your virtual environment is automatically activated
  2. Dependencies are synced from the lockfile if needed
  3. The correct Python version is used

There is no magic — uvs test is equivalent to typing uv run pytest tests/ -v yourself.

Development

This project uses uvs to manage its own scripts:

git clone <repo-url> && cd uv-script
uv sync
uvs test       # run tests
uvs lint       # run linter
uvs check      # lint + test

License

MIT

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

uv_script-0.1.5.tar.gz (5.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

uv_script-0.1.5-py3-none-any.whl (6.9 kB view details)

Uploaded Python 3

File details

Details for the file uv_script-0.1.5.tar.gz.

File metadata

  • Download URL: uv_script-0.1.5.tar.gz
  • Upload date:
  • Size: 5.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uv_script-0.1.5.tar.gz
Algorithm Hash digest
SHA256 c82b01096f5c5572642989dd5cb8fe761071cffec0ec4af94568b02c7bca9b4b
MD5 85d6ad5d6ae2a236e756b18ea8123a3d
BLAKE2b-256 6107abaebb4fce1b74ea546e588c362ba6114daa682d8ebb26898e91cb6da799

See more details on using hashes here.

Provenance

The following attestation bundles were made for uv_script-0.1.5.tar.gz:

Publisher: python-publish.yml on fsimkovic/uv-script

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file uv_script-0.1.5-py3-none-any.whl.

File metadata

  • Download URL: uv_script-0.1.5-py3-none-any.whl
  • Upload date:
  • Size: 6.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for uv_script-0.1.5-py3-none-any.whl
Algorithm Hash digest
SHA256 b6bbd3ac54e1a7af3d1c8f26b6554b05ed942448cf6c908eb3754d665376acfa
MD5 4ee881224e2863dbc7bbfffe9bb3f1ec
BLAKE2b-256 97b1dd49dc70ff45bc2833a8fac9727cd678774fa81114df6e0857df0315e1c2

See more details on using hashes here.

Provenance

The following attestation bundles were made for uv_script-0.1.5-py3-none-any.whl:

Publisher: python-publish.yml on fsimkovic/uv-script

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

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