Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Create gh-pages branch via GitHub

  • Loading branch information...
commit 8fb750512cc40ab60347c736b070d4ed627547f1 1 parent 153b7ad
@rags authored
Showing with 14 additions and 5 deletions.
  1. +13 −4 index.html
  2. +1 −1  params.json
View
17 index.html
@@ -115,6 +115,12 @@
<span class="k">print</span> <span class="n">args</span>
<span class="k">print</span> <span class="n">kwargs</span>
+<span class="c"># Default task (if specified) is run when no task is specified in the command line</span>
+<span class="c"># make sure you define the variable __DEFAULT__ after the task is defined</span>
+<span class="c"># A good convention is to define it at the end of the module</span>
+<span class="c"># __DEFAULT__ is an optional member</span>
+
+<span class="n">__DEFAULT__</span><span class="o">=</span><span class="n">start_server</span>
</pre></div>
<h2>
@@ -124,8 +130,8 @@
<p>The command line interface and help is automatically generated. Task descriptions
are extracted from function docstrings.</p>
-<div class="highlight"><pre><span class="nv">$ </span>pynt
-usage: b <span class="o">[</span>-h<span class="o">]</span> <span class="o">[</span>-l<span class="o">]</span> <span class="o">[</span>-f file<span class="o">]</span> <span class="o">[</span>task <span class="o">[</span>task ...<span class="o">]]</span>
+<div class="highlight"><pre><span class="nv">$ </span>pynt -h
+usage: b <span class="o">[</span>-h<span class="o">]</span> <span class="o">[</span>-l<span class="o">]</span> <span class="o">[</span>-v<span class="o">]</span> <span class="o">[</span>-f file<span class="o">]</span> <span class="o">[</span>task <span class="o">[</span>task ...<span class="o">]]</span>
positional arguments:
task perform specified task and all its dependencies
@@ -133,16 +139,19 @@
optional arguments:
-h, --help show this <span class="nb">help </span>message and <span class="nb">exit</span>
-l, --list-tasks List the tasks
+ -v, --version Display the version information
-f file, --file file Build file to <span class="nb">read </span>the tasks from. Default is
<span class="s1">'build.py'</span>
+</pre></div>
+<div class="highlight"><pre><span class="nv">$ </span>pynt -l
Tasks in build file ./build.py:
clean Clean build directory.
copy_file
<span class="nb">echo </span>
<span class="nb"> </span>html Generate HTML.
images <span class="o">[</span>Ignored<span class="o">]</span> Prepare images.
- start_server Start the server
+ start_server <span class="o">[</span>Default<span class="o">]</span> Start the server
stop_server
Powered by pynt - A Lightweight Python Build Tool.
@@ -150,7 +159,7 @@
<p>pynt takes care of dependencies between tasks. In the following case start_server depends on clean, html and image generation (image task is ignored).</p>
-<div class="highlight"><pre><span class="nv">$ </span>pynt start_server
+<div class="highlight"><pre><span class="nv">$ </span>pynt <span class="c">#Runs the default task start_server. It does exactly what "pynt start_server" would do.</span>
<span class="o">[</span> example.py - Starting task <span class="s2">"clean"</span> <span class="o">]</span>
Cleaning build directory...
<span class="o">[</span> example.py - Completed task <span class="s2">"clean"</span> <span class="o">]</span>
View
2  params.json
@@ -1 +1 @@
-{"name":"Pynt","tagline":"A pynt of Python build.","body":"[![Build Status](https://travis-ci.org/rags/pynt.png?branch=master)](https://travis-ci.org/rags/pynt)\r\n\r\nA pynt of Python build. \r\n=============================\r\n\r\n[Raghunandan Rao](https://github.com/rags)\r\n\r\n## Features\r\n\r\n* Easy to learn.\r\n* Build tasks are just python funtions.\r\n* Manages dependencies between tasks.\r\n* Automatically generates a command line interface.\r\n* Rake style param passing to tasks\r\n* Supports python 2.7 and python 3.x\r\n\r\n## Installation\r\n\r\n\r\nYou can install pynt from the Python Package Index (PyPI) or from source.\r\n\r\nUsing pip\r\n\r\n```bash\r\n$ pip install pynt\r\n```\r\n\r\nUsing easy_install\r\n\r\n```bash\r\n$ easy_install pynt\r\n```\r\n\r\n## Example\r\n\r\n\r\nThe build script is written in pure Python and pynt takes care of managing\r\nany dependencies between tasks and generating a command line interface.\r\n\r\nWriting build tasks is really simple, all you need to know is the @task decorator. Tasks are just regular Python \r\nfunctions marked with the ``@task()`` decorator. Dependencies are specified with ``@task()`` too. Tasks can be \r\nignored with the ``@task(ignore=True)``. Disabling a task is an useful feature to have in situations where you have one\r\ntask that a lot of other tasks depend on and you want to quickly remove it from the dependency chains of all the \r\ndependent tasks. \r\n\r\n**build.py**\r\n------------\r\n\r\n```python\r\n\r\n#!/usr/bin/python\r\n\r\nimport sys\r\nfrom pynt import task\r\n\r\n@task()\r\ndef clean():\r\n '''Clean build directory.'''\r\n print 'Cleaning build directory...'\r\n\r\n@task(clean)\r\ndef html(target='.'):\r\n '''Generate HTML.'''\r\n print 'Generating HTML in directory \"%s\"' % target\r\n\r\n@task(clean, ignore=True)\r\ndef images():\r\n '''Prepare images.'''\r\n print 'Preparing images...'\r\n\r\n@task(html,images)\r\ndef start_server(server='localhost', port = '80'):\r\n '''Start the server'''\r\n print 'Starting server at %s:%s' % (server, port)\r\n\r\n@task(start_server) #Depends on task with all optional params\r\ndef stop_server():\r\n print 'Stopping server....'\r\n\r\n@task()\r\ndef copy_file(src, dest):\r\n print 'Copying from %s to %s' % (src, dest)\r\n\r\n@task()\r\ndef echo(*args,**kwargs):\r\n print args\r\n print kwargs\r\n\r\n```\r\n\r\n**Running pynt tasks**\r\n-----------------------\r\n\r\nThe command line interface and help is automatically generated. Task descriptions\r\nare extracted from function docstrings.\r\n\r\n```bash \r\n$ pynt\r\nusage: b [-h] [-l] [-f file] [task [task ...]]\r\n\r\npositional arguments:\r\n task perform specified task and all its dependencies\r\n\r\noptional arguments:\r\n -h, --help show this help message and exit\r\n -l, --list-tasks List the tasks\r\n -f file, --file file Build file to read the tasks from. Default is\r\n 'build.py'\r\n\r\nTasks in build file ./build.py:\r\n clean Clean build directory.\r\n copy_file \r\n echo \r\n html Generate HTML.\r\n images [Ignored] Prepare images.\r\n start_server Start the server\r\n stop_server \r\n\r\nPowered by pynt - A Lightweight Python Build Tool.\r\n```\r\n \r\npynt takes care of dependencies between tasks. In the following case start_server depends on clean, html and image generation (image task is ignored).\r\n\r\n```bash\r\n$ pynt start_server\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"html\" ]\r\nGenerating HTML in directory \".\"\r\n[ example.py - Completed task \"html\" ]\r\n[ example.py - Ignoring task \"images\" ]\r\n[ example.py - Starting task \"start_server\" ]\r\nStarting server at localhost:80\r\n[ example.py - Completed task \"start_server\" ]\r\n```\r\n\r\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.\r\n\r\n```bash\r\n$ pynt cle ht cl\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"html\" ]\r\nGenerating HTML in directory \".\"\r\n[ example.py - Completed task \"html\" ]\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n```\r\n\r\nThe 'html' task dependency 'clean' is run only once. But clean can be explicitly run again later.\r\n\r\npynt tasks can accept parameters from commandline.\r\n\r\n```bash\r\n$ pynt \"copy_file[/path/to/foo, path_to_bar]\"\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"copy_file\" ]\r\nCopying from /path/to/foo to path_to_bar\r\n[ example.py - Completed task \"copy_file\" ]\r\n```\r\n\r\npynt can also accept keyword arguments.\r\n\r\n```bash\r\n$ pynt start[port=8888]\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"html\" ]\r\nGenerating HTML in directory \".\"\r\n[ example.py - Completed task \"html\" ]\r\n[ example.py - Ignoring task \"images\" ]\r\n[ example.py - Starting task \"start_server\" ]\r\nStarting server at localhost:8888\r\n[ example.py - Completed task \"start_server\" ]\r\n \r\n$ pynt echo[hello,world,foo=bar,blah=123]\r\n[ example.py - Starting task \"echo\" ]\r\n('hello', 'world')\r\n{'blah': '123', 'foo': 'bar'}\r\n[ example.py - Completed task \"echo\" ]\r\n```\r\n\r\n**Organizing build scripts**\r\n-----------------------------\r\n\r\nYou can break up your build files into modules and simple import them into your main build file.\r\n\r\n```python\r\nfrom deploy_tasks import *\r\nfrom test_tasks import functional_tests, report_coverage\r\n```\r\n\r\n## Contributors/Contributing\r\n\r\n\r\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).\r\n\r\n\r\nIf you want to make changes the repo is at https://github.com/rags/pynt. You will need [pytest](http://www.pytest.org) to run the tests\r\n\r\n```bash\r\n$ ./b t\r\n```\r\n\r\nIt will be great if you can raise a [pull request](https://help.github.com/articles/using-pull-requests) once you are done.\r\n\r\n*If you find any bugs or need new features please raise a ticket in the [issues section](https://github.com/rags/pynt/issues) of the github repo.*\r\n \r\n## License\r\n\r\npynt is licensed under a [MIT license](http://opensource.org/licenses/MIT)\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
+{"name":"Pynt","tagline":"A pynt of Python build.","body":"[![Build Status](https://travis-ci.org/rags/pynt.png?branch=master)](https://travis-ci.org/rags/pynt)\r\n\r\nA pynt of Python build. \r\n=============================\r\n\r\n[Raghunandan Rao](https://github.com/rags)\r\n\r\n## Features\r\n\r\n* Easy to learn.\r\n* Build tasks are just python funtions.\r\n* Manages dependencies between tasks.\r\n* Automatically generates a command line interface.\r\n* Rake style param passing to tasks\r\n* Supports python 2.7 and python 3.x\r\n\r\n## Installation\r\n\r\n\r\nYou can install pynt from the Python Package Index (PyPI) or from source.\r\n\r\nUsing pip\r\n\r\n```bash\r\n$ pip install pynt\r\n```\r\n\r\nUsing easy_install\r\n\r\n```bash\r\n$ easy_install pynt\r\n```\r\n\r\n## Example\r\n\r\n\r\nThe build script is written in pure Python and pynt takes care of managing\r\nany dependencies between tasks and generating a command line interface.\r\n\r\nWriting build tasks is really simple, all you need to know is the @task decorator. Tasks are just regular Python \r\nfunctions marked with the ``@task()`` decorator. Dependencies are specified with ``@task()`` too. Tasks can be \r\nignored with the ``@task(ignore=True)``. Disabling a task is an useful feature to have in situations where you have one\r\ntask that a lot of other tasks depend on and you want to quickly remove it from the dependency chains of all the \r\ndependent tasks. \r\n\r\n**build.py**\r\n------------\r\n\r\n```python\r\n\r\n#!/usr/bin/python\r\n\r\nimport sys\r\nfrom pynt import task\r\n\r\n@task()\r\ndef clean():\r\n '''Clean build directory.'''\r\n print 'Cleaning build directory...'\r\n\r\n@task(clean)\r\ndef html(target='.'):\r\n '''Generate HTML.'''\r\n print 'Generating HTML in directory \"%s\"' % target\r\n\r\n@task(clean, ignore=True)\r\ndef images():\r\n '''Prepare images.'''\r\n print 'Preparing images...'\r\n\r\n@task(html,images)\r\ndef start_server(server='localhost', port = '80'):\r\n '''Start the server'''\r\n print 'Starting server at %s:%s' % (server, port)\r\n\r\n@task(start_server) #Depends on task with all optional params\r\ndef stop_server():\r\n print 'Stopping server....'\r\n\r\n@task()\r\ndef copy_file(src, dest):\r\n print 'Copying from %s to %s' % (src, dest)\r\n\r\n@task()\r\ndef echo(*args,**kwargs):\r\n print args\r\n print kwargs\r\n \r\n# Default task (if specified) is run when no task is specified in the command line\r\n# make sure you define the variable __DEFAULT__ after the task is defined\r\n# A good convention is to define it at the end of the module\r\n# __DEFAULT__ is an optional member\r\n\r\n__DEFAULT__=start_server\r\n```\r\n\r\n**Running pynt tasks**\r\n-----------------------\r\n\r\nThe command line interface and help is automatically generated. Task descriptions\r\nare extracted from function docstrings.\r\n\r\n```bash \r\n$ pynt -h\r\nusage: b [-h] [-l] [-v] [-f file] [task [task ...]]\r\n\r\npositional arguments:\r\n task perform specified task and all its dependencies\r\n\r\noptional arguments:\r\n -h, --help show this help message and exit\r\n -l, --list-tasks List the tasks\r\n -v, --version Display the version information\r\n -f file, --file file Build file to read the tasks from. Default is\r\n 'build.py'\r\n```\r\n\r\n```bash\r\n$ pynt -l\r\nTasks in build file ./build.py:\r\n clean Clean build directory.\r\n copy_file \r\n echo \r\n html Generate HTML.\r\n images [Ignored] Prepare images.\r\n start_server [Default] Start the server\r\n stop_server \r\n\r\nPowered by pynt - A Lightweight Python Build Tool.\r\n```\r\n \r\npynt takes care of dependencies between tasks. In the following case start_server depends on clean, html and image generation (image task is ignored).\r\n\r\n```bash\r\n$ pynt #Runs the default task start_server. It does exactly what \"pynt start_server\" would do.\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"html\" ]\r\nGenerating HTML in directory \".\"\r\n[ example.py - Completed task \"html\" ]\r\n[ example.py - Ignoring task \"images\" ]\r\n[ example.py - Starting task \"start_server\" ]\r\nStarting server at localhost:80\r\n[ example.py - Completed task \"start_server\" ]\r\n```\r\n\r\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.\r\n\r\n```bash\r\n$ pynt cle ht cl\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"html\" ]\r\nGenerating HTML in directory \".\"\r\n[ example.py - Completed task \"html\" ]\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n```\r\n\r\nThe 'html' task dependency 'clean' is run only once. But clean can be explicitly run again later.\r\n\r\npynt tasks can accept parameters from commandline.\r\n\r\n```bash\r\n$ pynt \"copy_file[/path/to/foo, path_to_bar]\"\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"copy_file\" ]\r\nCopying from /path/to/foo to path_to_bar\r\n[ example.py - Completed task \"copy_file\" ]\r\n```\r\n\r\npynt can also accept keyword arguments.\r\n\r\n```bash\r\n$ pynt start[port=8888]\r\n[ example.py - Starting task \"clean\" ]\r\nCleaning build directory...\r\n[ example.py - Completed task \"clean\" ]\r\n[ example.py - Starting task \"html\" ]\r\nGenerating HTML in directory \".\"\r\n[ example.py - Completed task \"html\" ]\r\n[ example.py - Ignoring task \"images\" ]\r\n[ example.py - Starting task \"start_server\" ]\r\nStarting server at localhost:8888\r\n[ example.py - Completed task \"start_server\" ]\r\n \r\n$ pynt echo[hello,world,foo=bar,blah=123]\r\n[ example.py - Starting task \"echo\" ]\r\n('hello', 'world')\r\n{'blah': '123', 'foo': 'bar'}\r\n[ example.py - Completed task \"echo\" ]\r\n```\r\n\r\n**Organizing build scripts**\r\n-----------------------------\r\n\r\nYou can break up your build files into modules and simple import them into your main build file.\r\n\r\n```python\r\nfrom deploy_tasks import *\r\nfrom test_tasks import functional_tests, report_coverage\r\n```\r\n\r\n## Contributors/Contributing\r\n\r\n\r\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).\r\n\r\n\r\nIf you want to make changes the repo is at https://github.com/rags/pynt. You will need [pytest](http://www.pytest.org) to run the tests\r\n\r\n```bash\r\n$ ./b t\r\n```\r\n\r\nIt will be great if you can raise a [pull request](https://help.github.com/articles/using-pull-requests) once you are done.\r\n\r\n*If you find any bugs or need new features please raise a ticket in the [issues section](https://github.com/rags/pynt/issues) of the github repo.*\r\n \r\n## License\r\n\r\npynt is licensed under a [MIT license](http://opensource.org/licenses/MIT)\r\n","google":"","note":"Don't delete this file! It's used internally to help with page regeneration."}
Please sign in to comment.
Something went wrong with that request. Please try again.