Skip to main content

Lightweight Python Build Tool

Project description


Why I did this fork and what will happen here?

This project was forked from Pynt And Pynt itself was forked from Microbuild

I appreciate work made by Raghunandan Rao in Pynt and work done by Calum Eadie in Microbuild. Both Pynt and Microbuild are not under development for a long time, so changes made here will not be pushed to those repos.

Aim of this navio-builder project is to provide community and my clients with lightweight and easy to use python devops tool.

A pynt of Python build.


  • Easy to learn.
  • Build tasks are just python funtions.
  • Manages dependencies between tasks.
  • Automatically generates a command line interface.
  • Rake style param passing to tasks
  • Supports python 2.7 and python 3.x

Todo Features

  • Async tasks
  • Additional tasks timing reporting


You can install navio-builder from the Python Package Index (PyPI) or from source.

Using pip

$ pip install navio-builder

Using easy_install

$ easy_install navio-builder


The build script is written in pure Python and navio-builder takes care of managing any dependencies between tasks and generating a command line interface.

Writing build tasks is really simple, all you need to know is the @task decorator. Tasks are just regular Python functions marked with the @task() decorator. Dependencies are specified with @task() too. Tasks can be ignored with the @task(ignore=True). Disabling a task is an useful feature to have in situations where you have one task that a lot of other tasks depend on and you want to quickly remove it from the dependency chains of all the dependent tasks.


import sys
from navio.builder import task

def clean():
    '''Clean build directory.'''
    print 'Cleaning build directory...'

def html(target='.'):
    '''Generate HTML.'''
    print 'Generating HTML in directory "%s"' %  target

@task(clean, ignore=True)
def images():
    '''Prepare images.'''
    print 'Preparing images...'

def start_server(server='localhost', port = '80'):
    '''Start the server'''
    print 'Starting server at %s:%s' % (server, port)

@task(start_server) #Depends on task with all optional params
def stop_server():
    print 'Stopping server....'

def copy_file(src, dest):
    print 'Copying from %s to %s' % (src, dest)

def echo(*args,**kwargs):
    print args
    print kwargs
# Default task (if specified) is run when no task is specified in the command line
# make sure you define the variable __DEFAULT__ after the task is defined
# A good convention is to define it at the end of the module
# __DEFAULT__ is an optional member


Running navio-builder tasks

The command line interface and help is automatically generated. Task descriptions are extracted from function docstrings.

$ nb -h
usage: nb [-h] [-l] [-v] [-f file] [task [task ...]]

positional arguments:
  task                  perform specified task and all its dependencies

optional arguments:
  -h, --help            show this help message and exit
  -l, --list-tasks      List the tasks
  -v, --version         Display the version information
  -f file, --file file  Build file to read the tasks from. Default is
$ nb -l
Tasks in build file ./
  clean                       Clean build directory.
  html                        Generate HTML.
  images           [Ignored]  Prepare images.
  start_server     [Default]  Start the server

Powered by navio-builder - A Lightweight Python Build Tool.

navio-builder takes care of dependencies between tasks. In the following case start_server depends on clean, html and image generation (image task is ignored).

$ nb #Runs the default task start_server. It does exactly what "nb start_server" would do.
[ - Starting task "clean" ]
Cleaning build directory...
[ - Completed task "clean" ]
[ - Starting task "html" ]
Generating HTML in directory "."
[ - Completed task "html" ]
[ - Ignoring task "images" ]
[ - Starting task "start_server" ]
Starting server at localhost:80
[ - Completed task "start_server" ]

The first few characters of the task name is enough to execute the task, as long as the partial name is unambigious. You can specify multiple tasks to run in the commandline. Again the dependencies are taken taken care of.

$ nb cle ht cl
[ - Starting task "clean" ]
Cleaning build directory...
[ - Completed task "clean" ]
[ - Starting task "html" ]
Generating HTML in directory "."
[ - Completed task "html" ]
[ - Starting task "clean" ]
Cleaning build directory...
[ - Completed task "clean" ]

The 'html' task dependency 'clean' is run only once. But clean can be explicitly run again later.

nb tasks can accept parameters from commandline.

$ nb "copy_file[/path/to/foo, path_to_bar]"
[ - Starting task "clean" ]
Cleaning build directory...
[ - Completed task "clean" ]
[ - Starting task "copy_file" ]
Copying from /path/to/foo to path_to_bar
[ - Completed task "copy_file" ]

nb can also accept keyword arguments.

$ nb start[port=8888]
[ - Starting task "clean" ]
Cleaning build directory...
[ - Completed task "clean" ]
[ - Starting task "html" ]
Generating HTML in directory "."
[ - Completed task "html" ]
[ - Ignoring task "images" ]
[ - Starting task "start_server" ]
Starting server at localhost:8888
[ - Completed task "start_server" ]
$ nb echo[hello,world,foo=bar,blah=123]
[ - Starting task "echo" ]
('hello', 'world')
{'blah': '123', 'foo': 'bar'}
[ - Completed task "echo" ]

Organizing build scripts

You can break up your build files into modules and simple import them into your main build file.

from deploy_tasks import *
from test_tasks import functional_tests, report_coverage


If you want to make changes the repo is at You will need pytest to run the tests

$ ./b t

It will be great if you can raise a pull request once you are done.

If you find any bugs or need new features please raise a ticket in the issues section of the github repo.


navio-builder is licensed under a MIT license


0.1.16 - 14/12/2017

  • Add task running time to output

0.1.0 - 11/12/2017

  • Initial release. Fork from pynt.
  • Rename done to modules

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

navio-builder-0.3.3.tar.gz (12.0 kB view hashes)

Uploaded source

Built Distribution

navio_builder-0.3.3-py2.py3-none-any.whl (10.2 kB view hashes)

Uploaded py2 py3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page