puild
A lightweight, modern build tool and command runner for Python.
Features
- Command Runner: Run system commands with fluent argument construction, rich logging, and typed results.
- Pipelines & Redirection: Shell-like piping (
cmd1 | cmd2) and redirection (cmd > "file.txt"). - Streaming & Live Output: Real-time stdout/stderr streaming while capturing output into typed
Resultobjects. - Dry-run & Quiet Modes: Preview commands before execution or silence logs during scripts and testing.
- Build Primitives: Timestamp-based rebuild detection (
needs_rebuild) and filesystem helpers (mkdir,rm,copy,find_files).
Quickstart
1. Basic Command Execution
from puild import Command
# Direct instantiation
cmd = Command("gcc", "-Wall", "-O2", "main.c", "-o", "bin/app")
res = cmd.run(text=True)
if not res.ok:
res.exit_for_error()
2. Fluent Argument Builder & Environment
from puild import Command
cmd = (
Command("gcc")
.arg("-Wall")
.arg("-O2")
.args(["main.c", "-o", "bin/app"])
.env("CFLAGS", "-march=native")
.cwd("src")
)
res = cmd.run(text=True)
print(res.stdout)
3. Piping and File Redirection
from puild import Command
# Pipe between commands
pipe = Command("cat", "access.log") | Command("grep", "ERROR")
res = pipe.run(text=True)
# File redirection
cmd = Command("echo", "build completed") > "build.log"
cmd.run()
# Append to file
cmd = Command("echo", "second step completed") >> "build.log"
cmd.run()
4. Live Streaming Output & Indentation
Stream command output to stdout/stderr in real-time. Output is automatically indented (default 4 spaces) so it stays visually separated from puild's action logs:
from puild import Command, set_default_indent
# Stream with default 4-space indentation
cmd = Command("npm", "install")
cmd.run(stream=True, text=True)
# Custom indentation per-command or globally
cmd.run(stream=True, indent=" ") # 2 spaces
set_default_indent(" ") # Set global default
5. Incremental Builds (needs_rebuild)
Skip compiling when targets are already up-to-date:
from puild import Command, needs_rebuild, find_files
sources = find_files("src", "*.c")
target = "build/app"
if needs_rebuild(target, sources, log=True):
Command("gcc", *sources, "-o", target).run(check=True)
6. Filesystem Helpers
from puild import mkdir, rm, copy, find_files
# Create directories
mkdir("build/bin")
# Find files
c_files = find_files("src", "*.c", recursive=True)
# Copy files or directories
copy("src/config.json", "build/config.json")
# Remove files or directories
rm("build", recursive=True)
Release files for puild 0.1.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 | |
|---|---|---|---|
| puild-0.1.1.tar.gz | 7.0 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| puild-0.1.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 15.8 kB
Release files / puild-0.1.1.tar.gz
| Download URL | puild-0.1.1.tar.gz |
|---|---|
| Size | 7.0 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
77b12e279ceb45efa28cdcfa38099b7a5f052b81852b1aa82adab826f1bced02
|
|
BLAKE2b-256 checksum How to use checksums |
7c121f789fe55a5a98e54f1792efb4227cea30d3abee1f510255f1b306a96c30
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|
Release files / puild-0.1.1-py3-none-any.whl
| Download URL | puild-0.1.1-py3-none-any.whl |
|---|---|
| Size | 8.8 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
c5e012584a94c02de0901107d6dd5385093acf41987ea61e5e3a7766e4f90075
|
|
BLAKE2b-256 checksum How to use checksums |
aace3e57adbe0838965f31a3d6d6397305808cf1f32bdf5be3cc899d59ae193a
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
uv/0.11.7 {"installer":{"name":"uv","version":"0.11.7","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
|