Package: exr-builder
Why I did this fork and what will happen here?This project was forked from Pynt.Raghunandan
RaoWe appreciate work made byRaghunandan Raoand will push any good parts of out changes to initialrags/pyntrepo.Aim of this exr-builder project is to support exrny.com applications
with lightweight and easy to use python devops tool. We are going to
accumulate work done byRaghunandan Raoand other pynt contributers here. Our own changes and new features will
be implemented here and pushed as PR to original pynt repo.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 exr-builder from the Python Package Index (PyPI) or from
source.Using pip$pipinstallexr-builderUsing easy_install$easy_installexr-builderExampleThe build script is written in pure Python and exr-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/pythonimportsysfromexr.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 exr-builder tasksThe command line interface and help is automatically generated. Task
descriptions are extracted from function docstrings.$exrb-husage:exrb[-h][-l][-v][-ffile][task[task...]]positionalarguments:taskperformspecifiedtaskandallitsdependenciesoptionalarguments:-h,--helpshowthishelpmessageandexit-l,--list-tasksListthetasks-v,--versionDisplaytheversioninformation-ffile,--filefileBuildfiletoreadthetasksfrom.Defaultis'build.py'$exrb-lTasksinbuildfile./build.py:cleanCleanbuilddirectory.copy_fileechohtmlGenerateHTML.images[Ignored]Prepareimages.start_server[Default]Starttheserverstop_serverPoweredbyexr-builder-ALightweightPythonBuildTool.exr-builder takes care of dependencies between tasks. In the following
case start_server depends on clean, html and image generation (image
task is ignored).$exrb#Runs the default task start_server. It does exactly what "exrb 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.$exrbclehtcl[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.exrb tasks can accept parameters from commandline.$exrb"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"]exrb can also accept keyword arguments.$exrbstart[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"]$exrbecho[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 - exr-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/exrny/exr-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.Licenseexr-builder is licensed under aMIT
licenseChanges0.1.0 - 04/02/2018Initial commit