Skip to content
Python-based build system for C/C++, built for the heck of it
Branch: master
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Type Name Latest commit message Commit time
Failed to load latest commit information.


pygrunt is a simple build system for C/C++ projects.

Projects are described entirely in Python. Since Python is also an excellent scripting language with a huge ecosystem built around it, it makes easy to do secondary tasks like checking platform, conditionally including or excluding source files, filter them based on certain conditions, move files around on the filesystem or handle command-line parameters.

Since the project is a one-night experiment so far ( a too long night... ), it supports only MinGW ( currently called GCCCompiler, to be fixed in the future ). However, pygrunt is designed with compiler-independence in mind. It should be relatively easy to add support for other compilers, given enough knowledge about the compiler itself.

Features are also in short supply, we'll see where this project goes.


A very early version of is included in the repository. Simply run the script and it will set up pygrunt with all of its dependencies:

python install

If you want to work on the code instead, run

python develop

The setup will create a pygrunt command that you can call from your console.

Since the project uses other git repos as examples, you might need to run

git submodule update --init --recursive

after cloning. This will clone all the submodules so the examples have actual sources to build.


Projects that build with pygrunt provide a Python script, usually named after the project itself. An example project, called GLWrap is included in this repository. Its corresponding script is called

To build GLWrap, type

pygrunt examples/

To build your own project with pygrunt, write a Python script that uses the pygrunt module and let it do the work. Currently, if all you need is to compile a bunch of source files and link them together, pygrunt should be fine. See the repo's root directory for examples. Here's a simple one:

import pygrunt
import pygrunt.compiler

def build():
    # Setup project
    project = pygrunt.Project('hello')
    project.working_dir = 'hello/'
    project.output_dir = 'build/'

    # Sanitize aka. set reasonable defaults
    # Also needed before adding sources
    # ( otherwise pygrunt will be looking in the wrong directories )

    # Add sources

    # Compile the whole thing
    #project.compiler = pygrunt.compiler.any()
    project.compiler = pygrunt.compiler.any()


Looking for GCC on PATH...
Found GCC at D:\dev\compilers\mingw\bin\gcc.exe
Source directory is D:\dev\python\pygrunt\examples\hello
Build directory is D:\dev\python\pygrunt\examples\build
[100%] Compiling hello.c -> hello.o
Linking executable build/hello ...


Colorama is used for fancy, colored output.


Yes, I'm aware that the name is already in use: PyGrunt

The project looks awesome, and also used the name earlier, which means this project will be renamed in the future.


See the proposals.


pygrunt is licensed under the GNU GPL v3 license. See LICENSE for more details.

This license only applies to pygrunt code ( all source files under the pygrunt directory ), other components with different licenses may be present in the repository ( for example the compile-src directory ).

You can’t perform that action at this time.