Package: navio-builder
Why I did this fork and what will happen here?This project was forked fromPyntAnd Pynt itself was forked fromMicrobuildI appreciate work made byRaghunandan RaoinPyntand work done byCalum EadieinMicrobuild.
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.FeaturesEasy to learn.Build tasks are just python funtions.Manages dependencies between tasks.Automatically generates a command line interface.Rake style param passing to tasksSupports python 2.7 and python 3.xTodo FeaturesAsync tasksAdditional tasks timing reportingInstallationYou can install navio-builder from the Python Package Index (PyPI) or from source.Using pip$pipinstallnavio-builderUsing easy_install$easy_installnavio-builderExampleThe 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.build.py#!/usr/bin/pythonimportsysfromnavio.builderimporttask@task()defclean():'''Clean build directory.'''print'Cleaning build directory...'@task(clean)defhtml(target='.'):'''Generate HTML.'''print'Generating HTML in directory "%s"'%target@task(clean,ignore=True)defimages():'''Prepare images.'''print'Preparing images...'@task(html,images)defstart_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 paramsdefstop_server():print'Stopping server....'@task()defcopy_file(src,dest):print'Copying from%sto%s'%(src,dest)@task()defecho(*args,**kwargs):printargsprintkwargs# 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_serverRunning navio-builder tasksThe command line interface and help is automatically generated. Task descriptions
are extracted from function docstrings.$nb-h
usage:nb[-h][-l][-v][-ffile][task[task...]]positionalarguments:taskperformspecifiedtaskandallitsdependencies

optionalarguments:-h,--helpshowthishelpmessageandexit-l,--list-tasksListthetasks-v,--versionDisplaytheversioninformation-ffile,--filefileBuildfiletoreadthetasksfrom.Defaultis'build.py'$nb-l
Tasksinbuildfile./build.py:cleanCleanbuilddirectory.copy_fileechohtmlGenerateHTML.images[Ignored]Prepareimages.start_server[Default]Starttheserverstop_serverPoweredbynavio-builder-ALightweightPythonBuildTool.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.[example.py-Startingtask"clean"]Cleaningbuilddirectory...[example.py-Completedtask"clean"][example.py-Startingtask"html"]GeneratingHTMLindirectory"."[example.py-Completedtask"html"][example.py-Ignoringtask"images"][example.py-Startingtask"start_server"]Startingserveratlocalhost:80[example.py-Completedtask"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.$nbclehtcl[example.py-Startingtask"clean"]Cleaningbuilddirectory...[example.py-Completedtask"clean"][example.py-Startingtask"html"]GeneratingHTMLindirectory"."[example.py-Completedtask"html"][example.py-Startingtask"clean"]Cleaningbuilddirectory...[example.py-Completedtask"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]"[example.py-Startingtask"clean"]Cleaningbuilddirectory...[example.py-Completedtask"clean"][example.py-Startingtask"copy_file"]Copyingfrom/path/to/footopath_to_bar[example.py-Completedtask"copy_file"]nb can also accept keyword arguments.$nbstart[port=8888][example.py-Startingtask"clean"]Cleaningbuilddirectory...[example.py-Completedtask"clean"][example.py-Startingtask"html"]GeneratingHTMLindirectory"."[example.py-Completedtask"html"][example.py-Ignoringtask"images"][example.py-Startingtask"start_server"]Startingserveratlocalhost:8888[example.py-Completedtask"start_server"]$nbecho[hello,world,foo=bar,blah=123][example.py-Startingtask"echo"]('hello','world'){'blah':'123','foo':'bar'}[example.py-Completedtask"echo"]Organizing build scriptsYou can break up your build files into modules and simple import them into your main build file.fromdeploy_tasksimport*fromtest_tasksimportfunctional_tests,report_coverageContributors/ContributingRaghunandan Rao - navio-builder is preceded by and forked frompynt, which was created byRaghunandan Rao.Calum J. Eadie - pynt is preceded by and forked frommicrobuild, which was created byCalum J. Eadie.If you want to make changes the repo is athttps://github.com/naviotech/navio-builder. You will needpytestto run the tests$./btIt will be great if you can raise apull requestonce you are done.If you find any bugs or need new features please raise a ticket in theissues sectionof the github repo.Licensenavio-builder is licensed under aMIT licenseChanges0.1.16 - 14/12/2017Add task running time to output0.1.0 - 11/12/2017Initial release. Fork from pynt.Rename done to modules