Skip to main content

A python project task runner

Project description

gear

werr

werr version license python

A simple, opinionated, python project task runner.

werr passing

A task is a configured sequence of commands to run.

[project]
name = "appletree"
version = "0.1.0"
dependencies = [
    "pysunlight==24.1",
]

[tool.werr]
# The first defined task is the default task if `werr` is run with no arguments.
task.check = [
    "black --check .",
    "isort --check .",
    "ruff check",
    "mypy .",
    "pytest",
]
task.fix = [
    "black .",
    "isort .",
    "ruff check --fix",
]

In this example:

  • Running werr executes each check command in sequence at the project root, printing which failed and how.
  • Running werr fix executes each fix command in sequence.

All commands are run using uv (the only dependency of this project), andt he tool returns a non-zero exit code if any command fails.

Installation

The simplest method of installation is:

uv tool install werr

Command Variables

Variables to use in task commands can be defined under the variable key:

[tool.werr]
variable.packages = "werrlib/ tests/"
task.check = [
    "black --check {packages}",
    ...
]
  • define: variable.packages = "werrlib/ tests/"
  • use: ruff check {packages}

Structured Output

werr         # interactive human readable output (default)
werr --json  # emit lines of JSON representing the result of each command
werr --xml   # print Junit XML for CI

The --json output results in a line of JSON being emitted as soon as a command finishes:

> werr --json | jq
{
  "task": "black",
  "command": "black --check {project}/werrlib",
  "duration": 0.10738483420573175,
  "output": "All done! ✨ 🍰 ✨\n8 files would be left unchanged.\n",
  "success": true
}
{
  "task": "ruff",
  "command": "ruff check {project}/werrlib",
  "duration": 0.016670041950419545,
  "output": "All checks passed!\n",
  "success": true
}
{
  "task": "ty",
  "command": "ty check {project}/werrlib",
  "duration": 0.03577654203400016,
  "output": "All checks passed!\n",
  "success": true
}
{
  "task": "pytest",
  "command": "pytest --config-file {project}/pyproject.toml",
  "duration": 0.13576683308929205,
  "output": "============================= test session starts ==============================\nplatform darwin -- Python 3.14.0rc1, pytest-9.0.2, pluggy-1.6.0\nrootdir: /Users/joe/repos/werr\nconfigfile: pyproject.toml\ntestpaths: tests\ncollected 7 items\n\ntests/test_config.py .......                                             [100%]\n\n============================== 7 passed in 0.01s ===============================\n",
  "success": true
}

Custom Tasks

Define a custom task with task.<name> = [ ... ]

[tool.werr]
# ...
task.docs = [
    "sphinx-build -b html .",
]

Running werr docs will build the documentation.

New Project

A suggested workflow for creating a new project is:

  1. uv init
  2. uv add --dev black ruff ty pytest
  3. add tasks to [tool.werr]
  4. uvx werr or add to dev group and in venv just werr

Failing Example

werr failing

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

werr-0.4.0.tar.gz (18.2 kB view details)

Uploaded Source

Built Distribution

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

werr-0.4.0-py3-none-any.whl (14.3 kB view details)

Uploaded Python 3

File details

Details for the file werr-0.4.0.tar.gz.

File metadata

  • Download URL: werr-0.4.0.tar.gz
  • Upload date:
  • Size: 18.2 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for werr-0.4.0.tar.gz
Algorithm Hash digest
SHA256 dcc26a066380d99cc3e73d8a8303b06b912de72b71d055dbe21fd76111f8aaf4
MD5 d97abff305be8787dff331dac2ebe964
BLAKE2b-256 4079373ef75df26857ad004361048d29c0b3d260836f8a82749db8b5fa967c43

See more details on using hashes here.

File details

Details for the file werr-0.4.0-py3-none-any.whl.

File metadata

  • Download URL: werr-0.4.0-py3-none-any.whl
  • Upload date:
  • Size: 14.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: uv/0.10.0 {"installer":{"name":"uv","version":"0.10.0","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}

File hashes

Hashes for werr-0.4.0-py3-none-any.whl
Algorithm Hash digest
SHA256 d9b98d5a0ca63b7781884c236eb46b8065e3a1ea019a6f5ba54f8a551ecc7727
MD5 3a3c82e01e5670c0120d1b2cfd9780cd
BLAKE2b-256 284dc389f18f155f82582d41dbef8d32aa07eb57abb4de9bc25cb59d57b2170f

See more details on using hashes here.

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