HN 표시: Pcons: SCons 및 CMake에서 영감을 받은 Python의 새로운 소프트웨어 빌드 도구
hackernews
|
|
📦 오픈소스
#claude
#오픈소스
원문 출처: hackernews · Genesis Park에서 요약 및 분석
요약
파이썬 기반의 크로스 플랫폼 빌드 시스템인 Pcons는 의존성 그래프를 활용해 반복 가능한 워크플로우를 지원하며, 주로 C/C++와 같은 언어에 최적화되었습니다. SCons와 CMake에서 영감을 받아 파이썬 설정 언어의 유연함과 CMake의 강력한 기능을 결합하는 것을 목표로 하며, 기존 SCons의 고착화된 방식을 개선하여 최신 파이썬 환경에 부합하도록 설계되었습니다.
본문
A modern open-source cross-platform zero-install Python-based build system. Builds anything that requires a repeatable workflow, using a dependency graph. Easy to use, reliable and quick. Uses Ninja (or Makefile, XCode, or MSVS) to do the builds. Optimized for C/C++, Fortran, CUDA, wasm etc. but should work for anything that needs building. Pcons is inspired by SCons and CMake, taking a few of 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 - Extensible: Add-on modules for domain-specific tasks (plugin bundles, SDK configuration, etc.) I was one of the original developers of SCons, and helped maintain it for many years. I love that python is the config language; that makes build descriptions incredibly flexible and powerful. Recently I've been using CMake for more projects, and despite the deeply painful configuration language, I've come to appreciate its power: conan integration, the separation between describing the build andrunning it, and dependency propagation, among other things. I feel that SCons hasn't kept up with modern python; like any very widely used mature project, it has a lot of accumulated wisdom but also a bit ossified ways of doing things. I've been thinking for years now about rearchitecting SCons onto a modern python stack with Path and decorators and all the other wonderful stuff python has been doing, and fixing some of the pain points at the same time (substitution/quoting, extensibility, tracing, separation between description and building, and more), but I've never had the time to dig into it. But recently as I've been using a lot more of Claude Code as a programming assistant, and it has gotten significantly better, it seemed like the right time to try this as a collaborative project. So, meet pcons! Here's a comparison between pcons and other common modern build tools. I think pcons fills a real need, for a general-purpose broadly applicable extensible software build tool using a modern well-known language to describe builds and tools. 🚧 Under active development - ready for experimentation and feedback. It's working in several medium-sized projects. Core functionality is working and well tested: C/C++/Fortran compilation, static and shared libraries, programs, install targets, installers (Win/Mac), and mixed-language builds. See ARCHITECTURE.md for design details. # pcons-build.py from pcons import Project, find_c_toolchain project = Project("myapp") env = project.Environment(toolchain=find_c_toolchain()) env.cc.flags.extend(["-Wall"]) # Build a static library lib = project.StaticLibrary("core", env, sources=["src/core.c"]) lib.public.include_dirs.append("include") # Build a program that links the library app = project.Program("myapp", env, sources=["src/main.c"]) app.link(lib) project.generate() uvx pcons # generate ninja.build and run it, producing build/myapp (or build/myapp.exe) No 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: # Install as a CLI tool (recommended) uv tool install pcons pcons ... # Or add to a project's dependencies uv add pcons # Or with pip pip install pcons - User Guide is at ReadTheDocs - Porting from CMake - Side-by-side guide for migrating CMake projects to pcons - 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/ PCons is my long-term vision for a modern build tool. I've used Claude Code extensively to assist in creating this project, mostly Claude Opus 4.6. It has been a huge help in realizing the vision I've had for a long time. If you reflexively or morally reject all AI-generated or AI-assisted code, pcons is not for you. That said, I've reviewed every decision and nearly every line, and this code reflects my vision, my architecture, my goals and my priorities. I take full responsibility for it, and as a professional software engineer with 40+ years of C/C++/python experience I stand behind it. I also intend to support it long-term. One of my sub-goals has been to make sure the documentation and source organization is clear; not just for humans but for browsing by AI agents. I want to make it easy for a human or an AI agent to create a best-practices pcons-build.py for your project quickly and easily. Using AI to auto-generate doc and making sure APIs are clean and consistent helps with that goal. MIT License - see LICENSE
Genesis Park 편집팀이 AI를 활용하여 작성한 분석입니다. 원문은 출처 링크를 통해 확인할 수 있습니다.
공유