navio-builder


Namenavio-builder JSON
Version 0.3.3 PyPI version JSON
download
home_pagehttps://github.com/navio-online/navio-builder/
SummaryLightweight Python Build Tool
upload_time2023-03-28 17:54:16
maintainer
docs_urlNone
authorNavio Online OpenSource projects
requires_python
licenseMIT License
keywords devops build tool
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI
coveralls test coverage No coveralls.
            [![Tests](https://github.com/navio-online/navio-builder/actions/workflows/python-tests.yml/badge.svg)](https://github.com/navio-online/navio-builder/actions/workflows/python-tests.yml)

Why I did this fork and what will happen here?
==============================================

This project was forked from [Pynt](https://github.com/rags/pynt)
And Pynt itself was forked from [Microbuild](https://github.com/CalumJEadie/microbuild)

I appreciate work made by [Raghunandan Rao](https://github.com/rags) in [Pynt](https://github.com/rags/pynt) and work done by [Calum Eadie](https://github.com/CalumJEadie) in [Microbuild](https://github.com/CalumJEadie/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. 
=======================

## Features

* 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 

## Installation


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

Using pip

```bash
$ pip install navio-builder
```

Using easy_install

```bash
$ easy_install navio-builder
```

## Example


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. 

**build.py**
------------

```python

#!/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
```

**Running navio-builder tasks**
-----------------------

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

```bash
$ 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
                        'build.py'
```

```bash
$ nb -l
Tasks in build file ./build.py:
  clean                       Clean build directory.
  copy_file                   
  echo                        
  html                        Generate HTML.
  images           [Ignored]  Prepare images.
  start_server     [Default]  Start the server
  stop_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).

```bash
$ nb #Runs the default task start_server. It does exactly what "nb start_server" would do.
[ example.py - Starting task "clean" ]
Cleaning build directory...
[ example.py - Completed task "clean" ]
[ example.py - Starting task "html" ]
Generating HTML in directory "."
[ example.py - Completed task "html" ]
[ example.py - Ignoring task "images" ]
[ example.py - Starting task "start_server" ]
Starting server at localhost:80
[ example.py - 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.

```bash
$ nb cle ht cl
[ example.py - Starting task "clean" ]
Cleaning build directory...
[ example.py - Completed task "clean" ]
[ example.py - Starting task "html" ]
Generating HTML in directory "."
[ example.py - Completed task "html" ]
[ example.py - Starting task "clean" ]
Cleaning build directory...
[ example.py - 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.

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

nb can also accept keyword arguments.

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

**Organizing build scripts**
-----------------------------

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

```python
from deploy_tasks import *
from test_tasks import functional_tests, report_coverage
```

## Contributors/Contributing


* Raghunandan Rao - navio-builder is preceded by and forked from [pynt](https://github.com/rags/pynt), which was created by [Raghunandan Rao](https://github.com/rags/pynt).
* Calum J. Eadie - pynt is preceded by and forked from [microbuild](https://github.com/CalumJEadie/microbuild), which was created by [Calum J. Eadie](https://github.com/CalumJEadie).


If you want to make changes the repo is at https://github.com/naviotech/navio-builder. You will need [pytest](http://www.pytest.org) to run the tests

```bash
$ ./b t
```

It will be great if you can raise a [pull request](https://help.github.com/articles/using-pull-requests) once you are done.

If you find any bugs or need new features please raise a ticket in the [issues section](https://github.com/naviotech/navio-builder/issues) of the github repo.
    
## License

navio-builder is licensed under a [MIT license](http://opensource.org/licenses/MIT)

Changes 
=======
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

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/navio-online/navio-builder/",
    "name": "navio-builder",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "devops,build tool",
    "author": "Navio Online OpenSource projects",
    "author_email": "oss@navio.online",
    "download_url": "https://files.pythonhosted.org/packages/b3/75/28cde279a3e871cf46e9f7559d6bebc58b1ebc7c321431e5397b6af3dd25/navio-builder-0.3.3.tar.gz",
    "platform": null,
    "description": "[![Tests](https://github.com/navio-online/navio-builder/actions/workflows/python-tests.yml/badge.svg)](https://github.com/navio-online/navio-builder/actions/workflows/python-tests.yml)\n\nWhy I did this fork and what will happen here?\n==============================================\n\nThis project was forked from [Pynt](https://github.com/rags/pynt)\nAnd Pynt itself was forked from [Microbuild](https://github.com/CalumJEadie/microbuild)\n\nI appreciate work made by [Raghunandan Rao](https://github.com/rags) in [Pynt](https://github.com/rags/pynt) and work done by [Calum Eadie](https://github.com/CalumJEadie) in [Microbuild](https://github.com/CalumJEadie/microbuild). \nBoth Pynt and Microbuild are not under development for a long time, so changes made here will not be pushed to those repos.\n\nAim of this navio-builder project is to provide community and my clients with lightweight and easy to use python devops tool.\n\nA pynt of Python build. \n=======================\n\n## Features\n\n* Easy to learn.\n* Build tasks are just python funtions.\n* Manages dependencies between tasks.\n* Automatically generates a command line interface.\n* Rake style param passing to tasks\n* Supports python 2.7 and python 3.x\n\n## Todo Features\n\n* Async tasks\n* Additional tasks timing reporting \n\n## Installation\n\n\nYou can install navio-builder from the Python Package Index (PyPI) or from source.\n\nUsing pip\n\n```bash\n$ pip install navio-builder\n```\n\nUsing easy_install\n\n```bash\n$ easy_install navio-builder\n```\n\n## Example\n\n\nThe build script is written in pure Python and navio-builder takes care of managing\nany dependencies between tasks and generating a command line interface.\n\nWriting build tasks is really simple, all you need to know is the @task decorator. Tasks are just regular Python \nfunctions marked with the ``@task()`` decorator. Dependencies are specified with ``@task()`` too. Tasks can be \nignored with the ``@task(ignore=True)``. Disabling a task is an useful feature to have in situations where you have one\ntask that a lot of other tasks depend on and you want to quickly remove it from the dependency chains of all the \ndependent tasks. \n\n**build.py**\n------------\n\n```python\n\n#!/usr/bin/python\n\nimport sys\nfrom navio.builder import task\n\n@task()\ndef clean():\n    '''Clean build directory.'''\n    print 'Cleaning build directory...'\n\n@task(clean)\ndef html(target='.'):\n    '''Generate HTML.'''\n    print 'Generating HTML in directory \"%s\"' %  target\n\n@task(clean, ignore=True)\ndef images():\n    '''Prepare images.'''\n    print 'Preparing images...'\n\n@task(html,images)\ndef start_server(server='localhost', port = '80'):\n    '''Start the server'''\n    print 'Starting server at %s:%s' % (server, port)\n\n@task(start_server) #Depends on task with all optional params\ndef stop_server():\n    print 'Stopping server....'\n\n@task()\ndef copy_file(src, dest):\n    print 'Copying from %s to %s' % (src, dest)\n\n@task()\ndef echo(*args,**kwargs):\n    print args\n    print kwargs\n    \n# Default task (if specified) is run when no task is specified in the command line\n# make sure you define the variable __DEFAULT__ after the task is defined\n# A good convention is to define it at the end of the module\n# __DEFAULT__ is an optional member\n\n__DEFAULT__=start_server\n```\n\n**Running navio-builder tasks**\n-----------------------\n\nThe command line interface and help is automatically generated. Task descriptions\nare extracted from function docstrings.\n\n```bash\n$ nb -h\nusage: nb [-h] [-l] [-v] [-f file] [task [task ...]]\n\npositional arguments:\n  task                  perform specified task and all its dependencies\n\noptional arguments:\n  -h, --help            show this help message and exit\n  -l, --list-tasks      List the tasks\n  -v, --version         Display the version information\n  -f file, --file file  Build file to read the tasks from. Default is\n                        'build.py'\n```\n\n```bash\n$ nb -l\nTasks in build file ./build.py:\n  clean                       Clean build directory.\n  copy_file                   \n  echo                        \n  html                        Generate HTML.\n  images           [Ignored]  Prepare images.\n  start_server     [Default]  Start the server\n  stop_server                 \n\nPowered by navio-builder - A Lightweight Python Build Tool.\n```\n          \nnavio-builder takes care of dependencies between tasks. In the following case start_server depends on clean, html and image generation (image task is ignored).\n\n```bash\n$ nb #Runs the default task start_server. It does exactly what \"nb start_server\" would do.\n[ example.py - Starting task \"clean\" ]\nCleaning build directory...\n[ example.py - Completed task \"clean\" ]\n[ example.py - Starting task \"html\" ]\nGenerating HTML in directory \".\"\n[ example.py - Completed task \"html\" ]\n[ example.py - Ignoring task \"images\" ]\n[ example.py - Starting task \"start_server\" ]\nStarting server at localhost:80\n[ example.py - Completed task \"start_server\" ]\n```\n\nThe 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.\n\n```bash\n$ nb cle ht cl\n[ example.py - Starting task \"clean\" ]\nCleaning build directory...\n[ example.py - Completed task \"clean\" ]\n[ example.py - Starting task \"html\" ]\nGenerating HTML in directory \".\"\n[ example.py - Completed task \"html\" ]\n[ example.py - Starting task \"clean\" ]\nCleaning build directory...\n[ example.py - Completed task \"clean\" ]\n```\n\nThe 'html' task dependency 'clean' is run only once. But clean can be explicitly run again later.\n\nnb tasks can accept parameters from commandline.\n\n```bash\n$ nb \"copy_file[/path/to/foo, path_to_bar]\"\n[ example.py - Starting task \"clean\" ]\nCleaning build directory...\n[ example.py - Completed task \"clean\" ]\n[ example.py - Starting task \"copy_file\" ]\nCopying from /path/to/foo to path_to_bar\n[ example.py - Completed task \"copy_file\" ]\n```\n\nnb can also accept keyword arguments.\n\n```bash\n$ nb start[port=8888]\n[ example.py - Starting task \"clean\" ]\nCleaning build directory...\n[ example.py - Completed task \"clean\" ]\n[ example.py - Starting task \"html\" ]\nGenerating HTML in directory \".\"\n[ example.py - Completed task \"html\" ]\n[ example.py - Ignoring task \"images\" ]\n[ example.py - Starting task \"start_server\" ]\nStarting server at localhost:8888\n[ example.py - Completed task \"start_server\" ]\n    \n$ nb echo[hello,world,foo=bar,blah=123]\n[ example.py - Starting task \"echo\" ]\n('hello', 'world')\n{'blah': '123', 'foo': 'bar'}\n[ example.py - Completed task \"echo\" ]\n```\n\n**Organizing build scripts**\n-----------------------------\n\nYou can break up your build files into modules and simple import them into your main build file.\n\n```python\nfrom deploy_tasks import *\nfrom test_tasks import functional_tests, report_coverage\n```\n\n## Contributors/Contributing\n\n\n* Raghunandan Rao - navio-builder is preceded by and forked from [pynt](https://github.com/rags/pynt), which was created by [Raghunandan Rao](https://github.com/rags/pynt).\n* Calum J. Eadie - pynt is preceded by and forked from [microbuild](https://github.com/CalumJEadie/microbuild), which was created by [Calum J. Eadie](https://github.com/CalumJEadie).\n\n\nIf you want to make changes the repo is at https://github.com/naviotech/navio-builder. You will need [pytest](http://www.pytest.org) to run the tests\n\n```bash\n$ ./b t\n```\n\nIt will be great if you can raise a [pull request](https://help.github.com/articles/using-pull-requests) once you are done.\n\nIf you find any bugs or need new features please raise a ticket in the [issues section](https://github.com/naviotech/navio-builder/issues) of the github repo.\n    \n## License\n\nnavio-builder is licensed under a [MIT license](http://opensource.org/licenses/MIT)\n\nChanges \n=======\n0.1.16 - 14/12/2017\n------------------\n\n* Add task running time to output\n\n0.1.0 - 11/12/2017\n------------------\n\n* Initial release. Fork from pynt.\n* Rename done to modules\n",
    "bugtrack_url": null,
    "license": "MIT License",
    "summary": "Lightweight Python Build Tool",
    "version": "0.3.3",
    "split_keywords": [
        "devops",
        "build tool"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "cb5100ef20eb9fd99feb070a38b3e7ec95a21b0805f25d107b472f25594902b2",
                "md5": "6b2f96f0b60cd3ecf6b4790651101b41",
                "sha256": "11c4c31de84b05ac545c53916a7b6779f1bf560ae081a603e33069857d06e990"
            },
            "downloads": -1,
            "filename": "navio_builder-0.3.3-py2.py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "6b2f96f0b60cd3ecf6b4790651101b41",
            "packagetype": "bdist_wheel",
            "python_version": "py2.py3",
            "requires_python": null,
            "size": 10210,
            "upload_time": "2023-03-28T17:54:15",
            "upload_time_iso_8601": "2023-03-28T17:54:15.149144Z",
            "url": "https://files.pythonhosted.org/packages/cb/51/00ef20eb9fd99feb070a38b3e7ec95a21b0805f25d107b472f25594902b2/navio_builder-0.3.3-py2.py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b37528cde279a3e871cf46e9f7559d6bebc58b1ebc7c321431e5397b6af3dd25",
                "md5": "9908920fa85fd421d53740ba43689ed0",
                "sha256": "6e87a42e7b7c8d248ee73aa4d86037b36a6af3778f97214c22e940469039485c"
            },
            "downloads": -1,
            "filename": "navio-builder-0.3.3.tar.gz",
            "has_sig": false,
            "md5_digest": "9908920fa85fd421d53740ba43689ed0",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 11988,
            "upload_time": "2023-03-28T17:54:16",
            "upload_time_iso_8601": "2023-03-28T17:54:16.279001Z",
            "url": "https://files.pythonhosted.org/packages/b3/75/28cde279a3e871cf46e9f7559d6bebc58b1ebc7c321431e5397b6af3dd25/navio-builder-0.3.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-03-28 17:54:16",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "navio-online",
    "github_project": "navio-builder",
    "travis_ci": true,
    "coveralls": false,
    "github_actions": true,
    "lcname": "navio-builder"
}
        
Elapsed time: 0.08627s