From 030706982666365db9edd9b4ca5f0e5cf4a79fe7 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 20 Feb 2016 17:24:48 +0000 Subject: [PATCH 1/4] Start 0.4-dev --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index 7d8ad34..1078dfb 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='NextAction', - version='0.3', + version='0.4-dev', py_modules=['nextaction'], url='https://github.com/nikdoof/NextAction', license='MIT', @@ -12,8 +12,8 @@ entry_points={ "console_scripts": [ "nextaction=nextaction:main", - ], - }, + ], + }, install_requires=[ 'todoist-python', ] From 70acdf031fdb77ddb2b99904420886bfef141b19 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Sat, 20 Feb 2016 17:25:35 +0000 Subject: [PATCH 2/4] Better docstrings and debug messages for non-commit cycles --- nextaction.py | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/nextaction.py b/nextaction.py index 5854830..5aae360 100755 --- a/nextaction.py +++ b/nextaction.py @@ -12,7 +12,7 @@ def get_subitems(items, parent_item=None): - """Search a flat item list for child items""" + """Search a flat item list for child items.""" result_items = [] found = False if parent_item: @@ -35,7 +35,7 @@ def get_subitems(items, parent_item=None): def main(): - + """Main process function.""" parser = argparse.ArgumentParser() parser.add_argument('-a', '--api_key', help='Todoist API Key') parser.add_argument('-l', '--label', help='The next action label to use', default='next_action') @@ -78,7 +78,7 @@ def main(): sys.exit(1) def get_project_type(project_object): - """Identifies how a project should be handled""" + """Identifies how a project should be handled.""" name = project_object['name'].strip() if project['name'] == 'Inbox': return args.inbox @@ -88,7 +88,7 @@ def get_project_type(project_object): return 'serial' def get_item_type(item): - """Identifies how a item with sub items should be handled""" + """Identifies how a item with sub items should be handled.""" name = item['content'].strip() if name[-1] == args.parallel_suffix: return 'parallel' @@ -121,6 +121,7 @@ def remove_label(item, label): if project_type: logging.debug('Project %s being processed as %s', project['name'], project_type) + # Get all items for the project, sort by the item_order field. items = sorted(api.items.all(lambda x: x['project_id'] == project['id']), key=lambda x: x['item_order']) for item in items: @@ -165,12 +166,16 @@ def remove_label(item, label): elif project_type == 'parallel': add_label(item, label_id) - logging.debug('%d changes queued for sync... commiting if needed', len(api.queue)) if len(api.queue): + logging.debug('%d changes queued for sync... commiting to Todoist.', len(api.queue)) api.commit() + else: + logging.debug('No changes queued, skipping sync.') + # If onetime is set, exit after first execution. if args.onetime: break + logging.debug('Sleeping for %d seconds', args.delay) time.sleep(args.delay) From f5a70a25e7bc1493e4b22bd49b752dab40861391 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 4 Aug 2016 10:28:30 +0100 Subject: [PATCH 3/4] Pin python-todoist to 0.2.26, for issue #6 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 2ffcb92..8cdf4ab 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1 +1 @@ -todoist-python>=0.2.9 \ No newline at end of file +todoist-python==0.2.26 \ No newline at end of file From 64aefd3cba71e176b0853098fe4f08bda02a74d0 Mon Sep 17 00:00:00 2001 From: Andrew Williams Date: Thu, 4 Aug 2016 10:32:16 +0100 Subject: [PATCH 4/4] Version 0.4 --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 1078dfb..d5a3152 100644 --- a/setup.py +++ b/setup.py @@ -2,7 +2,7 @@ setup( name='NextAction', - version='0.4-dev', + version='0.4', py_modules=['nextaction'], url='https://github.com/nikdoof/NextAction', license='MIT',