Show HN: Pcons: new software build tool in Python, inspired by SCons and CMake

  • Posted 2 hours ago by darkstarsys
  • 1 points
https://github.com/DarkStarSystems/pcons
I've been really gratified to see a bit of uptake of pcons in the open-source community, so I thought I'd post an update since it's up to v0.14.1 now. Pcons is a new open-source build tool that's the best of SCons and CMake with fewer of their problems.

Since v0.7 (last HN post), there's now a porting guide, LaTeX toolchain, full C++20 module support, Fortran toolchain (including MODULE/USE), WebAssembly via WASI and EMSDK. It can generate pkg-config files, finds MSVC more reliably, added Ninja restat support for even faster builds, better target.depends(), better logging and debugging, CMake-style template-based config headers and a lot of improvements and fixes.

I was one of the original developers of SCons and helped maintain it for years. I love that Python is the configuration language — it makes build descriptions incredibly flexible. But over time, working with CMake on other projects, I came to appreciate things SCons doesn't do as well: the separation between describing a build and executing it, transitive dependency propagation, package manager integration, and modern python semantics. I'd been thinking about a fresh start for years but never had the time. Recently, working collaboratively with Claude Code, it finally became feasible. So, meet pcons.

You can use it as `uvx pcons` for true zero-install (great for other open source projects). There's a comparison with other common build tools here: https://github.com/DarkStarSystems/pcons/blob/main/COMPARISO... — corrections and updates appreciated!

Major features as of v0.14.1: - Toolchains for GCC, LLVM/Clang, MSVC, and clang-cl with auto-detection, LaTeX, gfortran, WebAssembly etc. - Generators for Ninja, Makefile, Xcode, compile_commands.json, and Mermaid/DOT dependency diagrams - Can create installers: msix on Windows, pkg/dmg on Mac, tgz on Linux - Package management via pkg-config, Conan 2.x, and a pcons-fetch tool for building dependencies from source - Compiler cache support (ccache/sccache), semantic presets (warnings, sanitizers, LTO, hardening), cross-compilation presets (Android NDK, iOS, WebAssembly) - Platform-specific helpers: macOS bundles/frameworks/.pkg/.dmg, Windows manifests/MSIX, and an msvcup module for installing MSVC without Visual Studio - An extensible module/add-on system for domain-specific tasks - Debug tracing (--debug=resolve,subst) with source-location tracking on every node - Plenty of examples included, unit tests for all features, tested on Mac, Windows and Linux

It's under active development — ready for experimentation, but it's quite stable — enough for light production. I'd love bug reports, feedback on the API design and what you'd want from a modern Python-based software build system. I take my tools seriously and intend to support it well, so please try it out!

Open source, MIT licensed. GitHub: https://github.com/DarkStarSystems/pcons | Docs: https://pcons.readthedocs.io | PyPI: `uvx pcons` or `pip install pcons`

0 comments