├── taskw ├── test │ ├── __init__.py │ ├── data │ │ ├── empty.taskrc │ │ ├── default.taskrc │ │ └── included.taskrc │ ├── test_warrior.py │ ├── test_recursive.py │ ├── test_taskrc.py │ ├── test_utils.py │ ├── test_task.py │ ├── test_fields.py │ └── test_datas.py ├── fields │ ├── duration.py │ ├── __init__.py │ ├── array.py │ ├── uuid.py │ ├── date.py │ ├── string.py │ ├── numeric.py │ ├── choice.py │ ├── commaseparateduuid.py │ ├── base.py │ └── annotationarray.py ├── __init__.py ├── exceptions.py ├── taskrc.py ├── utils.py ├── task.py └── warrior.py ├── test_requirements.txt ├── requirements.txt ├── setup.cfg ├── .gitignore ├── MANIFEST.in ├── tox.ini ├── .tox_build_taskwarrior.sh ├── .github └── workflows │ └── test.yml ├── setup.py ├── README.rst ├── LICENSE.txt └── CHANGELOG.rst /taskw/test/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /taskw/test/data/empty.taskrc: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /test_requirements.txt: -------------------------------------------------------------------------------- 1 | pytest 2 | tox<3 3 | -------------------------------------------------------------------------------- /requirements.txt: -------------------------------------------------------------------------------- 1 | python-dateutil 2 | pytz 3 | kitchen 4 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [tool:pytest] 2 | norecursedirs=lib 3 | addopts = -p no:warnings 4 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.pyc 2 | *.swp 3 | *.pyo 4 | .build 5 | build 6 | *.egg-info 7 | dist 8 | test.html 9 | *.egg* 10 | *.pdf 11 | .tox/* 12 | .vscode/* 13 | env/* 14 | -------------------------------------------------------------------------------- /taskw/test/data/default.taskrc: -------------------------------------------------------------------------------- 1 | data.location = ~/.task 2 | 3 | 4 | alpha.one = yes 5 | alpha.two = 2 6 | beta.one = TRUE 7 | 8 | include taskw/test/data/included.taskrc 9 | 10 | gamma.one = TRUE 11 | 12 | -------------------------------------------------------------------------------- /taskw/test/data/included.taskrc: -------------------------------------------------------------------------------- 1 | beta.one = FALSE 2 | gamma.one = FALSE 3 | 4 | uda.a.type = numeric 5 | uda.a.label = Alpha 6 | uda.b.type = string 7 | uda.b.label = Beta 8 | uda.b.values = Strontium-90,Hydrogen-3 9 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include README.rst 2 | include LICENSE.txt 3 | include requirements.txt 4 | include test_requirements.txt 5 | include .tox_tests.sh 6 | include tox.ini 7 | include setup.cfg 8 | recursive-include taskw/test/data * 9 | -------------------------------------------------------------------------------- /taskw/fields/duration.py: -------------------------------------------------------------------------------- 1 | from .string import StringField 2 | 3 | 4 | class DurationField(StringField): 5 | """ In the future this will handle transforming recurrence patterns. 6 | 7 | See https://github.com/taskwarrior/task/blob/2.3.0/src/Duration.cpp#L41 8 | 9 | """ 10 | pass 11 | -------------------------------------------------------------------------------- /taskw/fields/__init__.py: -------------------------------------------------------------------------------- 1 | from .base import Field 2 | from .annotationarray import AnnotationArrayField 3 | from .array import ArrayField 4 | from .commaseparateduuid import CommaSeparatedUUIDField 5 | from .choice import ChoiceField 6 | from .date import DateField 7 | from .duration import DurationField 8 | from .numeric import NumericField 9 | from .string import StringField 10 | from .uuid import UUIDField 11 | -------------------------------------------------------------------------------- /taskw/fields/array.py: -------------------------------------------------------------------------------- 1 | from .base import DirtyableList, Field 2 | 3 | 4 | class ArrayField(Field): 5 | def deserialize(self, value): 6 | if not value: 7 | value = DirtyableList([]) 8 | return DirtyableList(value) 9 | 10 | def serialize(self, value): 11 | if not value: 12 | value = [] 13 | if not hasattr(value, '__iter__'): 14 | raise ValueError("Value must be list or tuple.") 15 | return value 16 | -------------------------------------------------------------------------------- /taskw/fields/uuid.py: -------------------------------------------------------------------------------- 1 | import uuid 2 | 3 | from .base import Field 4 | 5 | 6 | class UUIDField(Field): 7 | def deserialize(self, value): 8 | if not value: 9 | return value 10 | return uuid.UUID(value) 11 | 12 | def serialize(self, value): 13 | if isinstance(value, uuid.UUID): 14 | value = str(value) 15 | else: 16 | # Just to make sure it's a UUID 17 | uuid.UUID(value) 18 | return value 19 | -------------------------------------------------------------------------------- /taskw/__init__.py: -------------------------------------------------------------------------------- 1 | from taskw.warrior import ( 2 | TaskWarrior, 3 | TaskWarriorDirect, 4 | TaskWarriorShellout, 5 | TaskWarriorExperimental, 6 | ) 7 | from taskw.utils import clean_task, encode_task, decode_task 8 | from taskw.utils import encode_task_experimental 9 | 10 | __all__ = [ 11 | TaskWarrior, 12 | TaskWarriorShellout, 13 | TaskWarriorDirect, 14 | TaskWarriorExperimental, # This is deprecated. Use TaskWarriorShellout 15 | clean_task, 16 | encode_task, 17 | decode_task, 18 | encode_task_experimental, 19 | ] 20 | -------------------------------------------------------------------------------- /taskw/exceptions.py: -------------------------------------------------------------------------------- 1 | import sys 2 | 3 | 4 | class TaskwarriorError(Exception): 5 | def __init__(self, command, stderr, stdout, code): 6 | self.command = command 7 | self.stderr = stderr.strip() 8 | self.stdout = stdout.strip() 9 | self.code = code 10 | super(TaskwarriorError, self).__init__(self.stderr) 11 | 12 | def __str__(self): 13 | return "%r #%s; stderr:\"%s\"; stdout:\"%s\"" % ( 14 | self.command, 15 | self.code, 16 | self.stderr, 17 | self.stdout, 18 | ) 19 | -------------------------------------------------------------------------------- /tox.ini: -------------------------------------------------------------------------------- 1 | [tox] 2 | envlist = py{35,36,37,38}-tw{250,251} py{38}-tw{253} 3 | downloadcache = {toxworkdir}/_download/ 4 | 5 | [testenv] 6 | basepython = 7 | py35: python3.5 8 | py36: python3.6 9 | py37: python3.7 10 | py38: python3.8 11 | deps = 12 | -r{toxinidir}/requirements.txt 13 | -r{toxinidir}/test_requirements.txt 14 | setenv = 15 | tw250: TASKWARRIOR=v2.5.0 16 | tw251: TASKWARRIOR=v2.5.1 17 | tw253: TASKWARRIOR=v2.5.3 18 | sitepackages = False 19 | commands = 20 | {toxinidir}/.tox_build_taskwarrior.sh "{envdir}" "{toxinidir}" 21 | pytest {posargs} 22 | -------------------------------------------------------------------------------- /.tox_build_taskwarrior.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | set -e 4 | 5 | TW_GIT_REPO="https://github.com/GothenburgBitFactory/taskwarrior.git" 6 | 7 | if [ -z "$1" ]; then 8 | echo "envdir not specified" 9 | echo 'Usage: .tox_build_taskwarrior.sh "{envdir}" "{toxinidir}"' 10 | exit 1 11 | fi 12 | 13 | if [ ! -x "$1/bin/task" ]; then 14 | rm -rf "${1?}/task" 15 | # --branch is misleading - it also accepts tags 16 | # So we can do a shallow checkout of a specific tag: 17 | git clone --depth 1 "${TW_GIT_REPO?}" $1/task --branch ${TASKWARRIOR?} 18 | cd $1/task 19 | # Use the 'release build' just to make things faster 20 | # Note about prefix: we are in {envdir}/task, so our install prefix 21 | # is out level up (thus '..'). 22 | cmake -DCMAKE_BUILD_TYPE=release -DCMAKE_INSTALL_PREFIX:PATH=.. . 23 | # Run parralell build as majority of environments these days would have at 24 | # least two CPUs. 25 | make -j2 26 | make install 27 | cd $2 28 | fi 29 | -------------------------------------------------------------------------------- /taskw/fields/date.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | 3 | import dateutil 4 | from dateutil.parser import parse 5 | import pytz 6 | 7 | from taskw.utils import DATE_FORMAT 8 | 9 | from .base import Field 10 | 11 | 12 | class DateField(Field): 13 | def deserialize(self, value): 14 | if not value: 15 | return value 16 | value = parse(value) 17 | if not value.tzinfo: 18 | value = value.replace(tzinfo=pytz.utc) 19 | return value 20 | 21 | def serialize(self, value): 22 | if isinstance(value, datetime.datetime): 23 | if not value.tzinfo: 24 | # Dates not having timezone information should be 25 | # assumed to be in local time 26 | value = value.replace(tzinfo=dateutil.tz.tzlocal()) 27 | # All times should be converted to UTC before serializing 28 | value = value.astimezone(pytz.utc).strftime(DATE_FORMAT) 29 | elif isinstance(value, datetime.date): 30 | value = value.strftime(DATE_FORMAT) 31 | return value 32 | -------------------------------------------------------------------------------- /taskw/fields/string.py: -------------------------------------------------------------------------------- 1 | import logging 2 | 3 | from taskw.utils import encode_replacements_experimental 4 | from .base import Field 5 | 6 | 7 | logger = logging.getLogger(__name__) 8 | 9 | 10 | class StringField(Field): 11 | def deserialize(self, value): 12 | # If value is None, let's just let it pass through 13 | if not value: 14 | return value 15 | if not isinstance(value, str): 16 | value = str(value) 17 | for left, right in encode_replacements_experimental.items(): 18 | value = value.replace(right, left) 19 | return value 20 | 21 | def serialize(self, value): 22 | # If value is None let it pass through 23 | if not value: 24 | return value 25 | if not isinstance(value, str): 26 | string_value = str(value) 27 | logger.debug( 28 | "Value %s serialized to string as '%s'", 29 | repr(value), 30 | string_value 31 | ) 32 | value = string_value 33 | for left, right in encode_replacements_experimental.items(): 34 | value = value.replace(left, right) 35 | return value 36 | -------------------------------------------------------------------------------- /taskw/fields/numeric.py: -------------------------------------------------------------------------------- 1 | import numbers 2 | 3 | from .base import Field 4 | 5 | 6 | class NumericField(Field): 7 | def serialize(self, value): 8 | if not isinstance(value, numbers.Number): 9 | if value: 10 | raise ValueError("Value must be numeric.") 11 | return value 12 | 13 | def deserialize(self, value): 14 | if value is None: 15 | return value 16 | elif isinstance(value, str): 17 | try: 18 | return int(value) 19 | except ValueError: 20 | pass 21 | try: 22 | return float(value) 23 | except ValueError: 24 | pass 25 | elif isinstance(value, int) or isinstance(value, float): 26 | # already desialized 27 | return value 28 | else: 29 | raise ValueError("Unhandled type [{}] passed during deserialization for value [{}]" 30 | .format(type(value), value)) 31 | 32 | # If we've made it this far, somehow Taskwarrior has 33 | # a non-numeric value stored in this field; this shouldn't 34 | # happen, but it's probably inappropriate to blow up. 35 | return value 36 | -------------------------------------------------------------------------------- /taskw/fields/choice.py: -------------------------------------------------------------------------------- 1 | from .base import Field 2 | 3 | 4 | class ChoiceField(Field): 5 | def __init__( 6 | self, 7 | choices=None, 8 | nullable=False, 9 | case_sensitive=False, 10 | **kwargs 11 | ): 12 | self._choices = choices if choices else [] 13 | self._case_sensitive = case_sensitive 14 | super(ChoiceField, self).__init__(**kwargs) 15 | 16 | def is_valid_choice(self, value): 17 | if value is None and value not in self._choices: 18 | return False 19 | if value is None and value in self._choices: 20 | return True 21 | if self._case_sensitive and value in self._choices: 22 | return True 23 | elif ( 24 | not self._case_sensitive 25 | and value.upper() in [v.upper() for v in self._choices if v] 26 | ): 27 | return True 28 | elif self._case_sensitive and value in self._choices: 29 | return True 30 | return False 31 | 32 | def serialize(self, value): 33 | if not self.is_valid_choice(value): 34 | raise ValueError( 35 | "'%s' is not a valid choice; choices: %s" % ( 36 | value, 37 | self._choices, 38 | ) 39 | ) 40 | return value 41 | -------------------------------------------------------------------------------- /taskw/fields/commaseparateduuid.py: -------------------------------------------------------------------------------- 1 | from distutils.version import LooseVersion 2 | 3 | import uuid 4 | 5 | from .base import DirtyableList, Field 6 | 7 | 8 | class CommaSeparatedUUIDField(Field): 9 | version = LooseVersion('2.4') 10 | 11 | def deserialize(self, value): 12 | if not value: 13 | return DirtyableList([]) 14 | 15 | # In task-2.5, this moved from a comma-separated string to a real list. 16 | # here we allow a migration path where old splitable strings are 17 | # handled as well as newschool lists. 18 | if hasattr(value, 'split'): 19 | value = value.split(',') 20 | 21 | return DirtyableList([uuid.UUID(v) for v in value]) 22 | 23 | def serialize(self, value): 24 | if not value: 25 | value = [] 26 | 27 | if not hasattr(value, '__iter__'): 28 | raise ValueError("Value must be list or tuple, not %r." % value) 29 | 30 | if self.version < LooseVersion('2.5'): 31 | return ','.join([str(v) for v in value]) 32 | else: 33 | # We never hit this second code branch now. taskwarrior changed 34 | # API slightly in version 2.5, but we're just going to go with 35 | # backwards compatibility for now. 36 | # Some day we should switch wholesale to the new path. 37 | return [str(v) for v in value] 38 | -------------------------------------------------------------------------------- /.github/workflows/test.yml: -------------------------------------------------------------------------------- 1 | name: Run Tests 2 | on: 3 | push: 4 | branches: ["develop"] 5 | pull_request: 6 | branches: ["develop"] 7 | jobs: 8 | build: 9 | runs-on: ubuntu-latest 10 | strategy: 11 | matrix: 12 | python-version: [3.5, 3.6, 3.7, 3.8] 13 | taskwarrior-version: [2.5.0, 2.5.1, 2.5.3] 14 | exclude: 15 | # Taskwarriror 3.5.3 only supported on Python 3.7+. 16 | - python-version: 3.5 17 | taskwarrior-version: 2.5.3 18 | - python-version: 3.6 19 | taskwarrior-version: 2.5.3 20 | steps: 21 | - uses: actions/checkout@v2 22 | - name: Set up Python ${{matrix.python-version}} 23 | uses: actions/setup-python@v2 24 | with: 25 | python-version: ${{matrix.python-version}} 26 | - name: Install Taskwarrior ${{matrix.taskwarrior-version}} 27 | run: | 28 | sudo apt-get install -y python-dev cmake build-essential libgnutls28-dev uuid-dev gnutls-bin chrpath libssl-dev libfontconfig1-dev 29 | git clone https://github.com/GothenburgBitFactory/taskwarrior.git 30 | cd taskwarrior 31 | git checkout v${{matrix.taskwarrior-version}} 32 | cmake . 33 | make 34 | sudo make install 35 | task --version 36 | cd ../ 37 | - name: Install Dependencies 38 | run: | 39 | python -m pip install --upgrade pip setuptools 40 | python setup.py install 41 | python -m pip install pytest 42 | - name: Run Tests 43 | run: | 44 | pytest 45 | -------------------------------------------------------------------------------- /taskw/fields/base.py: -------------------------------------------------------------------------------- 1 | import copy 2 | import sys 3 | 4 | 5 | class Field(object): 6 | def __init__(self, label=None, read_only=False): 7 | self._label = label 8 | self._read_only = read_only 9 | super(Field, self).__init__() 10 | 11 | @property 12 | def read_only(self): 13 | return self._read_only 14 | 15 | @property 16 | def label(self): 17 | return self._label 18 | 19 | def deserialize(self, value): 20 | return value 21 | 22 | def serialize(self, value): 23 | return value 24 | 25 | def __str__(self): 26 | return self.label 27 | 28 | def __repr__(self): 29 | return "<{cls} '{label}'>".format( 30 | cls=str(self.__class__.__name__), 31 | label=str(self) if self._label else '(No Label)', 32 | ) 33 | 34 | def __eq__(self, other): 35 | if self.label != other.label: 36 | return False 37 | if self.read_only != other.read_only: 38 | return False 39 | if self.__class__ != other.__class__: 40 | return False 41 | return True 42 | 43 | def __ne__(self, other): 44 | return not self.__eq__(other) 45 | 46 | 47 | class Dirtyable(object): 48 | """ Superclass for all objects implementing trackability.""" 49 | 50 | def __init__(self, value=None): 51 | self._original_value = copy.deepcopy(value) 52 | super(Dirtyable, self).__init__(value) 53 | 54 | def get_changes(self, keep=False): 55 | if self._original_value == self: 56 | return {} 57 | result = (self._original_value, self) 58 | if not keep: 59 | self._original_value = copy.deepcopy(self) 60 | return result 61 | 62 | 63 | class DirtyableList(Dirtyable, list): 64 | pass 65 | 66 | 67 | class DirtyableDict(Dirtyable, dict): 68 | pass 69 | -------------------------------------------------------------------------------- /taskw/fields/annotationarray.py: -------------------------------------------------------------------------------- 1 | from dateutil.parser import parse 2 | 3 | from .array import ArrayField 4 | from .base import DirtyableList 5 | 6 | 7 | class Annotation(str): 8 | """ A special type of string that we'll use for storing annotations. 9 | 10 | This is, for all intents and purposes, really just a string, but 11 | it does allow us to store additional information if we have it -- in 12 | this application: the annotation's entry date. 13 | 14 | """ 15 | def __new__(self, description, entry=None): 16 | return str.__new__(self, description) 17 | 18 | def __init__(self, description, entry=None): 19 | self._entry = entry 20 | super(Annotation, self).__init__() 21 | 22 | @property 23 | def entry(self): 24 | if self._entry: 25 | return parse(self._entry) 26 | return self._entry 27 | 28 | 29 | class AnnotationArrayField(ArrayField): 30 | """ A special case of the ArrayField handling idiosyncrasies of Annotations 31 | 32 | Taskwarrior will currently return to you a dictionary of values -- 33 | the annotation's date and description -- for each annotation, but 34 | given that we cannot create annotations with a date, let's instead 35 | return something that behaves like a string (but from which you can 36 | extract an entry date if one exists). 37 | 38 | """ 39 | def deserialize(self, value): 40 | if not value: 41 | value = DirtyableList([]) 42 | 43 | elements = [] 44 | for annotation in value: 45 | if isinstance(annotation, dict): 46 | elements.append( 47 | Annotation( 48 | annotation['description'], 49 | annotation['entry'], 50 | ) 51 | ) 52 | else: 53 | elements.append(Annotation(annotation)) 54 | 55 | return super(AnnotationArrayField, self).deserialize(elements) 56 | 57 | def serialize(self, value): 58 | if not value: 59 | value = [] 60 | return super(AnnotationArrayField, self).serialize( 61 | [str(entry) for entry in value] 62 | ) 63 | -------------------------------------------------------------------------------- /taskw/test/test_warrior.py: -------------------------------------------------------------------------------- 1 | import tempfile 2 | import os 3 | import shutil 4 | from unittest import TestCase 5 | 6 | from taskw.warrior import TaskWarrior 7 | 8 | 9 | class TestTaskWarrior(TestCase): 10 | def setUp(self): 11 | self.taskdata = tempfile.mkdtemp() 12 | taskrc = os.path.join(os.path.dirname(__file__), 'data/empty.taskrc') 13 | self.taskwarrior = TaskWarrior( 14 | config_filename=taskrc, 15 | config_overrides={'data.location': self.taskdata}) 16 | # Just a sanity check to make sure that after the setup, the list of 17 | # tasks is empty, otherwise we are probably using the current user's 18 | # TASKDATA and we should not continue. 19 | assert self.taskwarrior.load_tasks() == {'completed': [], 'pending': []} 20 | 21 | def tearDown(self): 22 | # Remove the directory after the test 23 | shutil.rmtree(self.taskdata) 24 | 25 | def test_add_task_foobar(self): 26 | """ Add a task with description 'foobar' and checks that the task is 27 | indeed created """ 28 | self.taskwarrior.task_add("foobar") 29 | tasks = self.taskwarrior.load_tasks() 30 | assert len(tasks['pending']) == 1 31 | assert tasks['pending'][0]['description'] == 'foobar' 32 | 33 | def test_add_task_null_char(self): 34 | """ Try adding a task where the description contains a NULL character 35 | (0x00). This should not fail but instead simply add a task with the 36 | same description minus the NULL character """ 37 | self.taskwarrior.task_add("foo\x00bar") 38 | tasks = self.taskwarrior.load_tasks() 39 | assert len(tasks['pending']) == 1 40 | assert tasks['pending'][0]['description'] == 'foobar' 41 | 42 | def test_add_task_recurs(self): 43 | """ Try adding a task with `recur` to ensure the uuid can be parsed """ 44 | self.taskwarrior.task_add("foobar weekly", due="tomorrow", recur="weekly") 45 | tasks = self.taskwarrior.load_tasks() 46 | 47 | assert len(tasks['pending']) == 1 48 | assert tasks['pending'][0]['description'] == 'foobar weekly' 49 | assert tasks['pending'][0]['recur'] == 'weekly' 50 | assert tasks['pending'][0]['parent'] is not None 51 | 52 | -------------------------------------------------------------------------------- /setup.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | import uuid 4 | 5 | from setuptools import setup, find_packages 6 | 7 | f = open('README.rst') 8 | long_description = f.read().strip() 9 | long_description = long_description.split('split here', 1)[1] 10 | f.close() 11 | 12 | REQUIREMENTS_FILES = { 13 | 'test': 'test_requirements.txt', 14 | 'install': 'requirements.txt', 15 | } 16 | REQUIREMENTS = {} 17 | for category, filename in REQUIREMENTS_FILES.items(): 18 | requirements_path = os.path.join( 19 | os.path.dirname(__file__), 20 | filename 21 | ) 22 | try: 23 | from pip.req import parse_requirements 24 | requirements = [ 25 | str(req.req) for req in parse_requirements( 26 | requirements_path, 27 | session=uuid.uuid1() 28 | ) 29 | ] 30 | except ImportError: 31 | requirements = [] 32 | with open(requirements_path, 'r') as in_: 33 | requirements = [ 34 | req for req in in_.readlines() 35 | if not req.startswith('-') 36 | and not req.startswith('#') 37 | ] 38 | REQUIREMENTS[category] = requirements 39 | 40 | setup(name='taskw', 41 | version='2.0.0', 42 | description="Python bindings for your taskwarrior database", 43 | long_description=long_description, 44 | classifiers=[ 45 | "Development Status :: 5 - Production/Stable", 46 | "Programming Language :: Python :: 3", 47 | "Programming Language :: Python :: 3.4", 48 | "Programming Language :: Python :: 3.5", 49 | "Programming Language :: Python :: 3.6", 50 | "Programming Language :: Python :: 3.7", 51 | "Programming Language :: Python :: 3.8", 52 | "License :: OSI Approved :: GNU General Public License (GPL)", 53 | "Intended Audience :: Developers", 54 | ], 55 | keywords='taskwarrior task', 56 | author='Ralph Bean', 57 | author_email='ralph.bean@gmail.com', 58 | url='http://github.com/ralphbean/taskw', 59 | license='GPLv3+', 60 | packages=find_packages(exclude=['ez_setup', 'examples', 'tests']), 61 | include_package_data=True, 62 | zip_safe=False, 63 | install_requires=REQUIREMENTS['install'], 64 | entry_points=""" 65 | # -*- Entry points: -*- 66 | """, 67 | ) 68 | -------------------------------------------------------------------------------- /taskw/test/test_recursive.py: -------------------------------------------------------------------------------- 1 | import os 2 | import shutil 3 | import tempfile 4 | 5 | import pytest 6 | 7 | from taskw import TaskWarriorShellout 8 | 9 | 10 | TASK = {'description': "task 2 http://www.google.com/", 11 | 'entry': "1325011643", 12 | 'project': "work", 13 | 'start': "1326079920", 'status': "pending", 14 | 'uuid': "c1c431ea-f0dc-4683-9a20-e64fcfa65fd1"} 15 | 16 | 17 | class TestRecursibe(object): 18 | def setup(self): 19 | if not TaskWarriorShellout.can_use(): 20 | # Sometimes the 'task' command line tool is not installed. 21 | pytest.skip("taskwarrior not installed") 22 | 23 | # Create some temporary config stuff 24 | fd, fname = tempfile.mkstemp(prefix='taskw-testsrc') 25 | dname = tempfile.mkdtemp(prefix='taskw-tests-data') 26 | 27 | with open(fname, 'w') as f: 28 | f.writelines([ 29 | 'data.location=%s\n' % dname, 30 | 'uda.somestring.label=Testing String\n', 31 | 'uda.somestring.type=string\n', 32 | 'uda.somedate.label=Testing Date\n', 33 | 'uda.somedate.type=date\n', 34 | 'uda.somenumber.label=Testing Number\n', 35 | 'uda.somenumber.type=numeric\n', 36 | ]) 37 | 38 | # Create empty .data files 39 | for piece in ['completed', 'pending', 'undo']: 40 | with open(os.path.sep.join([dname, piece + '.data']), 'w'): 41 | pass 42 | 43 | # Save names for .tearDown() 44 | self.fname, self.dname = fname, dname 45 | 46 | # Create the taskwarrior db object that each test will use. 47 | self.tw = TaskWarriorShellout(config_filename=fname, marshal=True) 48 | 49 | def tearDown(self): 50 | os.remove(self.fname) 51 | shutil.rmtree(self.dname) 52 | 53 | def test_set_dep_on_one_uuid(self): 54 | task1 = self.tw.task_add('task1') 55 | task2 = self.tw.task_add('task2', depends=[task1['uuid']]) 56 | assert task2['depends'][0] == task1['uuid'] 57 | 58 | def test_set_dep_on_two_uuid(self): 59 | task1 = self.tw.task_add('task1') 60 | task2 = self.tw.task_add('task2') 61 | depends = [task1['uuid'], task2['uuid']] 62 | task3 = self.tw.task_add('task3', depends=depends) 63 | assert set(task3['depends']) == set([task1['uuid'], task2['uuid']]) 64 | -------------------------------------------------------------------------------- /README.rst: -------------------------------------------------------------------------------- 1 | taskw - Python API for the taskwarrior DB 2 | ========================================= 3 | 4 | .. split here 5 | 6 | This is a python API for the `taskwarrior `_ command 7 | line tool. 8 | 9 | It contains two implementations: ``taskw.TaskWarriorShellout`` and 10 | ``taskw.TaskWarriorDirect``. The first implementation is the supported one 11 | recommended by the upstream taskwarrior core project. It uses the ``task 12 | export`` and ``task import`` commands to manipulate the task database. The 13 | second implementation opens the task db file itself and directly manipulates 14 | it. It exists for backwards compatibility, but should only be used when 15 | necessary. 16 | 17 | Build Status 18 | ------------ 19 | 20 | .. |master| image:: https://secure.travis-ci.org/ralphbean/taskw.png?branch=master 21 | :alt: Build Status - master branch 22 | :target: http://travis-ci.org/#!/ralphbean/taskw 23 | 24 | .. |develop| image:: https://secure.travis-ci.org/ralphbean/taskw.png?branch=develop 25 | :alt: Build Status - develop branch 26 | :target: http://travis-ci.org/#!/ralphbean/taskw 27 | 28 | +----------+-----------+ 29 | | Branch | Status | 30 | +==========+===========+ 31 | | master | |master| | 32 | +----------+-----------+ 33 | | develop | |develop| | 34 | +----------+-----------+ 35 | 36 | Getting taskw 37 | ------------- 38 | 39 | Installing 40 | ++++++++++ 41 | 42 | Using ``taskw`` requires that you first install `taskwarrior 43 | `_. 44 | 45 | Installing it from http://pypi.python.org/pypi/taskw is easy with ``pip``:: 46 | 47 | $ pip install taskw 48 | 49 | The Source 50 | ++++++++++ 51 | 52 | You can find the source on github at http://github.com/ralphbean/taskw 53 | 54 | 55 | Examples 56 | -------- 57 | 58 | Looking at tasks 59 | ++++++++++++++++ 60 | 61 | >>> from taskw import TaskWarrior 62 | >>> w = TaskWarrior() 63 | >>> tasks = w.load_tasks() 64 | >>> tasks.keys() 65 | ['completed', 'pending'] 66 | >>> type(tasks['pending']) 67 | 68 | >>> type(tasks['pending'][0]) 69 | 70 | 71 | Adding tasks 72 | ++++++++++++ 73 | 74 | >>> from taskw import TaskWarrior 75 | >>> w = TaskWarrior() 76 | >>> w.task_add("Eat food") 77 | >>> w.task_add("Take a nap", priority="H", project="life", due="1359090000") 78 | 79 | Retrieving tasks 80 | ++++++++++++++++ 81 | 82 | >>> from taskw import TaskWarrior 83 | >>> w = TaskWarrior() 84 | >>> w.get_task(id=5) 85 | 86 | Updating tasks 87 | ++++++++++++++ 88 | 89 | >>> from taskw import TaskWarrior 90 | >>> w = TaskWarrior() 91 | >>> id, task = w.get_task(id=14) 92 | >>> task['project'] = 'Updated project name' 93 | >>> w.task_update(task) 94 | 95 | Deleting tasks 96 | ++++++++++++++ 97 | 98 | >>> from taskw import TaskWarrior 99 | >>> w = TaskWarrior() 100 | >>> w.task_delete(id=3) 101 | 102 | Completing tasks 103 | ++++++++++++++++ 104 | 105 | >>> from taskw import TaskWarrior 106 | >>> w = TaskWarrior() 107 | >>> w.task_done(id=46) 108 | 109 | Being Flexible 110 | ++++++++++++++ 111 | 112 | You can point ``taskw`` at different taskwarrior databases. 113 | 114 | >>> from taskw import TaskWarrior 115 | >>> w = TaskWarrior(config_filename="~/some_project/.taskrc") 116 | >>> w.task_add("Use 'taskw'.") 117 | 118 | 119 | Looking at the config 120 | +++++++++++++++++++++ 121 | 122 | >>> from taskw import TaskWarrior 123 | >>> w = TaskWarrior() 124 | >>> config = w.load_config() 125 | >>> config['data']['location'] 126 | '/home/threebean/.task' 127 | >>> config['_forcecolor'] 128 | 'yes' 129 | 130 | 131 | Using Python-appropriate Types (Dates, UUIDs, etc) 132 | ++++++++++++++++++++++++++++++++++++++++++++++++++ 133 | 134 | >>> from taskw import TaskWarrior 135 | >>> w = TaskWarrior(marshal=True) 136 | >>> w.get_task(id=10) 137 | (10, 138 | { 139 | 'description': 'Hello there!', 140 | 'entry': datetime.datetime(2014, 3, 14, 14, 18, 40, tzinfo=tzutc()) 141 | 'id': 10, 142 | 'project': 'Saying Hello', 143 | 'status': 'pending', 144 | 'uuid': UUID('4882751a-3966-4439-9675-948b1152895c') 145 | } 146 | ) 147 | -------------------------------------------------------------------------------- /taskw/test/test_taskrc.py: -------------------------------------------------------------------------------- 1 | import os 2 | import sys 3 | 4 | from taskw.warrior import TaskWarrior 5 | from taskw.taskrc import TaskRc 6 | from taskw.fields import NumericField, ChoiceField 7 | 8 | 9 | from unittest import TestCase 10 | 11 | 12 | class TestBasicLoading(TestCase): 13 | def setUp(self): 14 | self.path_to_taskrc = os.path.join( 15 | os.path.dirname(__file__), 16 | 'data/default.taskrc', 17 | ) 18 | 19 | def test_load_config(self): 20 | expected = { 21 | 'data': { 22 | 'location': '~/.task' 23 | }, 24 | 'alpha': { 25 | 'one': 'yes', 26 | 'two': '2', 27 | }, 28 | 'beta': { 29 | 'one': 'FALSE', 30 | }, 31 | 'gamma': { 32 | 'one': 'TRUE', 33 | }, 34 | 'uda': { 35 | 'a': { 36 | 'type': 'numeric', 37 | 'label': 'Alpha', 38 | }, 39 | 'b': { 40 | 'type': 'string', 41 | 'label': 'Beta', 42 | 'values': 'Strontium-90,Hydrogen-3', 43 | } 44 | } 45 | } 46 | config = TaskWarrior.load_config(self.path_to_taskrc) 47 | self.assertEqual(config, expected) 48 | 49 | 50 | class TestTaskRc(TestCase): 51 | def setUp(self): 52 | self.path_to_taskrc = os.path.join( 53 | os.path.dirname(__file__), 54 | 'data/default.taskrc', 55 | ) 56 | self.taskrc = TaskRc(self.path_to_taskrc) 57 | 58 | def test_taskrc_parsing(self): 59 | expected_config = { 60 | 'data': { 61 | 'location': '~/.task' 62 | }, 63 | 'alpha': { 64 | 'one': 'yes', 65 | 'two': '2', 66 | }, 67 | 'beta': { 68 | 'one': 'FALSE', 69 | }, 70 | 'gamma': { 71 | 'one': 'TRUE', 72 | }, 73 | 'uda': { 74 | 'a': { 75 | 'type': 'numeric', 76 | 'label': 'Alpha', 77 | }, 78 | 'b': { 79 | 'type': 'string', 80 | 'label': 'Beta', 81 | 'values': 'Strontium-90,Hydrogen-3', 82 | } 83 | } 84 | } 85 | 86 | self.assertEqual(self.taskrc, expected_config) 87 | 88 | def test_get_udas(self): 89 | expected_udas = { 90 | 'a': NumericField(label='Alpha'), 91 | 'b': ChoiceField( 92 | label='Beta', 93 | choices=['Strontium-90', 'Hydrogen-3'], 94 | ), 95 | } 96 | actual_udas = self.taskrc.get_udas() 97 | 98 | self.assertEqual(actual_udas, expected_udas) 99 | 100 | def test_config_overrides(self): 101 | overrides = { 102 | 'uda': { 103 | 'd': { 104 | 'type': 'string', 105 | 'label': 'Delta', 106 | } 107 | }, 108 | 'alpha': { 109 | 'two': '3', 110 | } 111 | } 112 | 113 | taskrc = TaskRc(self.path_to_taskrc, overrides=overrides) 114 | 115 | expected_config = { 116 | 'data': { 117 | 'location': '~/.task' 118 | }, 119 | 'alpha': { 120 | 'one': 'yes', 121 | 'two': '3', 122 | }, 123 | 'beta': { 124 | 'one': 'FALSE', 125 | }, 126 | 'gamma': { 127 | 'one': 'TRUE', 128 | }, 129 | 'uda': { 130 | 'a': { 131 | 'type': 'numeric', 132 | 'label': 'Alpha', 133 | }, 134 | 'b': { 135 | 'type': 'string', 136 | 'label': 'Beta', 137 | 'values': 'Strontium-90,Hydrogen-3', 138 | }, 139 | 'd': { 140 | 'type': 'string', 141 | 'label': 'Delta', 142 | } 143 | } 144 | } 145 | 146 | self.assertEqual(taskrc, expected_config) 147 | -------------------------------------------------------------------------------- /taskw/taskrc.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import os 3 | 4 | from taskw.fields import ( 5 | ChoiceField, 6 | DateField, 7 | DurationField, 8 | NumericField, 9 | StringField 10 | ) 11 | 12 | 13 | logger = logging.getLogger(__name__) 14 | 15 | 16 | def sanitize(line): 17 | comment_position = line.find('#') 18 | if comment_position < 0: 19 | return line.strip() 20 | return line[:comment_position].strip() 21 | 22 | 23 | class TaskRc(dict): 24 | """ Access the user's taskRC using a dictionary-like interface. 25 | 26 | There is a downside, though: 27 | 28 | Unfortunately, collapsing our configuration into a dict has a 29 | jarring limitation -- we can't store both of the following 30 | simultaneously: 31 | 32 | * color = on 33 | * color.header = something 34 | 35 | In this module, we err on the side of storing subkeys rather than the 36 | actual value in situations where both are necessary. 37 | 38 | Please forgive me. 39 | 40 | """ 41 | 42 | UDA_TYPE_MAP = { 43 | 'date': DateField, 44 | 'duration': DurationField, 45 | 'numeric': NumericField, 46 | 'string': StringField, 47 | } 48 | 49 | def __init__(self, path=None, overrides=None): 50 | self.overrides = overrides if overrides else {} 51 | if path: 52 | self.path = os.path.normpath( 53 | os.path.expanduser( 54 | path 55 | ) 56 | ) 57 | config = self._read(self.path) 58 | else: 59 | self.path = None 60 | config = {} 61 | super(TaskRc, self).__init__(config) 62 | 63 | def _add_to_tree(self, config, key, value): 64 | key_parts = key.split('.') 65 | cursor = config 66 | for part in key_parts[0:-1]: 67 | if part not in cursor: 68 | cursor[part] = {} 69 | # See class docstring -- we can't store both a value and 70 | # a dict in the same place. 71 | if not isinstance(cursor[part], dict): 72 | cursor[part] = {} 73 | cursor = cursor[part] 74 | cursor[key_parts[-1]] = value 75 | return config 76 | 77 | def _merge_trees(self, left, right): 78 | if left is None: 79 | left = {} 80 | 81 | for key, value in right.items(): 82 | # See class docstring -- we can't store both a value and 83 | # a dict in the same place. 84 | if not isinstance(left, dict): 85 | left = {} 86 | if isinstance(value, dict): 87 | left[key] = self._merge_trees(left.get(key), value) 88 | else: 89 | left[key] = value 90 | 91 | return left 92 | 93 | def _read(self, path): 94 | config = {} 95 | with open(path, 'r') as config_file: 96 | for raw_line in config_file.readlines(): 97 | line = sanitize(raw_line) 98 | if not line: 99 | continue 100 | if line.startswith('include '): 101 | try: 102 | left, right = line.split(' ') 103 | config = self._merge_trees( 104 | config, 105 | TaskRc(right.strip()) 106 | ) 107 | except ValueError: 108 | logger.exception( 109 | "Error encountered while adding TaskRc at " 110 | "'%s' (from TaskRc file at '%s')", 111 | right.strip(), 112 | self.path 113 | ) 114 | else: 115 | try: 116 | left, right = line.split('=', 1) 117 | key = left.strip() 118 | value = right.strip() 119 | config = self._add_to_tree(config, key, value) 120 | except ValueError: 121 | logger.exception( 122 | "Error encountered while processing configuration " 123 | "setting '%s' (from TaskRc file at '%s')", 124 | line, 125 | self.path, 126 | ) 127 | 128 | return self._merge_trees(config, self.overrides) 129 | 130 | def __delitem__(self, *args): 131 | raise TypeError('TaskRc objects are immutable') 132 | 133 | def __setitem__(self, item, value): 134 | raise TypeError('TaskRc objects are immutable') 135 | 136 | def update(self, value): 137 | raise TypeError('TaskRc objects are immutable') 138 | 139 | def get_udas(self): 140 | raw_udas = self.get('uda', {}) 141 | udas = {} 142 | 143 | for k, v in raw_udas.items(): 144 | tw_type = v.get('type', '') 145 | label = v.get('label', None) 146 | choices = v.get('values', None) 147 | 148 | kwargs = {} 149 | cls = self.UDA_TYPE_MAP.get(tw_type, StringField) 150 | if choices: 151 | cls = ChoiceField 152 | kwargs['choices'] = choices.split(',') 153 | if label: 154 | kwargs['label'] = label 155 | 156 | udas[k] = cls(**kwargs) 157 | 158 | return udas 159 | 160 | def __str__(self): 161 | return 'TaskRc file at {path}'.format( 162 | path=self.path 163 | ) 164 | -------------------------------------------------------------------------------- /taskw/test/test_utils.py: -------------------------------------------------------------------------------- 1 | import datetime 2 | import random 3 | 4 | import dateutil.tz 5 | import pytz 6 | 7 | from taskw.utils import ( 8 | convert_dict_to_override_args, 9 | decode_task, 10 | encode_task, 11 | encode_task_experimental, 12 | DATE_FORMAT, 13 | clean_ctrl_chars, 14 | ) 15 | 16 | TASK = {'description': "task 2 http://www.google.com/", 17 | 'entry': "1325011643", 18 | 'project': "work", 19 | 'due': "1359090000", 20 | 'start': "1326079920", 'status': "pending", 21 | 'uuid': "c1c431ea-f0dc-4683-9a20-e64fcfa65fd1"} 22 | 23 | 24 | TASK_LEADING_WS = TASK.copy() 25 | TASK_LEADING_WS.update({'description': " task 3"}) 26 | 27 | 28 | def shuffled(l): 29 | new = list(l) 30 | random.shuffle(new) 31 | return new 32 | 33 | 34 | class TestUtils(object): 35 | 36 | def test_no_side_effects(self): 37 | orig = TASK.copy() 38 | decode_task(encode_task(TASK)) 39 | assert orig == TASK 40 | 41 | def test_with_escaped_quotes(self): 42 | expected = {'this': r'has a "quote" in it.'} 43 | line = r'[this:"has a \"quote\" in it."]' 44 | r = decode_task(line) 45 | assert r == expected 46 | 47 | def test_with_escaped_quotes_roundtrip(self): 48 | expected = {'this': r'has a "quote" in it.'} 49 | line = r'[this:"has a \"quote\" in it."]' 50 | r = decode_task(encode_task(decode_task(line))) 51 | assert r == expected 52 | 53 | def test_with_escaped_quotes_full(self): 54 | line = r'[this:"has a \"quote\" in it."]' 55 | r = encode_task(decode_task(line)) 56 | assert r == r 57 | 58 | def test_with_backticks(self): 59 | expected = {'this': r'has a fucking `backtick` in it'} 60 | line = r'[this:"has a fucking `backtick` in it"]' 61 | r = decode_task(line) 62 | assert r == expected 63 | r = decode_task(encode_task(decode_task(line))) 64 | assert r == expected 65 | 66 | def test_with_backslashes(self): 67 | expected = {'andthis': r'has a fucking \backslash in it'} 68 | line = r'[andthis:"has a fucking \\backslash in it"]' 69 | r = decode_task(line) 70 | assert r == expected 71 | r = decode_task(encode_task(decode_task(line))) 72 | assert r == expected 73 | 74 | def test_with_unicode(self): 75 | expected = { 76 | 'andthis': 'has a fucking \\backslash in it' 77 | } 78 | line = r'[andthis:"has a fucking \\backslash in it"]' 79 | r = decode_task(line) 80 | assert r == expected 81 | r = decode_task(encode_task(decode_task(line))) 82 | assert r == expected 83 | 84 | def test_decode(self): 85 | r = decode_task(encode_task(TASK)) 86 | assert r == TASK 87 | 88 | def test_decode_leading_whitespace_in_value(self): 89 | r = decode_task(encode_task(TASK_LEADING_WS)) 90 | assert r == TASK_LEADING_WS 91 | 92 | def test_composition(self): 93 | assert TASK == decode_task(encode_task(TASK)) 94 | 95 | def test_double_composition(self): 96 | assert TASK == decode_task(encode_task(decode_task(encode_task(TASK)))) 97 | 98 | def test_ordering(self): 99 | task1 = dict(shuffled(TASK.items())) 100 | task2 = dict(shuffled(TASK.items())) 101 | assert encode_task(task1) == encode_task(task2) 102 | 103 | def test_taskwarrior_null_encoding_bug_workaround(self): 104 | task = { 105 | 'priority': '' 106 | } 107 | actual_encoded = encode_task_experimental(task)[0] 108 | expected_encoded = "priority:" 109 | 110 | assert actual_encoded == expected_encoded 111 | 112 | def test_encodes_dates(self): 113 | arbitrary_date = datetime.date(2014, 3, 2) 114 | task = { 115 | 'arbitrary_field': arbitrary_date 116 | } 117 | 118 | actual_encoded_task = encode_task_experimental(task) 119 | expected_encoded_task = encode_task_experimental( 120 | { 121 | 'arbitrary_field': arbitrary_date.strftime(DATE_FORMAT) 122 | } 123 | ) 124 | 125 | assert actual_encoded_task == expected_encoded_task 126 | 127 | def test_encodes_naive_datetimes(self): 128 | arbitrary_naive_datetime = datetime.datetime.now() 129 | task = { 130 | 'arbitrary_field': arbitrary_naive_datetime 131 | } 132 | 133 | actual_encoded_task = encode_task_experimental(task) 134 | expected_encoded_task = encode_task_experimental( 135 | { 136 | 'arbitrary_field': ( 137 | arbitrary_naive_datetime 138 | .replace(tzinfo=dateutil.tz.tzlocal()) 139 | .astimezone(pytz.utc).strftime(DATE_FORMAT) 140 | ) 141 | } 142 | ) 143 | 144 | assert actual_encoded_task == expected_encoded_task 145 | 146 | def test_encodes_zoned_datetimes(self): 147 | arbitrary_timezone = pytz.timezone('America/Los_Angeles') 148 | arbitrary_zoned_datetime = datetime.datetime.now().replace( 149 | tzinfo=arbitrary_timezone 150 | ) 151 | task = { 152 | 'arbitrary_field': arbitrary_zoned_datetime 153 | } 154 | 155 | actual_encoded_task = encode_task_experimental(task) 156 | expected_encoded_task = encode_task_experimental( 157 | { 158 | 'arbitrary_field': ( 159 | arbitrary_zoned_datetime 160 | .astimezone(pytz.utc).strftime(DATE_FORMAT) 161 | ) 162 | } 163 | ) 164 | 165 | assert actual_encoded_task == expected_encoded_task 166 | 167 | def test_convert_dict_to_override_args(self): 168 | overrides = { 169 | 'one': { 170 | 'two': 1, 171 | 'three': { 172 | 'alpha': 'a' 173 | }, 174 | 'four': 'lorem ipsum', 175 | }, 176 | 'two': { 177 | } 178 | } 179 | 180 | expected_overrides = [ 181 | 'rc.one.two=1', 182 | 'rc.one.three.alpha=a', 183 | 'rc.one.four="lorem ipsum"', 184 | ] 185 | actual_overrides = convert_dict_to_override_args(overrides) 186 | 187 | assert set(actual_overrides) == set(expected_overrides) 188 | 189 | 190 | class TestCleanExecArg(object): 191 | def test_clean_null(self): 192 | assert b"" == clean_ctrl_chars(b"\x00") 193 | 194 | def test_all_ctrl_chars(self): 195 | """ Test that most (but not all) control characters are removed """ 196 | # input = bytes(range(0x20)) 197 | input = b'\x00\x01\x02\x03\x04\x05\x06\x07\x08\t\n\x0b\x0c\r\x0e\x0f\x10\x11\x12\x13\x14\x15\x16\x17\x18\x19\x1a\x1b\x1c\x1d\x1e\x1f' # For python 2 compatibility 198 | assert b"\t\n\v\f\r" == clean_ctrl_chars(input) 199 | -------------------------------------------------------------------------------- /taskw/test/test_task.py: -------------------------------------------------------------------------------- 1 | import copy 2 | import datetime 3 | import io 4 | import uuid 5 | from unittest import TestCase 6 | 7 | import pytz 8 | from dateutil.tz import tzutc 9 | 10 | from taskw.task import Task 11 | 12 | 13 | class TestTaskDirtyability(TestCase): 14 | def setUp(self): 15 | self.task = Task({ 16 | 'uuid': str(uuid.uuid4()), 17 | 'description': 'Something important', 18 | 'due': ( 19 | datetime.datetime.now().replace(tzinfo=pytz.UTC) 20 | + datetime.timedelta(hours=1) 21 | ).strftime('%Y%m%dT%H%M%SZ'), 22 | 'tags': ['one', 'two', 'three'], 23 | }) 24 | 25 | def test_append_when_absent(self): 26 | self.task['annotations'] = [] 27 | self.task['annotations'].append('awesome') 28 | self.assertEqual(self.task['annotations'], ['awesome']) 29 | 30 | def test_append_when_absent_but_with_tags(self): 31 | self.task = Task({'uuid': str(uuid.uuid4()), 'description': 'Test'}) 32 | self.task['tags'] = [] 33 | self.task['tags'].append('awesome') 34 | self.assertEqual(self.task['tags'], ['awesome']) 35 | 36 | def test_marks_date_changed(self): 37 | original_due_date = self.task['due'] 38 | new_due_date = datetime.datetime.now().replace(tzinfo=pytz.UTC) 39 | self.task['due'] = new_due_date 40 | 41 | expected_changes = {'due': (original_due_date, new_due_date)} 42 | actual_changes = self.task.get_changes() 43 | 44 | self.assertEqual(list(actual_changes.keys()), ['due']) 45 | 46 | # Use assertAlmostEqual to allow for millisecond loss when 47 | # converting to string in setUp 48 | self.assertAlmostEqual( 49 | expected_changes['due'][0], 50 | actual_changes['due'][0], 51 | delta=datetime.timedelta(seconds=1) 52 | ) 53 | self.assertAlmostEqual( 54 | expected_changes['due'][1], 55 | actual_changes['due'][1], 56 | delta=datetime.timedelta(seconds=1) 57 | ) 58 | 59 | def test_marks_tags_changed(self): 60 | original_tags = copy.deepcopy(self.task['tags']) 61 | new_tag = 'alpha' 62 | self.task['tags'].append(new_tag) 63 | 64 | expected_tags = copy.deepcopy(original_tags) 65 | expected_tags.append(new_tag) 66 | 67 | expected_changes = {'tags': [original_tags, expected_tags]} 68 | actual_changes = self.task.get_changes() 69 | 70 | self.assertEqual(actual_changes, expected_changes) 71 | 72 | def test_does_not_mark_unchanged(self): 73 | self.task['description'] = self.task['description'] 74 | 75 | expected_changes = {} 76 | actual_changes = self.task.get_changes() 77 | 78 | self.assertEqual(actual_changes, expected_changes) 79 | 80 | def test_does_not_allow_changing_id(self): 81 | with self.assertRaises(ValueError): 82 | self.task['id'] = 10 83 | 84 | 85 | class TestTaskMarshalling(TestCase): 86 | def test_serialize(self): 87 | arbitrary_serialized_data = { 88 | 'depends': ','.join([ 89 | str(uuid.uuid4()), 90 | str(uuid.uuid4()), 91 | ]), 92 | 'description': '&open;Something important', 93 | 'due': ( 94 | datetime.datetime.now().replace(tzinfo=pytz.UTC) 95 | + datetime.timedelta(hours=1) 96 | ).strftime('%Y%m%dT%H%M%SZ'), 97 | 'tags': ['one', 'two', 'three'], 98 | 'urgency': 10, 99 | 'uuid': str(uuid.uuid4()), 100 | } 101 | task = Task(arbitrary_serialized_data) 102 | expected_result = arbitrary_serialized_data 103 | actual_result = task.serialized() 104 | 105 | self.assertEqual(actual_result, expected_result) 106 | 107 | def test_deserialize(self): 108 | arbitrary_depends_uuids = [uuid.uuid4(), uuid.uuid4()] 109 | arbitrary_description = '[one' 110 | arbitrary_due_date = ( 111 | datetime.datetime.now().replace(tzinfo=pytz.UTC) 112 | + datetime.timedelta(hours=1) 113 | ) 114 | arbitrary_tags = ['one', 'two', ] 115 | arbitrary_urgency = 10 116 | arbitrary_uuid = uuid.uuid4() 117 | 118 | serialized = { 119 | 'depends': ','.join([str(u) for u in arbitrary_depends_uuids]), 120 | 'description': arbitrary_description.replace('[', '&open;'), 121 | 'due': arbitrary_due_date.strftime('%Y%m%dT%H%M%SZ'), 122 | 'tags': arbitrary_tags, 123 | 'urgency': arbitrary_urgency, 124 | 'uuid': str(arbitrary_uuid) 125 | } 126 | task = Task(serialized) 127 | 128 | self.assertEqual(task['depends'], arbitrary_depends_uuids) 129 | self.assertEqual(task['description'], arbitrary_description) 130 | # Loss of milliseconds when converting to string 131 | self.assertAlmostEqual( 132 | task['due'], 133 | arbitrary_due_date, 134 | delta=datetime.timedelta(seconds=1) 135 | ) 136 | self.assertEqual(task['tags'], arbitrary_tags) 137 | self.assertEqual(task['urgency'], arbitrary_urgency) 138 | self.assertEqual(task['uuid'], arbitrary_uuid) 139 | 140 | def test_composition(self): 141 | arbitrary_serialized_data = { 142 | 'depends': ','.join([ 143 | str(uuid.uuid4()), 144 | str(uuid.uuid4()), 145 | ]), 146 | 'description': '&open;Something important', 147 | 'due': ( 148 | datetime.datetime.now().replace(tzinfo=pytz.UTC) 149 | + datetime.timedelta(hours=1) 150 | ).strftime('%Y%m%dT%H%M%SZ'), 151 | 'tags': ['one', 'two', 'three'], 152 | 'urgency': 10, 153 | 'uuid': str(uuid.uuid4()), 154 | } 155 | expected_result = arbitrary_serialized_data 156 | 157 | after_composition = Task( 158 | Task( 159 | Task( 160 | arbitrary_serialized_data 161 | ).serialized() 162 | ).serialized() 163 | ).serialized() 164 | 165 | self.assertEqual(after_composition, expected_result) 166 | 167 | def test_from_input(self): 168 | input_add_data = io.StringIO( 169 | '{' 170 | '"description":"Go to Camelot",' 171 | '"entry":"20180618T030242Z",' 172 | '"status":"pending",' 173 | '"start":"20181012T110605Z",' 174 | '"uuid":"daa3ff05-f716-482e-bc35-3e1601e50778"' 175 | '}') 176 | 177 | input_modify_data = io.StringIO( 178 | '\n'.join([ 179 | input_add_data.getvalue(), 180 | ( 181 | '{' 182 | '"description":"Go to Camelot again",' 183 | '"entry":"20180618T030242Z",' 184 | '"status":"pending",' 185 | '"start":"20181012T110605Z",' 186 | '"uuid":"daa3ff05-f716-482e-bc35-3e1601e50778"' 187 | '}' 188 | ), 189 | ]), 190 | ) 191 | 192 | on_add_task = Task.from_input(input_file=input_add_data) 193 | assert on_add_task.get('description') == "Go to Camelot" 194 | assert on_add_task.get('entry') == datetime.datetime(2018, 6, 18, 3, 2, 42, tzinfo=tzutc()) 195 | assert on_add_task.get('status') == "pending" 196 | assert on_add_task.get('start') == datetime.datetime(2018, 10, 12, 11, 6, 5, tzinfo=tzutc()) 197 | assert on_add_task.get('uuid') == uuid.UUID("daa3ff05-f716-482e-bc35-3e1601e50778") 198 | 199 | on_modify_task = Task.from_input(input_file=input_modify_data, modify=True) 200 | assert on_modify_task.get('description') == "Go to Camelot again" 201 | assert on_modify_task.get('entry') == datetime.datetime(2018, 6, 18, 3, 2, 42, tzinfo=tzutc()) 202 | assert on_modify_task.get('status') == "pending" 203 | assert on_modify_task.get('start') == datetime.datetime(2018, 10, 12, 11, 6, 5, tzinfo=tzutc()) 204 | assert on_modify_task.get('uuid') == uuid.UUID("daa3ff05-f716-482e-bc35-3e1601e50778") 205 | -------------------------------------------------------------------------------- /taskw/utils.py: -------------------------------------------------------------------------------- 1 | """ Various utilties """ 2 | 3 | import datetime 4 | import re 5 | from collections import OrderedDict 6 | from operator import itemgetter 7 | 8 | import dateutil.tz 9 | import pytz 10 | 11 | from distutils.version import LooseVersion 12 | 13 | 14 | DATE_FORMAT = '%Y%m%dT%H%M%SZ' 15 | 16 | 17 | encode_replacements = OrderedDict([ 18 | ('\\', '\\\\'), 19 | ('\"', '&dquot;'), 20 | ('"', '&dquot;'), 21 | ('[', '&open;'), 22 | (']', '&close;'), 23 | ('\n', ' '), 24 | ('/', '\\/'), 25 | ]) 26 | 27 | encode_replacements_experimental = OrderedDict([ 28 | ('\"', '&dquot;'), 29 | ('"', '&dquot;'), 30 | ('[', '&open;'), 31 | (']', '&close;'), 32 | ]) 33 | 34 | decode_replacements = OrderedDict([ 35 | [v, k] for k, v in encode_replacements.items() 36 | if k not in ('\n') # We skip these. 37 | ]) 38 | 39 | logical_replacements = OrderedDict([ 40 | ('?', '\\?'), 41 | ('+', '\\+'), 42 | ('(', '\\('), 43 | (')', '\\)'), 44 | ('[', '\\['), 45 | (']', '\\]'), 46 | ('{', '\\{'), 47 | ('}', '\\}'), 48 | ]) 49 | 50 | 51 | def encode_task_value(key, value, query=False): 52 | if value is None: 53 | value = '' 54 | elif isinstance(value, datetime.datetime): 55 | if not value.tzinfo: 56 | # Dates not having timezone information should be 57 | # assumed to be in local time 58 | value = value.replace(tzinfo=dateutil.tz.tzlocal()) 59 | # All times should be converted to UTC before serializing 60 | value = value.astimezone(pytz.utc).strftime(DATE_FORMAT) 61 | elif isinstance(value, datetime.date): 62 | value = value.strftime(DATE_FORMAT) 63 | elif isinstance(value, str): 64 | if query: 65 | # In some contexts, parentheses are interpreted for use in 66 | # logical expressions. They must *sometimes* be escaped. 67 | for left, right in logical_replacements.items(): 68 | # don't replace '?' if this is an exact match 69 | if left == '?' and '.' not in key: 70 | continue 71 | value = value.replace(left, right) 72 | else: 73 | for unsafe, safe in encode_replacements_experimental.items(): 74 | value = value.replace(unsafe, safe) 75 | else: 76 | value = str(value) 77 | return value 78 | 79 | 80 | def encode_query(value, version, query=True): 81 | args = [] 82 | 83 | if isinstance(value, dict): 84 | value = value.items() 85 | 86 | for k, v in value: 87 | if isinstance(v, list): 88 | args.append( 89 | "( %s )" % (" %s " % k).join([ 90 | encode_query([item], version, query=False)[0] for item in v 91 | ]) 92 | ) 93 | else: 94 | if k.endswith(".is") and version >= LooseVersion('2.4'): 95 | args.append( 96 | '%s == "%s"' % ( 97 | k[:-3], 98 | encode_task_value(k, v, query=query) 99 | ) 100 | ) 101 | else: 102 | args.append( 103 | '%s:%s' % ( 104 | k, 105 | encode_task_value(k, v, query=query) 106 | ) 107 | ) 108 | 109 | return args 110 | 111 | 112 | def clean_task(task): 113 | """ Clean a task by replacing any dangerous characters """ 114 | return task 115 | 116 | 117 | def encode_task_experimental(task): 118 | """ Convert a dict-like task to its string representation 119 | Used for adding a task via `task add` 120 | """ 121 | # First, clean the task: 122 | task = task.copy() 123 | if 'tags' in task: 124 | task['tags'] = ','.join(task['tags']) 125 | for k in task: 126 | task[k] = encode_task_value(k, task[k]) 127 | 128 | # Then, format it as a string 129 | return [ 130 | "%s:\"%s\"" % (k, v) if v else "%s:" % (k, ) 131 | for k, v in sorted(task.items(), key=itemgetter(0)) 132 | ] 133 | 134 | 135 | def encode_task(task): 136 | """ Convert a dict-like task to its string representation """ 137 | # First, clean the task: 138 | task = task.copy() 139 | if 'tags' in task: 140 | task['tags'] = ','.join(task['tags']) 141 | for k in task: 142 | for unsafe, safe in encode_replacements.items(): 143 | if isinstance(task[k], str): 144 | task[k] = task[k].replace(unsafe, safe) 145 | 146 | if isinstance(task[k], datetime.datetime): 147 | task[k] = task[k].strftime("%Y%m%dT%M%H%SZ") 148 | 149 | # Then, format it as a string 150 | return "[%s]\n" % " ".join([ 151 | "%s:\"%s\"" % (k, v) 152 | for k, v in sorted(task.items(), key=itemgetter(0)) 153 | ]) 154 | 155 | 156 | def decode_task(line): 157 | """ Parse a single record (task) from a task database file. 158 | 159 | I don't understand why they don't just use JSON or YAML. But 160 | that's okay. 161 | 162 | >>> decode_task('[description:"Make a python API for taskwarrior"]') 163 | {'description': 'Make a python API for taskwarrior'} 164 | 165 | """ 166 | 167 | task = {} 168 | for key, value in re.findall(r'(\w+):"(.*?)(?>> w = TaskWarrior() 119 | >>> tasks = w.load_tasks() 120 | >>> tasks.keys() 121 | ['completed', 'pending'] 122 | >>> type(tasks['pending']) 123 | 124 | >>> type(tasks['pending'][0]) 125 | 126 | """ 127 | 128 | @abc.abstractmethod 129 | def task_add(self, description, tags=None, **kw): 130 | """ Add a new task. 131 | 132 | Takes any of the keywords allowed by taskwarrior like proj or prior. 133 | """ 134 | pass 135 | 136 | @abc.abstractmethod 137 | def task_done(self, **kw): 138 | pass 139 | 140 | @abc.abstractmethod 141 | def task_delete(self, **kw): 142 | pass 143 | 144 | @abc.abstractmethod 145 | def _load_task(self, **kw): 146 | pass 147 | 148 | @abc.abstractmethod 149 | def task_update(self, task): 150 | pass 151 | 152 | @abc.abstractmethod 153 | def get_task(self, **kw): 154 | pass 155 | 156 | def filter_by(self, func): 157 | tasks = self.load_tasks() 158 | filtered = filter(func, tasks) 159 | return filtered 160 | 161 | @classmethod 162 | def load_config(cls, config_filename=TASKRC, overrides=None): 163 | """ Load ~/.taskrc into a python dict 164 | 165 | >>> config = TaskWarrior.load_config() 166 | >>> config['data']['location'] 167 | '/home/threebean/.task' 168 | >>> config['_forcecolor'] 169 | 'yes' 170 | 171 | """ 172 | return TaskRc(config_filename, overrides=overrides) 173 | 174 | @abc.abstractmethod 175 | def task_start(self, **kw): 176 | pass 177 | 178 | @abc.abstractmethod 179 | def task_stop(self, **kw): 180 | pass 181 | 182 | 183 | class TaskWarriorDirect(TaskWarriorBase): 184 | """ Interacts with taskwarrior by directly manipulating the ~/.task/ db. 185 | 186 | This is the deprecated implementation and will be phased out in 187 | time due to taskwarrior's guidelines: http://bit.ly/16I9VN4 188 | 189 | See https://github.com/ralphbean/taskw/pull/15 for discussion 190 | and https://github.com/ralphbean/taskw/issues/30 for more. 191 | """ 192 | 193 | def sync(self): 194 | raise NotImplementedError( 195 | "You must use TaskWarriorShellout to use 'sync'" 196 | ) 197 | 198 | def load_tasks(self, command='all'): 199 | def _load_tasks(filename): 200 | filename = os.path.join(self.config['data']['location'], filename) 201 | filename = os.path.expanduser(filename) 202 | with open(filename, 'r') as f: 203 | lines = f.readlines() 204 | 205 | return list(map(taskw.utils.decode_task, lines)) 206 | 207 | return dict( 208 | (db, _load_tasks(DataFile.filename(db))) 209 | for db in Command.files(command) 210 | ) 211 | 212 | def get_task(self, **kw): 213 | line, task = self._load_task(**kw) 214 | 215 | id = None 216 | # The ID going back only makes sense if the task is pending. 217 | if Status.is_pending(task['status']): 218 | id = line 219 | 220 | return id, task 221 | 222 | def _load_task(self, **kw): 223 | valid_keys = set(['id', 'uuid', 'description']) 224 | id_keys = valid_keys.intersection(kw.keys()) 225 | 226 | if len(id_keys) != 1: 227 | raise KeyError("Only 1 ID keyword argument may be specified") 228 | 229 | key = list(id_keys)[0] 230 | if key not in valid_keys: 231 | raise KeyError("Argument must be one of %r" % valid_keys) 232 | 233 | line = None 234 | task = dict() 235 | 236 | # If the key is an id, assume the task is pending (completed tasks 237 | # don't have IDs). 238 | if key == 'id': 239 | tasks = self.load_tasks(command=Status.PENDING) 240 | line = kw[key] 241 | 242 | if len(tasks[Status.PENDING]) >= line: 243 | task = tasks[Status.PENDING][line - 1] 244 | 245 | else: 246 | # Search all tasks for the specified key. 247 | tasks = self.load_tasks(command=Command.ALL) 248 | 249 | matching = list(filter( 250 | lambda t: t.get(key, None) == kw[key], 251 | sum(tasks.values(), []) 252 | )) 253 | 254 | if matching: 255 | task = matching[0] 256 | line = tasks[Status.to_file(task['status'])].index(task) + 1 257 | 258 | return line, task 259 | 260 | def task_add(self, description, tags=None, **kw): 261 | """ Add a new task. 262 | 263 | Takes any of the keywords allowed by taskwarrior like proj or prior. 264 | """ 265 | 266 | task = self._stub_task(description, tags, **kw) 267 | 268 | task['status'] = Status.PENDING 269 | 270 | # TODO -- check only valid keywords 271 | 272 | if not 'entry' in task: 273 | task['entry'] = str(int(time.time())) 274 | 275 | if not 'uuid' in task: 276 | task['uuid'] = str(uuid.uuid4()) 277 | 278 | id = self._task_add(task, Status.PENDING) 279 | task['id'] = id 280 | return task 281 | 282 | def task_done(self, **kw): 283 | """ 284 | Marks a pending task as done, optionally specifying a completion 285 | date with the 'end' argument. 286 | """ 287 | def validate(task): 288 | if not Status.is_pending(task['status']): 289 | raise ValueError("Task is not pending.") 290 | 291 | return self._task_change_status(Status.COMPLETED, validate, **kw) 292 | 293 | def task_update(self, task): 294 | line, _task = self._load_task(uuid=task['uuid']) 295 | 296 | if 'id' in task: 297 | del task['id'] 298 | 299 | # Delete None values (treat them as deleting values) 300 | # https://github.com/ralphbean/taskw/pull/70 301 | items = list(task.items()) # listify generator for py3 support. 302 | for k, v in items: 303 | if v is None: 304 | task.pop(k) 305 | if k in _task: 306 | _task.pop(k) 307 | 308 | _task.update(task) 309 | self._task_replace(line, Status.to_file(task['status']), _task) 310 | return line, _task 311 | 312 | def task_delete(self, **kw): 313 | """ 314 | Marks a task as deleted, optionally specifying a completion 315 | date with the 'end' argument. 316 | """ 317 | def validate(task): 318 | if task['status'] == Status.DELETED: 319 | raise ValueError("Task is already deleted.") 320 | 321 | return self._task_change_status(Status.DELETED, validate, **kw) 322 | 323 | def task_start(self, **kw): 324 | """ Marks a task as started. """ 325 | raise NotImplementedError() 326 | 327 | def task_stop(self, **kw): 328 | """ Marks a task as stopped. """ 329 | raise NotImplementedError() 330 | 331 | def filter_tasks(self, filter_dict): 332 | raise NotImplementedError() 333 | 334 | def _task_replace(self, id, category, task): 335 | def modification(lines): 336 | lines[id - 1] = taskw.utils.encode_task(task) 337 | return lines 338 | 339 | # FIXME write to undo.data 340 | self._apply_modification(id, category, modification) 341 | 342 | def _task_remove(self, id, category): 343 | def modification(lines): 344 | del lines[id - 1] 345 | return lines 346 | 347 | # FIXME write to undo.data 348 | self._apply_modification(id, category, modification) 349 | 350 | def _apply_modification(self, id, category, modification): 351 | filename = DataFile.filename(category) 352 | filename = os.path.join(self.config['data']['location'], filename) 353 | filename = os.path.expanduser(filename) 354 | 355 | with open(filename, "r") as f: 356 | lines = f.readlines() 357 | 358 | lines = modification(lines) 359 | 360 | with open(filename, "w") as f: 361 | f.writelines(lines) 362 | 363 | def _task_add(self, task, category): 364 | location = self.config['data']['location'] 365 | location = os.path.expanduser(location) 366 | filename = category + '.data' 367 | 368 | # Append the task 369 | with open(os.path.join(location, filename), "a") as f: 370 | f.writelines([taskw.utils.encode_task(task)]) 371 | 372 | # FIXME - this gets written when a task is completed. incorrect. 373 | # Add to undo.data 374 | with open(os.path.join(location, 'undo.data'), "a") as f: 375 | f.write("time %s\n" % str(int(time.time()))) 376 | f.write("new %s" % taskw.utils.encode_task(task)) 377 | f.write("---\n") 378 | 379 | with open(os.path.join(location, filename), "r") as f: 380 | # The 'id' of this latest added task. 381 | return len(f.readlines()) 382 | 383 | def _task_change_status(self, status, validation, **kw): 384 | line, task = self._load_task(**kw) 385 | validation(task) 386 | original_status = task['status'] 387 | 388 | task['status'] = status 389 | task['end'] = kw.get('end') or str(int(time.time())) 390 | 391 | self._task_add(task, Status.to_file(status)) 392 | self._task_remove(line, Status.to_file(original_status)) 393 | return task 394 | 395 | # This regex is used to parse UUIDs from messages output 396 | # by the shell client when creating tasks. 397 | UUID_REGEX = '[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}' 398 | 399 | class TaskWarriorShellout(TaskWarriorBase): 400 | """ Interacts with taskwarrior by invoking shell commands. 401 | 402 | This is currently the supported version and should be considered stable. 403 | 404 | See https://github.com/ralphbean/taskw/pull/15 for discussion 405 | and https://github.com/ralphbean/taskw/issues/30 for more. 406 | """ 407 | DEFAULT_CONFIG_OVERRIDES = { 408 | # 'verbose' must be the first param. Otherwise due to 409 | # https://github.com/GothenburgBitFactory/taskwarrior/issues/1953 410 | # adding tasks will not work in taskwarrior 2.5.3. 411 | 'verbose': 'nothing', 412 | 'json': { 413 | 'array': 'TRUE' 414 | }, 415 | 'confirmation': 'no', 416 | 'dependency': { 417 | 'confirmation': 'no', 418 | }, 419 | 'recurrence': { 420 | 'confirmation': 'no' 421 | }, 422 | } 423 | 424 | def __init__( 425 | self, 426 | config_filename=TASKRC, 427 | config_overrides=None, 428 | marshal=False, 429 | ): 430 | super(TaskWarriorShellout, self).__init__(config_filename) 431 | self.config_overrides = config_overrides if config_overrides else {} 432 | self._marshal = marshal 433 | self.config = TaskRc(config_filename, overrides=config_overrides) 434 | 435 | if self.get_version() >= LooseVersion('2.4'): 436 | self.DEFAULT_CONFIG_OVERRIDES['verbose'] = 'new-uuid' 437 | # Combination of 438 | # https://github.com/GothenburgBitFactory/taskwarrior/issues/1953 439 | # and dictionaries random order may cause task add failures in 440 | # Python versions before 3.7 441 | if (self.get_version() >= LooseVersion('2.5.3') and 442 | sys.hexversion < 0x03070000): 443 | warnings.once( 444 | "Python < 3.7 with TaskWarrior => 2.5.3 is not suppoprted. " 445 | "Task addition may fail.") 446 | 447 | def get_configuration_override_args(self): 448 | config_overrides = self.DEFAULT_CONFIG_OVERRIDES.copy() 449 | config_overrides.update(self.config_overrides) 450 | return taskw.utils.convert_dict_to_override_args(config_overrides) 451 | 452 | def _execute(self, *args): 453 | """ Execute a given taskwarrior command with arguments 454 | 455 | Returns a 2-tuple of stdout and stderr (respectively). 456 | 457 | """ 458 | command = ( 459 | [ 460 | 'task', 461 | ] 462 | + self.get_configuration_override_args() 463 | + [str(arg) for arg in args] 464 | ) 465 | env = os.environ.copy() 466 | env['TASKRC'] = self.config_filename 467 | 468 | # subprocess is expecting bytestrings only, so nuke unicode if present 469 | # and remove control characters 470 | for i in range(len(command)): 471 | if isinstance(command[i], str): 472 | command[i] = ( 473 | taskw.utils.clean_ctrl_chars(command[i].encode('utf-8'))) 474 | 475 | try: 476 | proc = subprocess.Popen( 477 | command, 478 | env=env, 479 | stdout=subprocess.PIPE, 480 | stderr=subprocess.PIPE, 481 | ) 482 | stdout, stderr = proc.communicate() 483 | except FileNotFoundError: 484 | raise FileNotFoundError( 485 | "Unable to find the 'task' command-line tool." 486 | ) 487 | 488 | if proc.returncode != 0: 489 | raise TaskwarriorError(command, stderr, stdout, proc.returncode) 490 | 491 | # We should get bytes from the outside world. Turn those into unicode 492 | # as soon as we can. 493 | # Everything going into and coming out of taskwarrior *should* be 494 | # utf-8, but there are weird edge cases where something totally unusual 495 | # made it in.. so we need to be able to handle (or at least try to 496 | # handle) whatever. Kitchen tries its best. 497 | try: 498 | stdout = stdout.decode(self.config.get('encoding', 'utf-8')) 499 | except UnicodeDecodeError as e: 500 | stdout = kitchen.text.converters.to_unicode(stdout) 501 | try: 502 | stderr = stderr.decode(self.config.get('encoding', 'utf-8')) 503 | except UnicodeDecodeError as e: 504 | stderr = kitchen.text.converters.to_unicode(stderr) 505 | 506 | # strip any crazy terminal escape characters like bells, backspaces, 507 | # and form feeds 508 | for c in ('\a', '\b', '\f', ''): 509 | stdout = stdout.replace(c, '?') 510 | stderr = stderr.replace(c, '?') 511 | 512 | return stdout, stderr 513 | 514 | def _get_json(self, *args): 515 | return json.loads(self._execute(*args)[0]) 516 | 517 | def _get_task_objects(self, *args): 518 | json = self._get_json(*args) 519 | if isinstance(json, dict): 520 | return self._get_task_object(json) 521 | value = [self._get_task_object(j) for j in json] 522 | return value 523 | 524 | def _get_task_object(self, obj): 525 | if self._marshal: 526 | return Task(obj, udas=self.config.get_udas()) 527 | return obj 528 | 529 | def _stub_task(self, description, tags=None, **kw): 530 | """ Given a description, stub out a task dict. """ 531 | 532 | # If whitespace is not removed here, TW will do it when we pass the 533 | # task to it. 534 | task = {"description": description.strip()} 535 | 536 | # Allow passing "tags" in as part of kw. 537 | if 'tags' in kw and tags is None: 538 | task['tags'] = tags 539 | del(kw['tags']) 540 | 541 | if tags is not None: 542 | task['tags'] = tags 543 | 544 | task.update(kw) 545 | 546 | if self._marshal: 547 | return Task.from_stub(task, udas=self.config.get_udas()) 548 | 549 | return task 550 | 551 | @classmethod 552 | def can_use(cls): 553 | """ Returns true if runtime requirements of experimental mode are met 554 | """ 555 | try: 556 | return cls.get_version() > LooseVersion('2') 557 | except FileNotFoundError: 558 | # FileNotFound is raised if subprocess.Popen fails to find 559 | # the executable. 560 | return False 561 | 562 | @classmethod 563 | def get_version(cls): 564 | try: 565 | taskwarrior_version = subprocess.Popen( 566 | ['task', '--version'], 567 | stdout=subprocess.PIPE 568 | ).communicate()[0] 569 | except FileNotFoundError: 570 | raise FileNotFoundError( 571 | "Unable to find the 'task' command-line tool." 572 | ) 573 | return LooseVersion(taskwarrior_version.decode()) 574 | 575 | def sync(self, init=False): 576 | if self.get_version() < LooseVersion('2.3'): 577 | raise UnsupportedVersionException( 578 | "'sync' requires version 2.3 of taskwarrior or later." 579 | ) 580 | if init is True: 581 | self._execute('sync', 'init') 582 | else: 583 | self._execute('sync') 584 | 585 | def load_tasks(self, command='all'): 586 | """ Returns a dictionary of tasks for a list of command.""" 587 | 588 | results = dict( 589 | (db, self._get_task_objects('status:%s' % db, 'export')) 590 | for db in Command.files(command) 591 | ) 592 | 593 | # 'waiting' tasks are returned separately from 'pending' tasks 594 | # Here we merge the waiting list back into the pending list. 595 | if 'pending' in results: 596 | results['pending'].extend( 597 | self._get_task_objects('status:waiting', 'export')) 598 | 599 | return results 600 | 601 | def filter_tasks(self, filter_dict): 602 | """ Return a filtered list of tasks from taskwarrior. 603 | 604 | Filter dict should be a dictionary mapping filter constraints 605 | with their values. For example, to return only pending tasks, 606 | you could use:: 607 | 608 | {'status': 'pending'} 609 | 610 | Or, to return tasks that have the word "Abjad" in their description 611 | that are also pending:: 612 | 613 | { 614 | 'status': 'pending', 615 | 'description.contains': 'Abjad', 616 | } 617 | 618 | Filters can be quite complex, and are documented on Taskwarrior's 619 | website. 620 | 621 | """ 622 | query_args = taskw.utils.encode_query(filter_dict, self.get_version()) 623 | return self._get_task_objects( 624 | *(query_args + ['export']) 625 | ) 626 | 627 | def get_task(self, **kw): 628 | task = dict() 629 | task_id = None 630 | task_id, task = self._load_task(**kw) 631 | id = None 632 | 633 | # The ID going back only makes sense if the task is pending. 634 | if 'status' in task: 635 | if Status.is_pending(task['status']): 636 | id = task_id 637 | 638 | return id, task 639 | 640 | def _load_task(self, **kwargs): 641 | if len(kwargs) > 1: 642 | raise KeyError( 643 | "Only one keyword argument may be specified" 644 | ) 645 | 646 | search = [] 647 | for key, value in kwargs.items(): 648 | if key not in ['id', 'uuid', 'description']: 649 | search.append( 650 | '%s:%s' % ( 651 | key, 652 | value, 653 | ) 654 | ) 655 | elif key == 'description' and '(bw)' in value: 656 | search.append( 657 | value[4:] 658 | ) 659 | else: 660 | search = [value] 661 | 662 | task = self._get_task_objects(*(search + ['export'])) 663 | 664 | if task: 665 | if isinstance(task, list): 666 | # Multiple items returned from search, return just the 1st 667 | task = task[0] 668 | return task['id'], task 669 | 670 | return None, dict() 671 | 672 | def task_add(self, description, tags=None, **kw): 673 | """ Add a new task. 674 | 675 | Takes any of the keywords allowed by taskwarrior like proj or prior. 676 | """ 677 | task = self._stub_task(description, tags, **kw) 678 | 679 | # Check if there are annotations, if so remove them from the 680 | # task and add them after we've added the task. 681 | annotations = self._extract_annotations_from_task(task) 682 | 683 | # With older versions of taskwarrior, you can specify whatever uuid you 684 | # want when adding a task. 685 | if self.get_version() < LooseVersion('2.4'): 686 | task['uuid'] = str(uuid.uuid4()) 687 | elif 'uuid' in task: 688 | del task['uuid'] 689 | 690 | if self._marshal: 691 | args = taskw.utils.encode_task_experimental(task.serialized()) 692 | else: 693 | args = taskw.utils.encode_task_experimental(task) 694 | 695 | stdout, stderr = self._execute('add', *args) 696 | 697 | # However, in 2.4 and later, you cannot specify whatever uuid you want 698 | # when adding a task. Instead, you have to specify rc.verbose=new-uuid 699 | # and then parse the assigned uuid out from stdout. 700 | if self.get_version() >= LooseVersion('2.4'): 701 | task['uuid'] = re.search(UUID_REGEX, stdout).group(0) 702 | 703 | id, added_task = self.get_task(uuid=task['uuid']) 704 | 705 | # Check if 'uuid' is in the task we just added. 706 | if not 'uuid' in added_task: 707 | raise KeyError( 708 | 'Error encountered while creating task;' 709 | 'STDOUT: %s; STDERR: %s' % ( 710 | stdout, 711 | stderr, 712 | ) 713 | ) 714 | 715 | if annotations and 'uuid' in added_task: 716 | for annotation in annotations: 717 | self.task_annotate(added_task, annotation) 718 | 719 | id, added_task = self.get_task(uuid=added_task['uuid']) 720 | return added_task 721 | 722 | def task_annotate(self, task, annotation): 723 | """ Annotates a task. """ 724 | self._execute( 725 | task['uuid'], 726 | 'annotate', 727 | '--', 728 | annotation 729 | ) 730 | id, annotated_task = self.get_task(uuid=task['uuid']) 731 | return annotated_task 732 | 733 | def task_denotate(self, task, annotation): 734 | """ Removes an annotation from a task. """ 735 | self._execute( 736 | task['uuid'], 737 | 'denotate', 738 | '--', 739 | annotation 740 | ) 741 | id, denotated_task = self.get_task(uuid=task['uuid']) 742 | return denotated_task 743 | 744 | def task_done(self, **kw): 745 | if not kw: 746 | raise KeyError('No key was passed.') 747 | 748 | id, task = self.get_task(**kw) 749 | 750 | if not Status.is_pending(task['status']): 751 | raise ValueError("Task is not pending.") 752 | 753 | self._execute(id, 'done') 754 | return self.get_task(uuid=task['uuid'])[1] 755 | 756 | def task_update(self, task): 757 | if 'uuid' not in task: 758 | raise KeyError('Task must have a UUID.') 759 | # 'Legacy' causes us to handle this task as if it were an 760 | # old-style task -- just a standard dictionary 761 | legacy = True 762 | 763 | if isinstance(task, Task): 764 | # Let's pre-serialize taskw.task.Task instances 765 | task_uuid = str(task['uuid']) 766 | task = task.serialized_changes(keep=True) 767 | legacy = False 768 | else: 769 | task_uuid = task['uuid'] 770 | 771 | id, original_task = self.get_task(uuid=task_uuid) 772 | 773 | if 'id' in task: 774 | del task['id'] 775 | 776 | task_to_modify = copy.deepcopy(task) 777 | 778 | task_to_modify.pop('uuid', None) 779 | task_to_modify.pop('id', None) 780 | # Urgency field is auto-generated and cannot be modified. 781 | task_to_modify.pop('urgency', None) 782 | 783 | # Only handle annotation differences if this is an old-style 784 | # task, or if the task itself says annotations have changed. 785 | annotations_to_delete = set() 786 | annotations_to_create = set() 787 | if legacy or 'annotations' in task_to_modify: 788 | # Check if there are annotations, if so, look if they are 789 | # in the existing task, otherwise annotate the task to add them. 790 | ttm_annotations = taskw.utils.annotation_list_to_comparison_map( 791 | self._extract_annotations_from_task(task_to_modify) 792 | ) 793 | original_annotations = ( 794 | taskw.utils.annotation_list_to_comparison_map( 795 | self._extract_annotations_from_task(original_task) 796 | ) 797 | ) 798 | 799 | new_annotations = set(ttm_annotations.keys()) 800 | existing_annotations = set(original_annotations.keys()) 801 | 802 | annotations_to_delete = existing_annotations - new_annotations 803 | annotations_to_create = new_annotations - existing_annotations 804 | 805 | if 'annotations' in task_to_modify: 806 | del task_to_modify['annotations'] 807 | 808 | modification = taskw.utils.encode_task_experimental(task_to_modify) 809 | # Only try to modify the task if there are changes to post here 810 | # (changes *might* just be in annotations). 811 | if modification: 812 | self._execute(task_uuid, 'modify', *modification) 813 | 814 | # If there are no existing annotations, add the new ones 815 | if legacy or annotations_to_delete or annotations_to_create: 816 | ttm_annotations.update(original_annotations) 817 | for annotation_key in annotations_to_create: 818 | self.task_annotate( 819 | original_task, 820 | ttm_annotations[annotation_key] 821 | ) 822 | for annotation_key in annotations_to_delete: 823 | self.task_denotate( 824 | original_task, 825 | ttm_annotations[annotation_key] 826 | ) 827 | 828 | return self.get_task(uuid=task_uuid) 829 | 830 | def task_delete(self, **kw): 831 | """ Marks a task as deleted. """ 832 | 833 | id, task = self.get_task(**kw) 834 | 835 | if task['status'] == Status.DELETED: 836 | raise ValueError("Task is already deleted.") 837 | 838 | self._execute(task['uuid'], 'delete') 839 | return self.get_task(uuid=task['uuid'])[1] 840 | 841 | def task_start(self, **kw): 842 | """ Marks a task as started. """ 843 | 844 | id, task = self.get_task(**kw) 845 | 846 | self._execute(id, 'start') 847 | return self.get_task(uuid=task['uuid'])[1] 848 | 849 | def task_stop(self, **kw): 850 | """ Marks a task as stopped. """ 851 | 852 | id, task = self.get_task(**kw) 853 | 854 | self._execute(id, 'stop') 855 | return self.get_task(uuid=task['uuid'])[1] 856 | 857 | def task_info(self, **kw): 858 | id, task = self.get_task(**kw) 859 | out, err = self._execute(id, 'info') 860 | if err: 861 | return err 862 | return out 863 | 864 | 865 | class DataFile(object): 866 | """ Encapsulates data file names. """ 867 | PENDING = 'pending' 868 | COMPLETED = 'completed' 869 | 870 | @classmethod 871 | def filename(cls, name): 872 | return "%s.data" % name 873 | 874 | 875 | class Command(object): 876 | """ Encapsulates available commands. """ 877 | PENDING = 'pending' 878 | COMPLETED = 'completed' 879 | ALL = 'all' 880 | 881 | @classmethod 882 | def files(cls, command): 883 | known_commands = { 884 | Command.PENDING: [DataFile.PENDING], 885 | Command.COMPLETED: [DataFile.COMPLETED], 886 | Command.ALL: [DataFile.PENDING, DataFile.COMPLETED] 887 | } 888 | 889 | if not command in known_commands: 890 | raise ValueError( 891 | "Unknown command, %s. Command must be one of %s." % 892 | (command, known_commands.keys())) 893 | 894 | return known_commands[command] 895 | 896 | 897 | class Status(object): 898 | """ Encapsulates task status values. """ 899 | PENDING = 'pending' 900 | COMPLETED = 'completed' 901 | DELETED = 'deleted' 902 | WAITING = 'waiting' 903 | 904 | @classmethod 905 | def is_pending(cls, status): 906 | """ Identifies if the specified status is a 'pending' state. """ 907 | return status == Status.PENDING or status == Status.WAITING 908 | 909 | @classmethod 910 | def to_file(cls, status): 911 | """ Returns the file in which this task is stored. """ 912 | return { 913 | Status.PENDING: DataFile.PENDING, 914 | Status.WAITING: DataFile.PENDING, 915 | Status.COMPLETED: DataFile.COMPLETED, 916 | Status.DELETED: DataFile.COMPLETED 917 | }[status] 918 | 919 | 920 | class UnsupportedVersionException(object): 921 | pass 922 | 923 | 924 | # It is not really experimental anymore, but we provide this rename for 925 | # backwards compatibility. It will eventually be removed. 926 | TaskWarriorExperimental = TaskWarriorShellout 927 | 928 | 929 | # Set a default based on what is available on the system. 930 | if TaskWarriorShellout.can_use(): 931 | TaskWarrior = TaskWarriorShellout 932 | else: 933 | TaskWarrior = TaskWarriorDirect 934 | -------------------------------------------------------------------------------- /LICENSE.txt: -------------------------------------------------------------------------------- 1 | GNU GENERAL PUBLIC LICENSE 2 | Version 3, 29 June 2007 3 | 4 | Copyright (C) 2007 Free Software Foundation, Inc. 5 | Everyone is permitted to copy and distribute verbatim copies 6 | of this license document, but changing it is not allowed. 7 | 8 | Preamble 9 | 10 | The GNU General Public License is a free, copyleft license for 11 | software and other kinds of works. 12 | 13 | The licenses for most software and other practical works are designed 14 | to take away your freedom to share and change the works. By contrast, 15 | the GNU General Public License is intended to guarantee your freedom to 16 | share and change all versions of a program--to make sure it remains free 17 | software for all its users. We, the Free Software Foundation, use the 18 | GNU General Public License for most of our software; it applies also to 19 | any other work released this way by its authors. You can apply it to 20 | your programs, too. 21 | 22 | When we speak of free software, we are referring to freedom, not 23 | price. Our General Public Licenses are designed to make sure that you 24 | have the freedom to distribute copies of free software (and charge for 25 | them if you wish), that you receive source code or can get it if you 26 | want it, that you can change the software or use pieces of it in new 27 | free programs, and that you know you can do these things. 28 | 29 | To protect your rights, we need to prevent others from denying you 30 | these rights or asking you to surrender the rights. Therefore, you have 31 | certain responsibilities if you distribute copies of the software, or if 32 | you modify it: responsibilities to respect the freedom of others. 33 | 34 | For example, if you distribute copies of such a program, whether 35 | gratis or for a fee, you must pass on to the recipients the same 36 | freedoms that you received. You must make sure that they, too, receive 37 | or can get the source code. And you must show them these terms so they 38 | know their rights. 39 | 40 | Developers that use the GNU GPL protect your rights with two steps: 41 | (1) assert copyright on the software, and (2) offer you this License 42 | giving you legal permission to copy, distribute and/or modify it. 43 | 44 | For the developers' and authors' protection, the GPL clearly explains 45 | that there is no warranty for this free software. For both users' and 46 | authors' sake, the GPL requires that modified versions be marked as 47 | changed, so that their problems will not be attributed erroneously to 48 | authors of previous versions. 49 | 50 | Some devices are designed to deny users access to install or run 51 | modified versions of the software inside them, although the manufacturer 52 | can do so. This is fundamentally incompatible with the aim of 53 | protecting users' freedom to change the software. The systematic 54 | pattern of such abuse occurs in the area of products for individuals to 55 | use, which is precisely where it is most unacceptable. Therefore, we 56 | have designed this version of the GPL to prohibit the practice for those 57 | products. If such problems arise substantially in other domains, we 58 | stand ready to extend this provision to those domains in future versions 59 | of the GPL, as needed to protect the freedom of users. 60 | 61 | Finally, every program is threatened constantly by software patents. 62 | States should not allow patents to restrict development and use of 63 | software on general-purpose computers, but in those that do, we wish to 64 | avoid the special danger that patents applied to a free program could 65 | make it effectively proprietary. To prevent this, the GPL assures that 66 | patents cannot be used to render the program non-free. 67 | 68 | The precise terms and conditions for copying, distribution and 69 | modification follow. 70 | 71 | TERMS AND CONDITIONS 72 | 73 | 0. Definitions. 74 | 75 | "This License" refers to version 3 of the GNU General Public License. 76 | 77 | "Copyright" also means copyright-like laws that apply to other kinds of 78 | works, such as semiconductor masks. 79 | 80 | "The Program" refers to any copyrightable work licensed under this 81 | License. Each licensee is addressed as "you". "Licensees" and 82 | "recipients" may be individuals or organizations. 83 | 84 | To "modify" a work means to copy from or adapt all or part of the work 85 | in a fashion requiring copyright permission, other than the making of an 86 | exact copy. The resulting work is called a "modified version" of the 87 | earlier work or a work "based on" the earlier work. 88 | 89 | A "covered work" means either the unmodified Program or a work based 90 | on the Program. 91 | 92 | To "propagate" a work means to do anything with it that, without 93 | permission, would make you directly or secondarily liable for 94 | infringement under applicable copyright law, except executing it on a 95 | computer or modifying a private copy. Propagation includes copying, 96 | distribution (with or without modification), making available to the 97 | public, and in some countries other activities as well. 98 | 99 | To "convey" a work means any kind of propagation that enables other 100 | parties to make or receive copies. Mere interaction with a user through 101 | a computer network, with no transfer of a copy, is not conveying. 102 | 103 | An interactive user interface displays "Appropriate Legal Notices" 104 | to the extent that it includes a convenient and prominently visible 105 | feature that (1) displays an appropriate copyright notice, and (2) 106 | tells the user that there is no warranty for the work (except to the 107 | extent that warranties are provided), that licensees may convey the 108 | work under this License, and how to view a copy of this License. If 109 | the interface presents a list of user commands or options, such as a 110 | menu, a prominent item in the list meets this criterion. 111 | 112 | 1. Source Code. 113 | 114 | The "source code" for a work means the preferred form of the work 115 | for making modifications to it. "Object code" means any non-source 116 | form of a work. 117 | 118 | A "Standard Interface" means an interface that either is an official 119 | standard defined by a recognized standards body, or, in the case of 120 | interfaces specified for a particular programming language, one that 121 | is widely used among developers working in that language. 122 | 123 | The "System Libraries" of an executable work include anything, other 124 | than the work as a whole, that (a) is included in the normal form of 125 | packaging a Major Component, but which is not part of that Major 126 | Component, and (b) serves only to enable use of the work with that 127 | Major Component, or to implement a Standard Interface for which an 128 | implementation is available to the public in source code form. A 129 | "Major Component", in this context, means a major essential component 130 | (kernel, window system, and so on) of the specific operating system 131 | (if any) on which the executable work runs, or a compiler used to 132 | produce the work, or an object code interpreter used to run it. 133 | 134 | The "Corresponding Source" for a work in object code form means all 135 | the source code needed to generate, install, and (for an executable 136 | work) run the object code and to modify the work, including scripts to 137 | control those activities. However, it does not include the work's 138 | System Libraries, or general-purpose tools or generally available free 139 | programs which are used unmodified in performing those activities but 140 | which are not part of the work. For example, Corresponding Source 141 | includes interface definition files associated with source files for 142 | the work, and the source code for shared libraries and dynamically 143 | linked subprograms that the work is specifically designed to require, 144 | such as by intimate data communication or control flow between those 145 | subprograms and other parts of the work. 146 | 147 | The Corresponding Source need not include anything that users 148 | can regenerate automatically from other parts of the Corresponding 149 | Source. 150 | 151 | The Corresponding Source for a work in source code form is that 152 | same work. 153 | 154 | 2. Basic Permissions. 155 | 156 | All rights granted under this License are granted for the term of 157 | copyright on the Program, and are irrevocable provided the stated 158 | conditions are met. This License explicitly affirms your unlimited 159 | permission to run the unmodified Program. The output from running a 160 | covered work is covered by this License only if the output, given its 161 | content, constitutes a covered work. This License acknowledges your 162 | rights of fair use or other equivalent, as provided by copyright law. 163 | 164 | You may make, run and propagate covered works that you do not 165 | convey, without conditions so long as your license otherwise remains 166 | in force. You may convey covered works to others for the sole purpose 167 | of having them make modifications exclusively for you, or provide you 168 | with facilities for running those works, provided that you comply with 169 | the terms of this License in conveying all material for which you do 170 | not control copyright. Those thus making or running the covered works 171 | for you must do so exclusively on your behalf, under your direction 172 | and control, on terms that prohibit them from making any copies of 173 | your copyrighted material outside their relationship with you. 174 | 175 | Conveying under any other circumstances is permitted solely under 176 | the conditions stated below. Sublicensing is not allowed; section 10 177 | makes it unnecessary. 178 | 179 | 3. Protecting Users' Legal Rights From Anti-Circumvention Law. 180 | 181 | No covered work shall be deemed part of an effective technological 182 | measure under any applicable law fulfilling obligations under article 183 | 11 of the WIPO copyright treaty adopted on 20 December 1996, or 184 | similar laws prohibiting or restricting circumvention of such 185 | measures. 186 | 187 | When you convey a covered work, you waive any legal power to forbid 188 | circumvention of technological measures to the extent such circumvention 189 | is effected by exercising rights under this License with respect to 190 | the covered work, and you disclaim any intention to limit operation or 191 | modification of the work as a means of enforcing, against the work's 192 | users, your or third parties' legal rights to forbid circumvention of 193 | technological measures. 194 | 195 | 4. Conveying Verbatim Copies. 196 | 197 | You may convey verbatim copies of the Program's source code as you 198 | receive it, in any medium, provided that you conspicuously and 199 | appropriately publish on each copy an appropriate copyright notice; 200 | keep intact all notices stating that this License and any 201 | non-permissive terms added in accord with section 7 apply to the code; 202 | keep intact all notices of the absence of any warranty; and give all 203 | recipients a copy of this License along with the Program. 204 | 205 | You may charge any price or no price for each copy that you convey, 206 | and you may offer support or warranty protection for a fee. 207 | 208 | 5. Conveying Modified Source Versions. 209 | 210 | You may convey a work based on the Program, or the modifications to 211 | produce it from the Program, in the form of source code under the 212 | terms of section 4, provided that you also meet all of these conditions: 213 | 214 | a) The work must carry prominent notices stating that you modified 215 | it, and giving a relevant date. 216 | 217 | b) The work must carry prominent notices stating that it is 218 | released under this License and any conditions added under section 219 | 7. This requirement modifies the requirement in section 4 to 220 | "keep intact all notices". 221 | 222 | c) You must license the entire work, as a whole, under this 223 | License to anyone who comes into possession of a copy. This 224 | License will therefore apply, along with any applicable section 7 225 | additional terms, to the whole of the work, and all its parts, 226 | regardless of how they are packaged. This License gives no 227 | permission to license the work in any other way, but it does not 228 | invalidate such permission if you have separately received it. 229 | 230 | d) If the work has interactive user interfaces, each must display 231 | Appropriate Legal Notices; however, if the Program has interactive 232 | interfaces that do not display Appropriate Legal Notices, your 233 | work need not make them do so. 234 | 235 | A compilation of a covered work with other separate and independent 236 | works, which are not by their nature extensions of the covered work, 237 | and which are not combined with it such as to form a larger program, 238 | in or on a volume of a storage or distribution medium, is called an 239 | "aggregate" if the compilation and its resulting copyright are not 240 | used to limit the access or legal rights of the compilation's users 241 | beyond what the individual works permit. Inclusion of a covered work 242 | in an aggregate does not cause this License to apply to the other 243 | parts of the aggregate. 244 | 245 | 6. Conveying Non-Source Forms. 246 | 247 | You may convey a covered work in object code form under the terms 248 | of sections 4 and 5, provided that you also convey the 249 | machine-readable Corresponding Source under the terms of this License, 250 | in one of these ways: 251 | 252 | a) Convey the object code in, or embodied in, a physical product 253 | (including a physical distribution medium), accompanied by the 254 | Corresponding Source fixed on a durable physical medium 255 | customarily used for software interchange. 256 | 257 | b) Convey the object code in, or embodied in, a physical product 258 | (including a physical distribution medium), accompanied by a 259 | written offer, valid for at least three years and valid for as 260 | long as you offer spare parts or customer support for that product 261 | model, to give anyone who possesses the object code either (1) a 262 | copy of the Corresponding Source for all the software in the 263 | product that is covered by this License, on a durable physical 264 | medium customarily used for software interchange, for a price no 265 | more than your reasonable cost of physically performing this 266 | conveying of source, or (2) access to copy the 267 | Corresponding Source from a network server at no charge. 268 | 269 | c) Convey individual copies of the object code with a copy of the 270 | written offer to provide the Corresponding Source. This 271 | alternative is allowed only occasionally and noncommercially, and 272 | only if you received the object code with such an offer, in accord 273 | with subsection 6b. 274 | 275 | d) Convey the object code by offering access from a designated 276 | place (gratis or for a charge), and offer equivalent access to the 277 | Corresponding Source in the same way through the same place at no 278 | further charge. You need not require recipients to copy the 279 | Corresponding Source along with the object code. If the place to 280 | copy the object code is a network server, the Corresponding Source 281 | may be on a different server (operated by you or a third party) 282 | that supports equivalent copying facilities, provided you maintain 283 | clear directions next to the object code saying where to find the 284 | Corresponding Source. Regardless of what server hosts the 285 | Corresponding Source, you remain obligated to ensure that it is 286 | available for as long as needed to satisfy these requirements. 287 | 288 | e) Convey the object code using peer-to-peer transmission, provided 289 | you inform other peers where the object code and Corresponding 290 | Source of the work are being offered to the general public at no 291 | charge under subsection 6d. 292 | 293 | A separable portion of the object code, whose source code is excluded 294 | from the Corresponding Source as a System Library, need not be 295 | included in conveying the object code work. 296 | 297 | A "User Product" is either (1) a "consumer product", which means any 298 | tangible personal property which is normally used for personal, family, 299 | or household purposes, or (2) anything designed or sold for incorporation 300 | into a dwelling. In determining whether a product is a consumer product, 301 | doubtful cases shall be resolved in favor of coverage. For a particular 302 | product received by a particular user, "normally used" refers to a 303 | typical or common use of that class of product, regardless of the status 304 | of the particular user or of the way in which the particular user 305 | actually uses, or expects or is expected to use, the product. A product 306 | is a consumer product regardless of whether the product has substantial 307 | commercial, industrial or non-consumer uses, unless such uses represent 308 | the only significant mode of use of the product. 309 | 310 | "Installation Information" for a User Product means any methods, 311 | procedures, authorization keys, or other information required to install 312 | and execute modified versions of a covered work in that User Product from 313 | a modified version of its Corresponding Source. The information must 314 | suffice to ensure that the continued functioning of the modified object 315 | code is in no case prevented or interfered with solely because 316 | modification has been made. 317 | 318 | If you convey an object code work under this section in, or with, or 319 | specifically for use in, a User Product, and the conveying occurs as 320 | part of a transaction in which the right of possession and use of the 321 | User Product is transferred to the recipient in perpetuity or for a 322 | fixed term (regardless of how the transaction is characterized), the 323 | Corresponding Source conveyed under this section must be accompanied 324 | by the Installation Information. But this requirement does not apply 325 | if neither you nor any third party retains the ability to install 326 | modified object code on the User Product (for example, the work has 327 | been installed in ROM). 328 | 329 | The requirement to provide Installation Information does not include a 330 | requirement to continue to provide support service, warranty, or updates 331 | for a work that has been modified or installed by the recipient, or for 332 | the User Product in which it has been modified or installed. Access to a 333 | network may be denied when the modification itself materially and 334 | adversely affects the operation of the network or violates the rules and 335 | protocols for communication across the network. 336 | 337 | Corresponding Source conveyed, and Installation Information provided, 338 | in accord with this section must be in a format that is publicly 339 | documented (and with an implementation available to the public in 340 | source code form), and must require no special password or key for 341 | unpacking, reading or copying. 342 | 343 | 7. Additional Terms. 344 | 345 | "Additional permissions" are terms that supplement the terms of this 346 | License by making exceptions from one or more of its conditions. 347 | Additional permissions that are applicable to the entire Program shall 348 | be treated as though they were included in this License, to the extent 349 | that they are valid under applicable law. If additional permissions 350 | apply only to part of the Program, that part may be used separately 351 | under those permissions, but the entire Program remains governed by 352 | this License without regard to the additional permissions. 353 | 354 | When you convey a copy of a covered work, you may at your option 355 | remove any additional permissions from that copy, or from any part of 356 | it. (Additional permissions may be written to require their own 357 | removal in certain cases when you modify the work.) You may place 358 | additional permissions on material, added by you to a covered work, 359 | for which you have or can give appropriate copyright permission. 360 | 361 | Notwithstanding any other provision of this License, for material you 362 | add to a covered work, you may (if authorized by the copyright holders of 363 | that material) supplement the terms of this License with terms: 364 | 365 | a) Disclaiming warranty or limiting liability differently from the 366 | terms of sections 15 and 16 of this License; or 367 | 368 | b) Requiring preservation of specified reasonable legal notices or 369 | author attributions in that material or in the Appropriate Legal 370 | Notices displayed by works containing it; or 371 | 372 | c) Prohibiting misrepresentation of the origin of that material, or 373 | requiring that modified versions of such material be marked in 374 | reasonable ways as different from the original version; or 375 | 376 | d) Limiting the use for publicity purposes of names of licensors or 377 | authors of the material; or 378 | 379 | e) Declining to grant rights under trademark law for use of some 380 | trade names, trademarks, or service marks; or 381 | 382 | f) Requiring indemnification of licensors and authors of that 383 | material by anyone who conveys the material (or modified versions of 384 | it) with contractual assumptions of liability to the recipient, for 385 | any liability that these contractual assumptions directly impose on 386 | those licensors and authors. 387 | 388 | All other non-permissive additional terms are considered "further 389 | restrictions" within the meaning of section 10. If the Program as you 390 | received it, or any part of it, contains a notice stating that it is 391 | governed by this License along with a term that is a further 392 | restriction, you may remove that term. If a license document contains 393 | a further restriction but permits relicensing or conveying under this 394 | License, you may add to a covered work material governed by the terms 395 | of that license document, provided that the further restriction does 396 | not survive such relicensing or conveying. 397 | 398 | If you add terms to a covered work in accord with this section, you 399 | must place, in the relevant source files, a statement of the 400 | additional terms that apply to those files, or a notice indicating 401 | where to find the applicable terms. 402 | 403 | Additional terms, permissive or non-permissive, may be stated in the 404 | form of a separately written license, or stated as exceptions; 405 | the above requirements apply either way. 406 | 407 | 8. Termination. 408 | 409 | You may not propagate or modify a covered work except as expressly 410 | provided under this License. Any attempt otherwise to propagate or 411 | modify it is void, and will automatically terminate your rights under 412 | this License (including any patent licenses granted under the third 413 | paragraph of section 11). 414 | 415 | However, if you cease all violation of this License, then your 416 | license from a particular copyright holder is reinstated (a) 417 | provisionally, unless and until the copyright holder explicitly and 418 | finally terminates your license, and (b) permanently, if the copyright 419 | holder fails to notify you of the violation by some reasonable means 420 | prior to 60 days after the cessation. 421 | 422 | Moreover, your license from a particular copyright holder is 423 | reinstated permanently if the copyright holder notifies you of the 424 | violation by some reasonable means, this is the first time you have 425 | received notice of violation of this License (for any work) from that 426 | copyright holder, and you cure the violation prior to 30 days after 427 | your receipt of the notice. 428 | 429 | Termination of your rights under this section does not terminate the 430 | licenses of parties who have received copies or rights from you under 431 | this License. If your rights have been terminated and not permanently 432 | reinstated, you do not qualify to receive new licenses for the same 433 | material under section 10. 434 | 435 | 9. Acceptance Not Required for Having Copies. 436 | 437 | You are not required to accept this License in order to receive or 438 | run a copy of the Program. Ancillary propagation of a covered work 439 | occurring solely as a consequence of using peer-to-peer transmission 440 | to receive a copy likewise does not require acceptance. However, 441 | nothing other than this License grants you permission to propagate or 442 | modify any covered work. These actions infringe copyright if you do 443 | not accept this License. Therefore, by modifying or propagating a 444 | covered work, you indicate your acceptance of this License to do so. 445 | 446 | 10. Automatic Licensing of Downstream Recipients. 447 | 448 | Each time you convey a covered work, the recipient automatically 449 | receives a license from the original licensors, to run, modify and 450 | propagate that work, subject to this License. You are not responsible 451 | for enforcing compliance by third parties with this License. 452 | 453 | An "entity transaction" is a transaction transferring control of an 454 | organization, or substantially all assets of one, or subdividing an 455 | organization, or merging organizations. If propagation of a covered 456 | work results from an entity transaction, each party to that 457 | transaction who receives a copy of the work also receives whatever 458 | licenses to the work the party's predecessor in interest had or could 459 | give under the previous paragraph, plus a right to possession of the 460 | Corresponding Source of the work from the predecessor in interest, if 461 | the predecessor has it or can get it with reasonable efforts. 462 | 463 | You may not impose any further restrictions on the exercise of the 464 | rights granted or affirmed under this License. For example, you may 465 | not impose a license fee, royalty, or other charge for exercise of 466 | rights granted under this License, and you may not initiate litigation 467 | (including a cross-claim or counterclaim in a lawsuit) alleging that 468 | any patent claim is infringed by making, using, selling, offering for 469 | sale, or importing the Program or any portion of it. 470 | 471 | 11. Patents. 472 | 473 | A "contributor" is a copyright holder who authorizes use under this 474 | License of the Program or a work on which the Program is based. The 475 | work thus licensed is called the contributor's "contributor version". 476 | 477 | A contributor's "essential patent claims" are all patent claims 478 | owned or controlled by the contributor, whether already acquired or 479 | hereafter acquired, that would be infringed by some manner, permitted 480 | by this License, of making, using, or selling its contributor version, 481 | but do not include claims that would be infringed only as a 482 | consequence of further modification of the contributor version. For 483 | purposes of this definition, "control" includes the right to grant 484 | patent sublicenses in a manner consistent with the requirements of 485 | this License. 486 | 487 | Each contributor grants you a non-exclusive, worldwide, royalty-free 488 | patent license under the contributor's essential patent claims, to 489 | make, use, sell, offer for sale, import and otherwise run, modify and 490 | propagate the contents of its contributor version. 491 | 492 | In the following three paragraphs, a "patent license" is any express 493 | agreement or commitment, however denominated, not to enforce a patent 494 | (such as an express permission to practice a patent or covenant not to 495 | sue for patent infringement). To "grant" such a patent license to a 496 | party means to make such an agreement or commitment not to enforce a 497 | patent against the party. 498 | 499 | If you convey a covered work, knowingly relying on a patent license, 500 | and the Corresponding Source of the work is not available for anyone 501 | to copy, free of charge and under the terms of this License, through a 502 | publicly available network server or other readily accessible means, 503 | then you must either (1) cause the Corresponding Source to be so 504 | available, or (2) arrange to deprive yourself of the benefit of the 505 | patent license for this particular work, or (3) arrange, in a manner 506 | consistent with the requirements of this License, to extend the patent 507 | license to downstream recipients. "Knowingly relying" means you have 508 | actual knowledge that, but for the patent license, your conveying the 509 | covered work in a country, or your recipient's use of the covered work 510 | in a country, would infringe one or more identifiable patents in that 511 | country that you have reason to believe are valid. 512 | 513 | If, pursuant to or in connection with a single transaction or 514 | arrangement, you convey, or propagate by procuring conveyance of, a 515 | covered work, and grant a patent license to some of the parties 516 | receiving the covered work authorizing them to use, propagate, modify 517 | or convey a specific copy of the covered work, then the patent license 518 | you grant is automatically extended to all recipients of the covered 519 | work and works based on it. 520 | 521 | A patent license is "discriminatory" if it does not include within 522 | the scope of its coverage, prohibits the exercise of, or is 523 | conditioned on the non-exercise of one or more of the rights that are 524 | specifically granted under this License. You may not convey a covered 525 | work if you are a party to an arrangement with a third party that is 526 | in the business of distributing software, under which you make payment 527 | to the third party based on the extent of your activity of conveying 528 | the work, and under which the third party grants, to any of the 529 | parties who would receive the covered work from you, a discriminatory 530 | patent license (a) in connection with copies of the covered work 531 | conveyed by you (or copies made from those copies), or (b) primarily 532 | for and in connection with specific products or compilations that 533 | contain the covered work, unless you entered into that arrangement, 534 | or that patent license was granted, prior to 28 March 2007. 535 | 536 | Nothing in this License shall be construed as excluding or limiting 537 | any implied license or other defenses to infringement that may 538 | otherwise be available to you under applicable patent law. 539 | 540 | 12. No Surrender of Others' Freedom. 541 | 542 | If conditions are imposed on you (whether by court order, agreement or 543 | otherwise) that contradict the conditions of this License, they do not 544 | excuse you from the conditions of this License. If you cannot convey a 545 | covered work so as to satisfy simultaneously your obligations under this 546 | License and any other pertinent obligations, then as a consequence you may 547 | not convey it at all. For example, if you agree to terms that obligate you 548 | to collect a royalty for further conveying from those to whom you convey 549 | the Program, the only way you could satisfy both those terms and this 550 | License would be to refrain entirely from conveying the Program. 551 | 552 | 13. Use with the GNU Affero General Public License. 553 | 554 | Notwithstanding any other provision of this License, you have 555 | permission to link or combine any covered work with a work licensed 556 | under version 3 of the GNU Affero General Public License into a single 557 | combined work, and to convey the resulting work. The terms of this 558 | License will continue to apply to the part which is the covered work, 559 | but the special requirements of the GNU Affero General Public License, 560 | section 13, concerning interaction through a network will apply to the 561 | combination as such. 562 | 563 | 14. Revised Versions of this License. 564 | 565 | The Free Software Foundation may publish revised and/or new versions of 566 | the GNU General Public License from time to time. Such new versions will 567 | be similar in spirit to the present version, but may differ in detail to 568 | address new problems or concerns. 569 | 570 | Each version is given a distinguishing version number. If the 571 | Program specifies that a certain numbered version of the GNU General 572 | Public License "or any later version" applies to it, you have the 573 | option of following the terms and conditions either of that numbered 574 | version or of any later version published by the Free Software 575 | Foundation. If the Program does not specify a version number of the 576 | GNU General Public License, you may choose any version ever published 577 | by the Free Software Foundation. 578 | 579 | If the Program specifies that a proxy can decide which future 580 | versions of the GNU General Public License can be used, that proxy's 581 | public statement of acceptance of a version permanently authorizes you 582 | to choose that version for the Program. 583 | 584 | Later license versions may give you additional or different 585 | permissions. However, no additional obligations are imposed on any 586 | author or copyright holder as a result of your choosing to follow a 587 | later version. 588 | 589 | 15. Disclaimer of Warranty. 590 | 591 | THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY 592 | APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT 593 | HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY 594 | OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, 595 | THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 596 | PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM 597 | IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF 598 | ALL NECESSARY SERVICING, REPAIR OR CORRECTION. 599 | 600 | 16. Limitation of Liability. 601 | 602 | IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING 603 | WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS 604 | THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY 605 | GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE 606 | USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF 607 | DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD 608 | PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), 609 | EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF 610 | SUCH DAMAGES. 611 | 612 | 17. Interpretation of Sections 15 and 16. 613 | 614 | If the disclaimer of warranty and limitation of liability provided 615 | above cannot be given local legal effect according to their terms, 616 | reviewing courts shall apply local law that most closely approximates 617 | an absolute waiver of all civil liability in connection with the 618 | Program, unless a warranty or assumption of liability accompanies a 619 | copy of the Program in return for a fee. 620 | 621 | END OF TERMS AND CONDITIONS 622 | 623 | How to Apply These Terms to Your New Programs 624 | 625 | If you develop a new program, and you want it to be of the greatest 626 | possible use to the public, the best way to achieve this is to make it 627 | free software which everyone can redistribute and change under these terms. 628 | 629 | To do so, attach the following notices to the program. It is safest 630 | to attach them to the start of each source file to most effectively 631 | state the exclusion of warranty; and each file should have at least 632 | the "copyright" line and a pointer to where the full notice is found. 633 | 634 | 635 | Copyright (C) 636 | 637 | This program is free software: you can redistribute it and/or modify 638 | it under the terms of the GNU General Public License as published by 639 | the Free Software Foundation, either version 3 of the License, or 640 | (at your option) any later version. 641 | 642 | This program is distributed in the hope that it will be useful, 643 | but WITHOUT ANY WARRANTY; without even the implied warranty of 644 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 645 | GNU General Public License for more details. 646 | 647 | You should have received a copy of the GNU General Public License 648 | along with this program. If not, see . 649 | 650 | Also add information on how to contact you by electronic and paper mail. 651 | 652 | If the program does terminal interaction, make it output a short 653 | notice like this when it starts in an interactive mode: 654 | 655 | Copyright (C) 656 | This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. 657 | This is free software, and you are welcome to redistribute it 658 | under certain conditions; type `show c' for details. 659 | 660 | The hypothetical commands `show w' and `show c' should show the appropriate 661 | parts of the General Public License. Of course, your program's commands 662 | might be different; for a GUI interface, you would use an "about box". 663 | 664 | You should also get your employer (if you work as a programmer) or school, 665 | if any, to sign a "copyright disclaimer" for the program, if necessary. 666 | For more information on this, and how to apply and follow the GNU GPL, see 667 | . 668 | 669 | The GNU General Public License does not permit incorporating your program 670 | into proprietary programs. If your program is a subroutine library, you 671 | may consider it more useful to permit linking proprietary applications with 672 | the library. If this is what you want to do, use the GNU Lesser General 673 | Public License instead of this License. But first, please read 674 | . 675 | -------------------------------------------------------------------------------- /CHANGELOG.rst: -------------------------------------------------------------------------------- 1 | 1.3.1 2 | ----- 3 | 4 | Pull Requests: 5 | 6 | - @tbabej: #152; Adds support for Taskwarrior 2.6.0 7 | - @vrusinov: #147; Adds support for Taskwarrior 2.5.3 8 | - @jayvdb: #138; Fixes changelog syntax 9 | - @eumiro: #140; Add tests for pull requests 10 | 11 | 1.3.0 12 | ----- 13 | 14 | Pull Requests: 15 | 16 | - @ryaneverett: #134; Pass taskrc via environment variable to subprocess. 17 | - @ryaneverett: #131; Adds testing for Python 3.7 and 3.8 18 | - @gdeterez: #130; Fix error raised when taskwarrior is not installed. 19 | - @bergercookie: #124; Fix bug on deletion of completed task; disable 20 | confirmation for recurring tasks; fix bug in numeric deserialization. 21 | - @matt-snider: #121; Fixes bug in which UUIDs were improperly parsed 22 | when creating recurring tasks. 23 | - @yonk42: #116; Fix a bug in which configuration values having an equal 24 | sign in their value would be improperly parsed. 25 | 26 | Mechanical: 27 | 28 | - Switched from nose to pytest. 29 | - Switched from travis.ci to github actions. 30 | 31 | Deprecated: 32 | 33 | - Dropped automated testing for Python 3.4. 34 | 35 | 1.2.0 36 | ----- 37 | 38 | Pull Requests 39 | 40 | - (@ryansb) #103, Strip form feed/bell chars 41 | https://github.com/ralphbean/taskw/pull/103 42 | - (@ryansb) #105, Also remove literal escape characters `^[` 43 | https://github.com/ralphbean/taskw/pull/105 44 | - (@ryansb) #104, Use the `errno` library instead of string matching error text 45 | https://github.com/ralphbean/taskw/pull/104 46 | - (@ryneeverett) #107, Travis Testing Improvements 47 | https://github.com/ralphbean/taskw/pull/107 48 | - (@ryneeverett) #108, Downgrade string coercion from warning to debug. 49 | https://github.com/ralphbean/taskw/pull/108 50 | - (@gdetrez) #109, Fix bugwarrior issue #393 51 | https://github.com/ralphbean/taskw/pull/109 52 | 53 | Commits 54 | 55 | - ac720a5f2 Test against beta2. 56 | https://github.com/ralphbean/taskw/commit/ac720a5f2 57 | - de5fa87d9 task 2.5.0 is out! 58 | https://github.com/ralphbean/taskw/commit/de5fa87d9 59 | - 11cdab50f Use kitchen in the most dire of circumstances. 60 | https://github.com/ralphbean/taskw/commit/11cdab50f 61 | - 36406c6d5 All hail 2.5.1. 62 | https://github.com/ralphbean/taskw/commit/36406c6d5 63 | - 00ea026aa Strip form feed/bell chars 64 | https://github.com/ralphbean/taskw/commit/00ea026aa 65 | - c97ed88c1 Use the `errno` library instead of string matching error text 66 | https://github.com/ralphbean/taskw/commit/c97ed88c1 67 | - 359543f37 Move import 68 | https://github.com/ralphbean/taskw/commit/359543f37 69 | - 1bacb40bf Also remove literal escape characters `^[` 70 | https://github.com/ralphbean/taskw/commit/1bacb40bf 71 | - 8d86fc538 Downgrade string coercion from warning to debug. 72 | https://github.com/ralphbean/taskw/commit/8d86fc538 73 | - bae210000 Fix the v2.4.4 tag name in travis.yml. 74 | https://github.com/ralphbean/taskw/commit/bae210000 75 | - fc41a5917 Upgrade travis to ubuntu trusty. 76 | https://github.com/ralphbean/taskw/commit/fc41a5917 77 | - 64574e276 Run Travis against taskwarrior 2.5.x series. 78 | https://github.com/ralphbean/taskw/commit/64574e276 79 | - 1b19f66eb Run tests against python3.5. 80 | https://github.com/ralphbean/taskw/commit/1b19f66eb 81 | - 74b778552 Remove taskwarrior 2.4.3-2.4.4 from Travis matrix. 82 | https://github.com/ralphbean/taskw/commit/74b778552 83 | - c9c2e75c1 Run on py35 now. 84 | https://github.com/ralphbean/taskw/commit/c9c2e75c1 85 | - 840613288 Add a function to clean control characters 86 | https://github.com/ralphbean/taskw/commit/840613288 87 | - 32a87235f Clean control characters in command 88 | https://github.com/ralphbean/taskw/commit/32a87235f 89 | 90 | 1.1.0 91 | ----- 92 | 93 | Primarily: 94 | 95 | - Compatibility with task-2.5.0.beta1 `91cc20f96 `_ 96 | 97 | Also: 98 | 99 | - Improvements to dependency behavior. `a9f716456 `_ 100 | - Shuffle some things in Task just to make classmethods easier. `938171e3b `_ 101 | - Add test. `3c494c1e4 `_ 102 | - Make .load_config() work as expected. `971ddc6b3 `_ 103 | - Merge pull request #93 from ralphbean/feature/nested-config `a8301a7cc `_ 104 | - Merge pull request #92 from ralphbean/feature/recursive-tasks `57939f4c4 `_ 105 | - Check TASKRC environment var, default to ~/.taskrc `03b908bce `_ 106 | - Merge pull request #95 from khaeru/develop `17133f22f `_ 107 | - Raise a more descriptive error `02b9fa5db `_ 108 | - Merge pull request #97 from ralphbean/feature/more-descriptive-error `69e63c04e `_ 109 | - Test against task-2.4.2 also. `310c2e473 `_ 110 | - Expand tox and travis to test against the latest taskwarrior release. `e2df21780 `_ 111 | 112 | 1.0.3 113 | ----- 114 | 115 | - Replace attr.is:value queries with attr == "value". `417928c8f `_ 116 | - Merge pull request #91 from ralphbean/feature/is-to-equals `55afe8db4 `_ 117 | - Use the 'release build' just to make things faster `3b10aee66 `_ 118 | - Test against task-2.4.1. It is out! `4b170808d `_ 119 | 120 | 1.0.2 121 | ----- 122 | 123 | - This one too. `72d61ee33 `_ 124 | 125 | 1.0.1 126 | ----- 127 | 128 | - Ding this req. `2d9c546eb `_ 129 | 130 | 1.0.0 131 | ----- 132 | 133 | - Don't encode characters nested within queries. `0e0869c9c `_ 134 | - Parse uuids from "task add" output when necessary. `6817eb027 `_ 135 | - Present args correctly to the taskwarrior parser. `4e11ad049 `_ 136 | - Check specifically for this to reduce confusion in test failure output. `92633f4cb `_ 137 | - Dance around this. `1f83582b9 `_ 138 | - Strip out argued uuid if on taskwarrior-2.4 or later. `ad51ab62b `_ 139 | - Comment out failing tests due to bugs in taskwarrior-2.4 and later. `28f71ebf5 `_ 140 | - Corrected syntax in completing tasks example `d27eb9557 `_ 141 | - Added retrieve, update and delete examples `843a68d07 `_ 142 | - Corrected the section on updating tasks `57c33a799 `_ 143 | - Merge pull request #69 from countermeasure/readme `3ec674957 `_ 144 | - Added a test for addition of a numeric UDA `4d21be9e7 `_ 145 | - Added failing tests for removal of UDAs `d3c623319 `_ 146 | - Allow numeric fields to accept value of None `d92d60e00 `_ 147 | - Allow string fields to accept value of None `e04045959 `_ 148 | - Adding all these tests back in to check out the task-2.4.0.beta3 release. `cd2dda7b5 `_ 149 | - Do not swallow KeyError and return field-specific null values for known fields. `b1dc1eab7 `_ 150 | - test: set the timezone to UTC when adding a task `9323d6755 `_ 151 | - Merge pull request #76 from dev-zero/develop `717e65f18 `_ 152 | - DirtyableDict should be a subclass of dict, not list. `884346444 `_ 153 | - Simplifications and fixes to `Task.get` and `Task.__setitem__` to reduce surprises. `4c579ce25 `_ 154 | - Get the DirectDB method to delete values correctly. `cc1d78a34 `_ 155 | - Remove unused import. `941001d1d `_ 156 | - Remove test we decided to jettison at the end of #70. `304c1af94 `_ 157 | - Merge branch 'uda_handling_alterations' into develop `032c00e70 `_ 158 | - Add failing test case for `?` escaping `bc6eb5ab3 `_ 159 | - Do not quote `?` when used with an exact match. `d29af8436 `_ 160 | - Merge pull request #78 from djmitche/issue77 `e7be645c1 `_ 161 | - py3 fix. `fc16948ea `_ 162 | - Use rc.dependency.confirmation=no when running task. `03cee7ae3 `_ 163 | - Squash the (hopefully) last encoding bug w.r.t. task-2.4.0 `14ff33d0c `_ 164 | - Issue 72: Instruct travis-ci to test taskw using multiple taskwarrior versions. `8a5efc3cf `_ 165 | - Issue 72: Install some required packages. `7489ca567 `_ 166 | - Issue 72: Use sudo for task installation. `cf68420a4 `_ 167 | - Issue 72: Use sudo for installing packages; of course. `9a11bb9e9 `_ 168 | - Issue 72: Switch back to package directory after installing taskwarrior. `11bc2fe12 `_ 169 | - Merge pull request #82 from coddingtonbear/72_test_under_multiple_taskwarrior_versions `c8edd25b1 `_ 170 | - Issue 83: Adding basic tox testing framework for local testing in multiple environments on each taskwarrior version. `e4a3d6977 `_ 171 | - Issue 85: Generate a list of keys prior to beginning iteration. `e7ed3ccb1 `_ 172 | - Issue 83: Allow passing positional args to py.test (so you can run one test at a time, for example). `e0df14111 `_ 173 | - Merge pull request #86 from ralphbean/85_fix_python3k_key_iteration `d3339df88 `_ 174 | - Issue 83: Use nose for tests rather than py.test. `72c1aee03 `_ 175 | - Merge branch 'develop' into feature/task-2.4 `55090cd9f `_ 176 | - Apply the unicode-sandwich principle. `05e4e830d `_ 177 | - Add python-3.4 to the mix `7f0b836ba `_ 178 | - Merge branch '83_tox_testing' into feature/task-2.4 `bbd7484f9 `_ 179 | - Fix py3 iterator behavior. `058eed0db `_ 180 | - Add python-3.4 to our travis matrix. `e2a13f5d1 `_ 181 | - Encode sub-queries differently for different versions of taskwarrior. `01682adda `_ 182 | - I'm not sure how this test ever passed, so I'm going to punt. `af343d230 `_ 183 | - Add taskwarrior-2.4.1 in there. `17e880af2 `_ 184 | - Throw v2.4.1 in here too. `a5dd24c9a `_ 185 | - Since this hasn't been released yet, use the branch name. `f93bf019f `_ 186 | - That stuff didn't seem to work. No big. Release coming soon. `875776aa5 `_ 187 | - Merge pull request #68 from ralphbean/feature/task-2.4 `934aac027 `_ 188 | - Adding test that ensures we can store and retrieve values by UDA. `35996b295 `_ 189 | - Adding another failed test for filtering of exported tasks. `722f7902b `_ 190 | - Adjust url search test to "work" `8432a2187 `_ 191 | - Fix parenthetical subqueries as per @coddingtonbear's suggestion. `1387ed321 `_ 192 | - Fixes #88; Works around TW-1510 and TD-87. `db1cb64ad `_ 193 | - Merge pull request #89 from coddingtonbear/88_circumvent_taskw_bug_wrt_empty_priority `2e32e446c `_ 194 | - Move version string. `19dc59b2e `_ 195 | 196 | 0.8.6 197 | ----- 198 | 199 | - Turns out unittest2 is a backport from py2.7, not from py3.x. `4e605403c `_ 200 | 201 | 0.8.5 202 | ----- 203 | 204 | - Do not allow taskwarrior to attempt to parse the string passed-in to denotate. `e9716a2e9 `_ 205 | - Merge pull request #64 from coddingtonbear/make_denotate_use_unparsed_string_too `43fc07638 `_ 206 | - Decode the configuration file in UTF-8 mode. `fa491d7ce `_ 207 | - Fixing a bug in which, while merging two configuration trees, we encounter the dict/string problem. Fixes #65. `477cc8b65 `_ 208 | - Merge pull request #66 from coddingtonbear/handle_unicode_configs `60218eef7 `_ 209 | - Merge pull request #67 from coddingtonbear/merge_trees_dict_nonsense `666d21ce5 `_ 210 | - 0.8.4 `fa0b386ee `_ 211 | 212 | 0.8.3 213 | ----- 214 | 215 | - Add failing test for annotation extension. `ee746dac9 `_ 216 | - Add another failing test just to round it out. `aa637a950 `_ 217 | - Make Task object store newly fabricated attributes. `47d27c78f `_ 218 | 219 | 0.8.2 220 | ----- 221 | 222 | - This works.. that's good. `d7163b28f `_ 223 | - Refactoring task instance handling to support marshalling to and from python-specific (non-JSON) datatypes while retaining backward-compatible behavior. `1ed40ba95 `_ 224 | - Merge pull request #50 from coddingtonbear/change_tracking_and_coercion `46b277732 `_ 225 | - Test composition. (It works..) `2de883c38 `_ 226 | - Test string UDAs. `37c3c28a3 `_ 227 | - Test UDA dates. `ba4c0eb84 `_ 228 | - Typofix. `0f7189282 `_ 229 | - Refactors TaskRc parser to match previous version written by @ralphbean. Adds tests; fixes #51. `17f41c6e0 `_ 230 | - Merge pull request #52 from coddingtonbear/issue_51 `e0d6415cb `_ 231 | - Merge configuration overrides into taskrc configuration. `e5b7a502d `_ 232 | - Update existing use of config overrides to match new datatstructure. `7278ce33e `_ 233 | - Merge pull request #53 from coddingtonbear/handle_config_overrides `3c8adfe5f `_ 234 | - Raise an exception if we can't parse configuration; ignore simple config values to allow storing complex ones. `fc1beaee5 `_ 235 | - Add AnnotationArrayField for handling idiosyncrasies of annotations. `ef3aca65f `_ 236 | - Attempt to convert incoming string into int or float. `2726efaf0 `_ 237 | - Only attempt to change fields known to have changed if using new journaled task. `5b7cb71b7 `_ 238 | - Handle none values. `51f003c3e `_ 239 | - Properly handle changes to annotations. `deab4070a `_ 240 | - Allow comma-separated UUID field to properly handle null values. `aa5b6b3f9 `_ 241 | - Assume that fields with registered converters are present on task record. `f81746f65 `_ 242 | - Use six.text_type rather than str. `c4cc90f45 `_ 243 | - Preserve all annotation information should we have it, but still handle outgoing and incoming values as if they were strings. `e1f497291 `_ 244 | - Adding tests verifying this behavior. `02444fd75 `_ 245 | - Merge pull request #54 from coddingtonbear/cautious_configuration_handling `e4b02c5d3 `_ 246 | - Merge pull request #58 from coddingtonbear/csuuid_field_enhancements `95eace2e5 `_ 247 | - Merge pull request #59 from coddingtonbear/assume_specified_fields_have_value `7bf7dd5aa `_ 248 | - Merging in upstream changes. `dfd59319a `_ 249 | - Merge pull request #57 from coddingtonbear/only_change_if_changes_exist_when_using_modern_task `78eef2a76 `_ 250 | - Merge pull request #56 from coddingtonbear/properly_deserialize_numbers `9dedffe03 `_ 251 | - Merge pull request #55 from coddingtonbear/annotation_field `f8511d1fd `_ 252 | - Make annotations really be strings, just special ones. `8d20fdcd4 `_ 253 | - That's surprising, but I suppose __new__ takes care of these detais. `8d62c4750 `_ 254 | - Properly handle parsing choices from UDAs. `4077de023 `_ 255 | - Do not record changes when both the former and latter values are Falsy `0f1a692c8 `_ 256 | - Merge pull request #62 from coddingtonbear/fix_choices_handling_udas `c6f02f62e `_ 257 | - Merge pull request #63 from coddingtonbear/none_and_none_are_none `e2ef3bd9d `_ 258 | - Merge pull request #61 from coddingtonbear/better_annotation_objects `f90fcc6fe `_ 259 | 260 | 0.8.1 261 | ----- 262 | 263 | - Expand TaskwarriorError output to include the command. `cbc2e98c1 `_ 264 | - That's a list.. whoops! `22b2c6cad `_ 265 | - These also need to be escaped. `0b468ea6b `_ 266 | - Add some passing tests of task filtering. `12d1dbf32 `_ 267 | - Test and fix a problem with filter encoding. `fa468d4a3 `_ 268 | - Test and fix another problem with filter encoding. `7900cd9e1 `_ 269 | - Add some other similar tests that all pass. `982fdcf6b `_ 270 | - Test and fix another problem with filter encoding. `08950fff2 `_ 271 | - Test and implement logical operations in task filters. `3ef025c31 `_ 272 | - Add a test for encoding of slashes. `079973a9f `_ 273 | - Test and fix annotation escaping. `1a868cfdf `_ 274 | - subprocess is expecting bytestrings. `16e9d00e7 `_ 275 | 276 | 0.8.0 277 | ----- 278 | 279 | - Switch .sync to also utilize common _execute interface. `db29c60c8 `_ 280 | - Merge pull request #32 from latestrevision/sync_to_execute `0dd85cffd `_ 281 | - Support datetime objects as input. `48f7734b0 `_ 282 | - Merge branch 'develop' of github.com:ralphbean/taskw into develop `f4760baf7 `_ 283 | - Update the readme. `db00a1b91 `_ 284 | - py3 compat. `73bd7d924 `_ 285 | - Of course, handle unicode as well as byte strings here... `ef09c4073 `_ 286 | - Test that unicode stuff. `9b394d513 `_ 287 | - Serialize incoming zoned date/datetime instances into strings of the appropriate format before relaying to taskwarrior. `0516cc10c `_ 288 | - Adding two additional requirements (sorry). `2f3264d2b `_ 289 | - Fixing requirement name. `850b75c7b `_ 290 | - Minor modifications to annotation handling to support annotations in 2.3.0 `c2f1e4fae `_ 291 | - Overriding _stub_task to preserve due date; display the actual error message when a task is not creatable. `290a93f34 `_ 292 | - Use string_types rather than basestring. `a33aa47a9 `_ 293 | - Removing unicode literal. `037b22622 `_ 294 | - Use six.text_type rather than a unicode literal. `40ef622ea `_ 295 | - Use string_types rather than basestring. `546a9de89 `_ 296 | - Use six.text_type rather than a unicode literal. `e94459981 `_ 297 | - Do not attempt to set parameters unless they are explicitly defined in the incoming data. `30750abee `_ 298 | - Gracefully handle situations in which id or uuid is unspecified. `790b7b044 `_ 299 | - Merge pull request #34 from latestrevision/fix_date_serialization `c0f7a1f76 `_ 300 | - Merge branch 'fix_annotation_handling' into develop `f313d2800 `_ 301 | - Avoid hardcoding TZ in the test expectation. `d696409bd `_ 302 | - Add functionality for marking existing task as started/stopped. `b7926d2ec `_ 303 | - Return stdout or stderr from task_info. `c83b5ac81 `_ 304 | - Merge pull request #36 from latestrevision/add_start_and_stop `860bf5176 `_ 305 | - Merge pull request #37 from latestrevision/fix_info_method `5e46a51ac `_ 306 | - Removing duplicated encoding of string types. `0dccea5ca `_ 307 | - Merge pull request #38 from latestrevision/remove_duplicated_encoding_for_string_items `9031179c8 `_ 308 | - Convert 'None' into an empty string; otherwise, we will ask task to set various fields to the string value None. `14eb7c4ae `_ 309 | - Merge pull request #39 from latestrevision/properly_empty_values_upon_null `5eb1fdbec `_ 310 | - Raise an exception when taskwarrior has a non-zero return status. `8bb389997 `_ 311 | - Merge pull request #40 from latestrevision/raise_on_error `1a5c0d468 `_ 312 | - Manually assign UUID of task before creation to ensure that retrieval is successful. `782e9f6f0 `_ 313 | - Merge pull request #41 from coddingtonbear/manually_assign_uuid_to_added_tasks `d1afcbd48 `_ 314 | - Alter TaskWarriorShellout such that one can easily define new config overrides in subclasses. `2c3344d3a `_ 315 | - Use a slightly more untuitive data structure for storing config overrides. `a1c7fde67 `_ 316 | - Removing unncessary unicode string marker. `5ce28c699 `_ 317 | - Merge pull request #42 from coddingtonbear/allow_subclass_configuration_overrides `ebaa6967f `_ 318 | - Do not test deletion of completed tasks with Shellout; this operation is not supported by taskwarrior. `5ca1d61e1 `_ 319 | - Merge pull request #43 from coddingtonbear/fix_test_delete_completed `203c38694 `_ 320 | - Adding 'filter_tasks' method accepting a dictionary of filter arguments for returning from taskwarrior. `99fc349fc `_ 321 | - Adding a docstring. `b5d897607 `_ 322 | - Merge pull request #44 from coddingtonbear/add_filter_tasks_method `2514cd584 `_ 323 | - Distinguish between escaping a query and escaping on issue creation. `333e26919 `_ 324 | - Merge pull request #45 from coddingtonbear/distinguish_query `f98ed1620 `_ 325 | - Minor fixes relating to UDA handling; improving exception message. `253aad5d9 `_ 326 | - Better annotation handling. `209050dab `_ 327 | - Allow passing "init" arg to sync command `3b9ae8e68 `_ 328 | - Merge pull request #48 from kostajh/sync-init `a1da55d30 `_ 329 | - Merge pull request #47 from coddingtonbear/minor_fixes_supporting_bugwarrior `e1332c2a1 `_ 330 | - Don't hardcode ascii. `459ab8911 `_ 331 | 332 | 0.7.2 333 | ----- 334 | 335 | - Add some failing test cases based on a report from @lmacken. `807eebdfc `_ 336 | - This should fix it. `ad5ad2f70 `_ 337 | - Merge branch 'feature/backslashes-omg' into develop `8b44795d9 `_ 338 | 339 | 0.7.1 340 | ----- 341 | 342 | - Add back forgotten import. `6e3bf593e `_ 343 | 344 | 0.7.0 345 | ----- 346 | 347 | - Allow passing tags as part of the task `60ca9d39f `_ 348 | - Adding 'sync' capability; cleaning-up version checking. `1acb2cb9e `_ 349 | - Make taskwarrior version gathering support taskwarrior residing at a non-standard path. `6359d79e3 `_ 350 | - Adding TaskWarrior.sync (raises NotImplementedError). `a628990bf `_ 351 | - Merge pull request #28 from latestrevision/add_sync_capability `647f3378e `_ 352 | - Refactor such that all commands share a single interface. `9cb4edf11 `_ 353 | - Merge pull request #24 from kostajh/develop `b5f90f73b `_ 354 | - Replacing string literal with variable. `25fedee85 `_ 355 | - Removing unicode literal. `344a354ea `_ 356 | - Decode incoming strings using default encoding before deserialization. `d5a1b5ab7 `_ 357 | - There is no reason for me to have written such a complicated sentence. `84bc5f9b7 `_ 358 | - Merge pull request #29 from latestrevision/rearchitect_twe `9b43c38e4 `_ 359 | - Make TaskWarriorShellout our default. `df9be4a41 `_ 360 | - PEP8. `c222da89e `_ 361 | - Merge branch 'develop' of github.com:ralphbean/taskw into feature/switchover `f2a3c0b28 `_ 362 | - Provide a backwards compatibility rename. `2a548993f `_ 363 | - Add a lot more tests to the shellout implementation. `f1c4e7706 `_ 364 | - Standardize the load_tasks method. `143b69a0a `_ 365 | - You cannot fake annotations like this with the shellout approach. `2e4d674ac `_ 366 | - These tests no longer make sense. `a9b53d911 `_ 367 | - We never had a task_delete method for shellout. Here it is. `d9ddd9c79 `_ 368 | - deletes, though, require confirmation.... `5c01dab4c `_ 369 | - Cosmetic. `9240706e4 `_ 370 | - Make this return signature standard. `1a868b9b3 `_ 371 | - Allow user to specify the encoding. `ddf4df91a `_ 372 | - Merge the "waiting" list back into the "pending" list. `3d9f050f9 `_ 373 | - Really merge.. not overwrite. `a4bfb5e88 `_ 374 | - Add TaskWarriorExperimental back to __all__ `ac7b227c2 `_ 375 | - We actually do install 'task' in our travis environment. `7518d0aeb `_ 376 | - Merge pull request #31 from ralphbean/feature/switchover `d63bb0f43 `_ 377 | 378 | 0.6.1 379 | ----- 380 | 381 | - Install taskwarrior for Travis CI tests `a59d8dd0f `_ 382 | - Add complete example for experimental mode `2210ae394 `_ 383 | - Check what version of task we have installed `fc6a03c80 `_ 384 | - Try installing 2.2 version of TW `f3e5a9971 `_ 385 | - Yes, we want to add the repo `baeec9de0 `_ 386 | - Just check for TW version 2. `cf6f3d881 `_ 387 | - Update tests, make an important fix in _load_task for handling single vs multiple results `98fe47538 `_ 388 | - Fix tests for TWExperimental, all tests pass now in Python 2.7 `ba91fdeab `_ 389 | - basestring should be replaced with str for python 3 `3cdbb74a0 `_ 390 | - More python3 compatibility `e6018e5dc `_ 391 | - Fix encoding of subprocess results `a79b4ffd0 `_ 392 | - Fix encoding for another subprocess call `1a10e302b `_ 393 | - add task deannoate function to Experiemental `17e5ce813 `_ 394 | - Fix decode issues with subprocess results for python 3 `f2b886ccd `_ 395 | - Merge pull request #22 from kostajh/develop `13d3c7b93 `_ 396 | - Merge pull request #23 from tychoish/develop `853ba71b2 `_ 397 | - Split only once. `ba00547ab `_ 398 | - Get the key only if it exists. `a9da7ee29 `_ 399 | - Set a default data location if one is not specified. `0cb7ef36f `_ 400 | - Try a test for #26. `e10bd5516 `_ 401 | 402 | 0.6.0 403 | ----- 404 | 405 | - Import six `6b4774237 `_ 406 | - Merge pull request #16 from kostajh/develop `ae0c90e3d `_ 407 | - PEP8. `40803afae `_ 408 | - Run tests on both normal and experimental implementations. `4305eb0c5 `_ 409 | - Note support for py3.3 `bfd0e9dd6 `_ 410 | - PEP8. `d09539ad1 `_ 411 | - Try to support skiptest on py2.6. `0b691cd09 `_ 412 | - Spare them the spam. `462f8e138 `_ 413 | - Added forgotten import. `ba2806e29 `_ 414 | - Oh. This is a lot easier. `08c9e0f07 `_ 415 | - Compatibility between experimental and normal modes. `cc4a4c339 `_ 416 | - Delete modified field from task `8419c6617 `_ 417 | - Merge pull request #17 from kostajh/develop `ee07d8957 `_ 418 | - Do not replace slashes when in experimental mode `19b52a3ae `_ 419 | - Merge pull request #18 from kostajh/develop `f5c77fdd1 `_ 420 | - Be more gentle with the timestamp test. `853a1693e `_ 421 | - Add failing test against experimental mode. `a12738dbd `_ 422 | - Merge branch 'develop' of github.com:ralphbean/taskw into develop `81330d741 `_ 423 | - Skip experimental tests of taskwarrior version is too low. `59cdb5a33 `_ 424 | - Check if we have a string before calling replace(). `d43dc2002 `_ 425 | - Allow non-pending tasks to be modified. `6a1326816 `_ 426 | - Merge pull request #19 from kostajh/develop `7c72ddf0f `_ 427 | - Py3 support. `6bd5b1cca `_ 428 | - Merge pull request #14 from burnison/completed_task_inclusion `ddb9bab62 `_ 429 | - Refactor _load_tasks(). Fixes #20 `595475b9d `_ 430 | - Check if 'status is in task. `e521acc96 `_ 431 | - Don't assume that we always find a task. `0af6d038d `_ 432 | - If task does not have uuid, don't proceed with update `259218f18 `_ 433 | - Allow for using keys being id, uuid and description (for example, search by UDA) `6be8c8a65 `_ 434 | - Minor fix to previous commit `d8d6a96d0 `_ 435 | - Do not require confirmation when updating task `88338365e `_ 436 | - Fix the logic for checking what kind of key we have. `6c4c55e78 `_ 437 | - Fix _load_task for ID and UUID `e204e93b2 `_ 438 | - Raise an alert if there is no uuid in task_update `840dfcef3 `_ 439 | - Strip whitespace from task description `5b1b57fd6 `_ 440 | - Python3 compatibility `d46ec7f08 `_ 441 | - Merge pull request #21 from kostajh/load-task-refactor `98b1c4481 `_ 442 | - Py3.2 fix. `c091e27bb `_ 443 | 444 | 0.5.1 445 | ----- 446 | 447 | - Missing import. `f9b2bd450 `_ 448 | 449 | 0.5.0 450 | ----- 451 | 452 | - Add ability to specify 'end' time on task closure. `e926560fc `_ 453 | - Remove set literal for python 2.6 compatibility. `122d33477 `_ 454 | - Merge pull request #13 from burnison/end_date_on_closure `1eeadbe4a `_ 455 | - Allow loading tasks using task export `4f5f116ac `_ 456 | - Adjust encode task to our needs. `8a9a9ddb9 `_ 457 | - Add support for task add and task done. `030f60976 `_ 458 | - Add task modify support `7a96b33ed `_ 459 | - Make subprocess calls quiet `72fb0a4a9 `_ 460 | - We do not need pprint `19ec0c106 `_ 461 | - Add task_annotate method `09da090ab `_ 462 | - Add TODO for checking annotations `00c83a52a `_ 463 | - Extract annotations passed into task_add `b9a4367cd `_ 464 | - Add support for updating annotations `825b3d324 `_ 465 | - Make sure the config_filename is used for working with TW `23cd99777 `_ 466 | - Add task info command `8fe9ed863 `_ 467 | - get_tasks can return pending or completed items `2271b0ee9 `_ 468 | - Return first match found in completed or pending tasks `9511ebfb0 `_ 469 | - Reorganize @kostajh's original and experimental approaches into subclasses of an abstract base class. `93fc7cb9c `_ 470 | - Some docstrings. `79d9b512b `_ 471 | - Turn load_config into a classmethod. `642df53bb `_ 472 | - Py3.2 support. `410f8bb15 `_ 473 | - Add py3.3 to the travis tests. `12cccd044 `_ 474 | - Update the README; preparing for release. `8b3758702 `_ 475 | 476 | 0.4.5 477 | ----- 478 | 479 | - Add support for due dates using UNIX timestamps `683f14e81 `_ 480 | - Add due timestamp for tests. Fixes #11 `10cdf73b4 `_ 481 | - Merge pull request #12 from kostajh/due-dates `dc67868b9 `_ 482 | --------------------------------------------------------------------------------