This is a pre-production deployment of Warehouse, however changes made here WILL affect the production instance of PyPI.
Latest Version Dependencies status unknown Test status unknown Test coverage unknown
Project Description

Fabric has class-based tasks but they are limited: Task class represents a single task.

This module make it possible to have class-based Fabric task sets.

Installation

pip install fabric-taskset

Usage

TaskSet is a class that can expose its methods as Fabric tasks.

Example:

# fabfile.py
from fabric.api import local
from taskset import TaskSet, task_method

class SayBase(TaskSet):
    def say(self, what):
        raise NotImplementedError()

    @task_method(default=True, alias='hi')
    def hello(self):
        self.say('hello')

    @task_method
    def bye(self):
        self.say('goodbye')

class EchoSay(SayBase):
    def say(self, what):
        local('echo ' + what)

say = EchoSay().expose_as_module('say')

and then:

$ fab -l
Available commands:

    say
    say.bye
    say.hello
    say.hi

$ fab say.hi
hello

taskset.task_method is a decorator declaring the wrapped method to be task. It acceps the same arguments as fabric.decorators.task so use it on methods just like fabric’s decorator is used on functions.

You can also create an “on-disk” Python module and populate it with tasks:

# my_lib/say.py
from taskset import TaskSet, task_method

class SayBase(TaskSet):
    def say(self, what):
        raise NotImplementedError()

    @task_method(default=True, alias='hi')
    def hello(self):
        self.say('hello')

class EchoSay(SayBase):
    def say(self, what):
        local('echo ' + what)

instance = EchoSay()
instance.expose_to_current_module()

# fabfile.py
from mylib import say

Acknowledgements

https://github.com/ramusus/fabriclassed is a very similar app. At the time of writing it is focused on old-style Fabric tasks and has a small deployment framework included.

In order to feed my NIH syndrome I create Fabric-taskset which exposes new-style Fabric tasks, provides slightly different API and doesn’t have extra goodies.

This library then evolved to support exposing tasks without creating dummy on-disk modules (thanks to Denis Untevskiy).

Changes

0.2.1 (2012-09-21)

  • private _expose_to method now returns list, not generator.

0.2 (2012-08-28)

  • @task decorator is deprecated and replaced with @task_method. This was a bad name because of @fabric.task decorator (thanks Denis Untevskiy);
  • Taskset.expose_as_module method that allows to use TaskSet instances from command line without creating dummy modules on disk (thanks Denis Untevskiy).

0.1 (2012-03-03)

Initial release.

Release History

Release History

0.2.1

This version

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.2

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

0.1

History Node

TODO: Figure out how to actually get changelog content.

Changelog content for this version goes here.

Donec et mollis dolor. Praesent et diam eget libero egestas mattis sit amet vitae augue. Nam tincidunt congue enim, ut porta lorem lacinia consectetur. Donec ut libero sed arcu vehicula ultricies a non tortor. Lorem ipsum dolor sit amet, consectetur adipiscing elit.

Show More

Download Files

Download Files

TODO: Brief introduction on what you do with files - including link to relevant help section.

File Name & Checksum SHA256 Checksum Help Version File Type Upload Date
fabric-taskset-0.2.1.tar.gz (4.2 kB) Copy SHA256 Checksum SHA256 Source Sep 21, 2012

Supported By

WebFaction WebFaction Technical Writing Elastic Elastic Search Pingdom Pingdom Monitoring Dyn Dyn DNS HPE HPE Development Sentry Sentry Error Logging CloudAMQP CloudAMQP RabbitMQ Heroku Heroku PaaS Kabu Creative Kabu Creative UX & Design Fastly Fastly CDN DigiCert DigiCert EV Certificate Rackspace Rackspace Cloud Servers DreamHost DreamHost Log Hosting