Skip to main content

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 Result objects.
  • 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.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for puild 0.2.0
File Size Uploaded
puild-0.2.0.tar.gz 7.0 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for puild 0.2.0
File Interpreter ABI Platform
puild-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 15.5 kB

Release files / puild-0.2.0.tar.gz

Download URL puild-0.2.0.tar.gz
Size 7.0 kB
Tags Source
SHA-256 checksum
How to use checksums
2bb266de2358ad241b09168774fbdcec24e6eb270c90606b147d341429cadb31
BLAKE2b-256 checksum
How to use checksums
b229865d8bc4f621870da38a00f031036810fa5b9cfecdf8bd232cb337e83b83
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.2.0-py3-none-any.whl

Download URL puild-0.2.0-py3-none-any.whl
Size 8.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
68e8a132c2846e258c76d605d793360526246aadc484f62cb423afc19dcc73ca
BLAKE2b-256 checksum
How to use checksums
6a293ea64a1a11fdb6aa7730f0808b65866228f85ab5f237d6e36fd1af27648f
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 history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.2

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page