Lightweight Python Build Tool
Why I did this fork and what will happen here?
This project was forked from Pynt. Raghunandan Rao
Aim of this navio-builder project is to provide my clients with lightweight and easy to use python devops tool. I’m going to accumulate work done by Raghunandan Rao and other pynt contributers here. My own changes and new features will be implemented here and push as PR to original pynt repo.
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
- Async tasks
- Additional tasks timing reporting
You can install navio-builder from the Python Package Index (PyPI) or from source.
$ pip install navio-builder
$ 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.
#!/usr/bin/python import sys from navio.builder import task @task() def clean(): '''Clean build directory.''' print 'Cleaning build directory...' @task(clean) def html(target='.'): '''Generate HTML.''' print 'Generating HTML in directory "%s"' % target @task(clean, ignore=True) def images(): '''Prepare images.''' print 'Preparing images...' @task(html,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....' @task() def copy_file(src, dest): print 'Copying from %s to %s' % (src, dest) @task() 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 __DEFAULT__=start_server
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
- Raghunandan Rao - navio-builder is preceded by and forked from pynt, which was created by Raghunandan Rao.
- Calum J. Eadie - pynt is preceded by and forked from microbuild, which was created by Calum J. Eadie.
$ ./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