Craft 0.2.3

Like Makefile, but in Python
Craft is a tool like Makefile, except everything is in native Python.

Install

pip install craft

Craft works on Python 2.7+ and Python 3.2+.

Crafty files

Craft will read attempt to read crafty.py in the current directory or the environment variable $CRAFTFILE.

An example crafty.py:

from craft import task, depends

@task
@depends('bar', 'foo')
def cake():
 """
 Prints cake, and depends on foo & bar
 to run first
 """
 print('Time for cake')


@task
def bar():
 """ Prints bar """
 print('bar')

@task
def foo():
 print("Hi,I'm foo")

@task
def auto():
 """
 I will run when you supply no arguments to "craft".
 """
 print("Auto - Doing my own thing. Which is 'foo' today.")
 foo()

@task
def setup():
 """
 I will run once on any call to "craft"
 """
 print("Hello good sir, I'm the setup routine.")


Usage

Running craft -h in the directory containing crafty.py will show the list of available tasks. Example:

usage: craft [-h] [task [task ...]]

positional arguments:
 task

optional arguments:
 -h, --help show this help message and exit

Available tasks:

- cake: Prints cake, and depends on foo & bar to run first
- auto: I will run when you supply no arguments to "craft".
- setup: I will run once on any call to "craft"
- foo:
- bar: Prints bar


As you can see, the docstring for each @task function will then be represented in the help output, and docstrings can be omitted.

You can call individual tasks like:

craft foo

and run multiple tasks with one call like:

craft foo bar

last updated on:
August 31st, 2012, 5:14 GMT
price:
FREE!
developed by:
Jamie Paton
homepage:
github.com
license type:
MIT/X Consortium License 
category:
ROOT \ Programming \ Compilers

FREE!

In a hurry? Add it to your Download Basket!

user rating

UNRATED
0.0/5
 

0/5

Rate it!
What's New in This Release:
  • Fix error catching isolation from craft and the actual task
read full changelog

Add your review!

SUBMIT