chorelib
A Python build automation framework — like Make, but in Python. chorelib focuses on keeping Make-style speed and rebuild behavior while letting you write build logic in real Python.
chorelib uses a decorator-based DSL for defining build rules and tasks, with dependency management, parallel execution, and mtime-based rebuild detection.
Features
- Decorator-based DSL — Define build rules with
@ruleand tasks with@task, using familiar Python syntax - Regex target patterns — Match multiple targets with regex and use backreferences (
\1) in dependency specifications - Async parallel execution — Run independent build steps concurrently with configurable worker count
- mtime-based rebuild — Skip up-to-date targets automatically, just like Make
- Custom mtime functions — Override mtime checking per target pattern to manage non-file resources (databases, S3 objects, etc.)
- Order-only prerequisites —
needsdependencies ensure build order without triggering rebuilds - Auto-generated help —
-hshows usage with target documentation from docstrings,-llists all available targets - Custom command-line options — Subclass
Mainto add your ownargparseoptions for build configuration - Zero dependencies — Pure Python, no external packages required
Best for: developers who want Make-like rebuild behavior but need Python for complex logic or non-file resources. It also works well as a simple task runner for everyday scripts.
Documentation
Full documentation is available at https://chorelib.readthedocs.io/en/latest/
Installation
pip install chorelib
Quick Start
Here is a Makefile and its chorelib equivalent side by side.
Makefile:
CC=gcc
CFLAGS=-I.
DEPS = hello.h
OBJS = main.o hello.o
.PHONY: clean
%.o: %.c $(DEPS)
$(CC) -c -o $@ $< $(CFLAGS)
hello.exe: $(OBJS)
$(CC) -o $@ $^
clean:
rm -f $(OBJS) hello.exe
chorelib (make.py):
import re
from chorelib import Main, command, rule, task
main = Main()
APP = "hello.exe"
CC = "gcc"
CFLAGS = ["-c", "-I."]
DEPS = ["hello.h"]
OBJS = ["hello.o", "main.o"]
@rule(APP, depends=OBJS, default=True)
def link(target, deps, needs):
"""Build executable"""
command(CC, "-o", target, deps)
@rule(re.compile(r"(.+)\.o"), depends=(r"\1.c", DEPS))
def compile(target, deps, needs):
command(CC, "-o", target, deps[0], CFLAGS)
@task
def clean():
"""Remove the built files."""
command("rm", "-f", OBJS, APP)
if __name__ == "__main__":
main.run()
uv run make.py # Build default target
uv run make.py clean # Run the clean task
uv run make.py -w 4 # Build with 4 parallel workers
uv run make.py -r # Force rebuild all
uv run make.py -h # Show help with target docs
uv run make.py -l # List all available targets
-h displays usage information along with target documentation extracted from docstrings:
$ uv run make.py -h
usage: make.py [-h] [-C DIRECTORY] [-w WORKERS] [-r] [-l] [-v] [-V] [targets ...]
Sample build script for building a C program using chorelib.
hello.exe [default]:
Build executable
clean:
Remove the built files.
rebuild:
Clean and rebuild all files.
execute:
Rebuild and execute the program.
...
-l lists all registered targets with their types, dependencies, and builder functions:
$ uv run make.py -l
[rule] hello.exe:
depends: hello.o, main.o
needs:
function: link
[rule] re: (.+)\.o:
depends: \1.c, hello.h
needs:
function: compile
[task] clean:
needs:
builder: clean
...
Why chorelib over Make?
| Make | chorelib | |
|---|---|---|
| Pattern rules | %.o: %.c |
r"^(.+)\.o" with backreferences |
| Variables & logic | Limited macro language | Full Python |
| Parallel builds | make -j4 |
python make.py -w 4 |
| Non-file targets | .PHONY |
@task decorator |
| Custom mtime | Not supported | @mtime decorator for databases, remote objects, etc. |
| Dependencies | File-only | Files, functions, or any callable |
License
MIT
Metadata
Release files for chorelib 0.2.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| chorelib-0.2.1.tar.gz | 16.2 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| chorelib-0.2.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 35.9 kB
Release files / chorelib-0.2.1.tar.gz
| Download URL | chorelib-0.2.1.tar.gz |
|---|---|
| Size | 16.2 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8ae00327b475bb89a2f85fa7c11e2b1e82f947d318beba921d2c076d8cd6cbf2
|
|
BLAKE2b-256 checksum How to use checksums |
aa8383f969f29c6db7ee7584340f51670c08d86ec04629f4b047d9e4b7190954
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency logRelease files / chorelib-0.2.1-py3-none-any.whl
| Download URL | chorelib-0.2.1-py3-none-any.whl |
|---|---|
| Size | 19.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
079a7dc712aeb771c7027615e7479582ef04cce7ef3f5cd83de743ca20b901c4
|
|
BLAKE2b-256 checksum How to use checksums |
d27965d9214c13630ed4ce87cb01c3a2d958bb663683cc80c8b1964bac41e6fc
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/6.1.0 CPython/3.13.7
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Apr 1, 2026.
Transparency log