https://github.com/aappleby/hancho Skip to content Toggle navigation Sign in * Product + Actions Automate any workflow + Packages Host and manage packages + Security Find and fix vulnerabilities + Codespaces Instant dev environments + Copilot Write better code with AI + Code review Manage code changes + Issues Plan and track work + Discussions Collaborate outside of code Explore + All features + Documentation + GitHub Skills + Blog * Solutions For + Enterprise + Teams + Startups + Education By Solution + CI/CD & Automation + DevOps + DevSecOps Resources + Learning Pathways + White papers, Ebooks, Webinars + Customer Stories + Partners * Open Source + GitHub Sponsors Fund open source developers + The ReadME Project GitHub community articles Repositories + Topics + Trending + Collections * Pricing Search or jump to... Search code, repositories, users, issues, pull requests... Search [ ] Clear Search syntax tips Provide feedback We read every piece of feedback, and take your input very seriously. [ ] [ ] Include my email address so I can be contacted Cancel Submit feedback Saved searches Use saved searches to filter your results more quickly Name [ ] Query [ ] To see all available qualifiers, see our documentation. Cancel Create saved search Sign in Sign up You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session. Dismiss alert {{ message }} aappleby / hancho Public * Notifications * Fork 3 * Star 127 * A simple pleasant build system in Python. License MIT license 127 stars 3 forks Branches Tags Activity Star Notifications * Code * Issues 1 * Pull requests 0 * Actions * Projects 0 * Security * Insights Additional navigation options * Code * Issues * Pull requests * Actions * Projects * Security * Insights aappleby/hancho This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository. main BranchesTags Go to file Code Folders and files Name Name Last commit Last commit message date Latest commit History 93 Commits .vscode .vscode docs docs examples examples tests tests tutorial tutorial .gitignore .gitignore LICENSE LICENSE README.md README.md build.hancho build.hancho hancho.code-workspace hancho.code-workspace hancho.png hancho.png hancho.py hancho.py hancho_small.png hancho_small.png View all files Repository files navigation * README * MIT license Logo Hancho "Ban Chang , hancho - "Squad leader", from 19th c. Mandarin Ban Chang (banzhang, "team leader")" Hancho is a simple, pleasant build system with few moving parts. Hancho fits comfortably in 500 lines of Python and requires no installation, just copy-paste it into your source tree. Hancho is inspired by Ninja (for speed and simplicity) and Bazel (for syntax and extensibility). Like Ninja, it knows nothing about your build tools and is only trying to assemble and run commands as fast as possible. Unlike Ninja, you don't need a separate build rule invocation for every single output file. Like Bazel, you invoke build rules by calling them as if they were functions with keyword arguments. Unlike Bazel, you can create build rules that call arbitary Python code (for better or worse). Hancho should suffice for small to medium sized projects. Tutorial Here Some Additional Documentation Here Updates * 2024-03-02 - Initial release. Some test cases yet to be written. Installation wget https://raw.githubusercontent.com/aappleby/hancho/main/hancho.py chmod +x hancho.py ./hancho.py --help Simple Example # examples/hello_world/build.hancho compile = Rule( desc = "Compile {files_in} -> {files_out}", command = "g++ -MMD -c {files_in} -o {files_out}", files_out = "{swap_ext(files_in, '.o')}", depfile = "{swap_ext(files_out, '.d')}", ) link = Rule( desc = "Link {files_in} -> {files_out}", command = "g++ {files_in} -o {files_out}", ) main_o = compile("main.cpp") main_app = link(main_o, "app") // examples/hello_world/main.cpp #include int main(int argc, char** argv) { printf("Hello World\n"); return 0; } user@host:~/hancho/examples/hello_world$ ../../hancho.py --verbose [1/2] Compile main.cpp -> build/main.o Reason: Rebuilding ['build/main.o'] because some are missing g++ -MMD -c main.cpp -o build/main.o [2/2] Link build/main.o -> build/app Reason: Rebuilding ['build/app'] because some are missing g++ build/main.o -o build/app hancho: BUILD PASSED user@host:~/hancho/examples/hello_world$ build/app Hello World user@host:~/hancho/examples/hello_world$ ../../hancho.py --verbose hancho: BUILD CLEAN About A simple pleasant build system in Python. Topics python python3 build-tool Resources Readme License MIT license Activity Stars 127 stars Watchers 2 watching Forks 3 forks Report repository Releases 1 tags Packages 0 No packages published Languages * Python 98.2% * C++ 1.8% Footer (c) 2024 GitHub, Inc. Footer navigation * Terms * Privacy * Security * Status * Docs * Contact * Manage cookies * Do not share my personal information You can't perform that action at this time.