python taskwarrior api
Python Shell
Latest commit 0b2f2ff Apr 20, 2016 @ralphbean Merge pull request #104 from ryansb/use-errno
Use the `errno` library instead of string matching error text
Failed to load latest commit information.
taskw Merge pull request #104 from ryansb/use-errno Apr 20, 2016
.gitignore
.tox_build_taskwarrior.sh Use the 'release build' just to make things faster Feb 17, 2015
.travis.yml Drop py3.2 and test against tw 2.4.4 dev branch. Apr 21, 2015
CHANGELOG.rst 1.1.0 Sep 10, 2015
LICENSE.txt License and trove classifiers. Dec 15, 2011
MANIFEST.in Issue 83: Adding basic tox testing framework for local testing in mul… Jan 17, 2015
README.rst
requirements.txt Use kitchen in the most dire of circumstances. Feb 1, 2016
setup.cfg Issue 83: Adding basic tox testing framework for local testing in mul… Jan 17, 2015
setup.py 1.1.0 Sep 10, 2015
test_requirements.txt Issue 83: Adding basic tox testing framework for local testing in mul… Jan 17, 2015
tox.ini All hail 2.5.1. Feb 17, 2016

README.rst

taskw - Python API for the taskwarrior DB

This is a python API for the taskwarrior command line tool.

It contains two implementations: taskw.TaskWarriorShellout and taskw.TaskWarriorDirect. The first implementation is the supported one recommended by the upstream taskwarrior core project. It uses the task export and task import commands to manipulate the task database. The second implementation opens the task db file itself and directly manipulates it. It exists for backwards compatibility, but should only be used when necessary.

Build Status

Branch Status
master Build Status - master branch
develop Build Status - develop branch

Getting taskw

Installing

Using taskw requires that you first install taskwarrior.

Installing it from http://pypi.python.org/pypi/taskw is easy with pip:

$ pip install taskw

The Source

You can find the source on github at http://github.com/ralphbean/taskw

Examples

Looking at tasks

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> tasks = w.load_tasks()
>>> tasks.keys()
['completed', 'pending']
>>> type(tasks['pending'])
<type 'list'>
>>> type(tasks['pending'][0])
<type 'dict'>

Adding tasks

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> w.task_add("Eat food")
>>> w.task_add("Take a nap", priority="H", project="life", due="1359090000")

Retrieving tasks

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> w.get_task(id=5)

Updating tasks

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> id, task = w.get_task(id=14)
>>> task['project'] = 'Updated project name'
>>> w.task_update(task)

Deleting tasks

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> w.task_delete(id=3)

Completing tasks

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> w.task_done(id=46)

Being Flexible

You can point taskw at different taskwarrior databases.

>>> from taskw import TaskWarrior
>>> w = TaskWarrior(config_filename="~/some_project/.taskrc")
>>> w.task_add("Use 'taskw'.")

Looking at the config

>>> from taskw import TaskWarrior
>>> w = TaskWarrior()
>>> config = w.load_config()
>>> config['data']['location']
'/home/threebean/.task'
>>> config['_forcecolor']
'yes'

Using Python-appropriate Types (Dates, UUIDs, etc)

>>> from taskw import TaskWarrior
>>> w = TaskWarrior(marshal=True)
>>> w.get_task(id=10)
(10,
 {
  'description': 'Hello there!',
  'entry': datetime.datetime(2014, 3, 14, 14, 18, 40, tzinfo=tzutc())
  'id': 10,
  'project': 'Saying Hello',
  'status': 'pending',
  'uuid': UUID('4882751a-3966-4439-9675-948b1152895c')
 }
)