A modern Python-based build system that generates Ninja (or Makefile) build files.
Pcons is inspired by SCons and CMake, taking the best ideas from each:
- From SCons: Environments, Tools, dependency tracking, Python as the configuration language
- From CMake: Generator architecture (configure once, build fast), usage requirements that propagate through dependencies
Key design principles:
- Configuration, not execution: Pcons generates Ninja files; Ninja executes the build
- Python is the language: No custom DSL—build scripts are real Python with full IDE support
- Language-agnostic: Build C++, Rust, LaTeX, protobuf, or anything else
- Explicit over implicit: Dependencies are discoverable and traceable
🚧 Under active development - ready for experimentation and feedback.
Core functionality is working: C/C++ compilation, static and shared libraries, programs, and install targets. See ARCHITECTURE.md for design details.
# pcons-build.py
from pcons.core.project import Project
from pcons.toolchains import find_c_toolchain
project = Project("myapp", build_dir="build")
# Find and configure a C/C++ toolchain
toolchain = find_c_toolchain()
env = project.Environment(toolchain=toolchain)
env.cc.flags.extend(["-Wall"])
# Build a static library
lib = project.StaticLibrary("core", env)
lib.sources.append(project.node("src/core.c"))
lib.public.include_dirs.append(Path("include"))
# Build a program
app = project.Program("myapp", env)
app.sources.append(project.node("src/main.c"))
app.link(lib)
project.Default(app)
project.resolve()
project.generate()uv run pcons-build.py
ninja -C buildNo installation needed, if you have uv; just use uvx pcons to configure and build. uvx pcons --help for more info.
If you want to install it, though:
# Using uv
uv add pcons
# Or pip
pip install pconsFor development:
git clone https://github.com/garyo/pcons.git
cd pcons
uv sync- User Guide is at ReadTheDocs
- ARCHITECTURE.md - Design document and implementation status
- CONTRIBUTING.md - How to contribute
# Run tests
uv run pytest
# Run linter
make lint
# Format code
make fmt
# Or use uv directly
uv run ruff check pcons/
uv run mypy pcons/MIT License - see LICENSE