Skip to main content

Craft - idiomatic build tool for Python

Craft is 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

History

v0.2.6 - 10 Nov 2012

  • Fix an issue with setup.py linking to the README

v0.2.3 - 14 Oct 2012

  • Fix error catching isolation from craft and the actual task

v0.2.0 - 27 Aug 2012

  • Added setup() and auto() tasks

  • Added support for task dependencies via @depends

v0.1.0 - 26 Aug 2012

Source is available at: https://github.com/jdpaton/craft

Metadata

Release files for craft 0.2.6

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for craft 0.2.6
File Size Uploaded
craft-0.2.6.tar.gz 3.0 kB Details

Release files / craft-0.2.6.tar.gz

Download URL craft-0.2.6.tar.gz
Size 3.0 kB
Tags Source
SHA-256 checksum
How to use checksums
95db9547dd3ab28156ad40ed19231ba6bc688cbb07ff16bcfb657ac3b3e268f4
BLAKE2b-256 checksum
How to use checksums
618b1b56f8066ee76741b7b14ed0ea7bc9614e221c2321c9de98379121a81db4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.2.6 This release

1 release file

0.2.5

1 release file

0.2.4

1 release file

0.2.3

1 release file

0.2.2

1 release file

0.2.1

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page