A python project task runner
Project description
werr
A simple, opinionated, python project task runner.
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
werrexecutes eachcheckcommand in sequence at the project root, printing which failed and how. - Running
werr fixexecutes eachfixcommand 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:
uv inituv add --dev black ruff ty pytest- add tasks to
[tool.werr] uvx werror add todevgroup and in venv justwerr
Failing Example
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
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file werr-0.5.0.tar.gz.
File metadata
- Download URL: werr-0.5.0.tar.gz
- Upload date:
- Size: 18.3 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
547a96b1febae3f7e925de89080e16ba73a66610cfd1f86c23f91463dd6fa3ff
|
|
| MD5 |
8920d3e8a63c0b477a647d6fbe12df0f
|
|
| BLAKE2b-256 |
77165cad255d2355734a561b0005d57dbbd8cab9ce247802b94897d9fb1c07b4
|
File details
Details for the file werr-0.5.0-py3-none-any.whl.
File metadata
- Download URL: werr-0.5.0-py3-none-any.whl
- Upload date:
- Size: 14.2 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
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b1cf23cc51b0c0a24c0c1a1d1dd8a9f71a90d35a39fe4f9be01016d1ce8337c5
|
|
| MD5 |
5852990d7a8e2742c6139ccea828b5ab
|
|
| BLAKE2b-256 |
324ce60e78bc01c0a1c011df61c14fc06fc42a80e732a7eed4dbf80a835701e9
|