File: README.rst

package info (click to toggle)
taskw 1.3.0-1
  • links: PTS, VCS
  • area: main
  • in suites: bullseye, sid
  • size: 436 kB
  • sloc: python: 2,742; makefile: 6
file content (146 lines) | stat: -rw-r--r-- 3,589 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
taskw - Python API for the taskwarrior DB
=========================================

.. split here

This is a python API for the `taskwarrior <http://taskwarrior.org>`_ 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
------------

.. |master| image:: https://secure.travis-ci.org/ralphbean/taskw.png?branch=master
   :alt: Build Status - master branch
   :target: http://travis-ci.org/#!/ralphbean/taskw

.. |develop| image:: https://secure.travis-ci.org/ralphbean/taskw.png?branch=develop
   :alt: Build Status - develop branch
   :target: http://travis-ci.org/#!/ralphbean/taskw

+----------+-----------+
| Branch   | Status    |
+==========+===========+
| master   | |master|  |
+----------+-----------+
| develop  | |develop| |
+----------+-----------+

Getting taskw
-------------

Installing
++++++++++

Using ``taskw`` requires that you first install `taskwarrior
<http://taskwarrior.org>`_.

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