Skip to main content

Python bindings for your taskwarrior database

Project description

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')
 }
)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

taskw-2.0.0.tar.gz (42.6 kB view details)

Uploaded Source

Built Distribution

taskw-2.0.0-py3-none-any.whl (47.8 kB view details)

Uploaded Python 3

File details

Details for the file taskw-2.0.0.tar.gz.

File metadata

  • Download URL: taskw-2.0.0.tar.gz
  • Upload date:
  • Size: 42.6 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for taskw-2.0.0.tar.gz
Algorithm Hash digest
SHA256 1109bdf9bde7a9b32a5007a302c878303ff65188b64225ac74a3289a4c548bdd
MD5 df868fa392fa3b55f738951d0634feb9
BLAKE2b-256 33d76fcc7ed138a3eff9e98d77aa70cf5328f85397b48ebcf57726a0748f4fb4

See more details on using hashes here.

File details

Details for the file taskw-2.0.0-py3-none-any.whl.

File metadata

  • Download URL: taskw-2.0.0-py3-none-any.whl
  • Upload date:
  • Size: 47.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for taskw-2.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8652ab80c212ee75232b1229534af83845c291de75889e5ddb8e63c68dd35cbd
MD5 1e175b7c7580956fd40ea456aad8f297
BLAKE2b-256 2253b024b9138bdd5ecc06f077272c983998bf6804e14a315e0ae1e29f36f2fc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page