Git Product home page Git Product logo

trellowarrior's Introduction

TrelloWarrior

Tool to sync Taskwarrior projects with Trello boards.

Requirements

In Taskwarrior

First for all you need configure some UDAs in Taskwarrior to store some Trello data. This is very, very, very important. If you dont have the UDAs configured before run TrelloWarrior you'll destroy your Taskwarrior tasks data.

To set UDAs in Taskwarrior simply edit .taskrc and add the following lines.

# UDAs
uda.trelloid.type=string
uda.trelloid.label=Trello ID
uda.trellolistname.type=string
uda.trellolistname.label=Trello List Name

The first UDA trelloid is used to store the Trello Card ID and establish an equivalence between Trello Cards and Taskwarrior Tasks. Note that you never, never, never, never, (period), should edit this field.

The second UDA trellolistname is used to determine the Trello List where the Card/Task is stored. You can edit this field without problems to move the task to another list.

For TrelloWarrior

Prepare the environment

In Arch Linux

TrelloWarrior is packaged in AUR, to obtain it simply use your AUR helper. For example with yay:

yay -S trellowarrior

Or if you prefer a fully binary package you can configure Connectical Arch Linux repository.

The easy way

Simply create a Python 3 virtualenv and install via pip:

python3 -m venv trw
. trw/bin/activate
python3 -m pip install trellowarrior
By hand

For run TrelloWarrior you need to install tasklib and py-trello. TrelloWarrior uses these Python helpers to comunicate with Taskwarrior and Trello.

You can use your package system to install it, but the best way is to use a Python 3 virtualenv:

python3 -m venv trw
. trw/bin/activate
python3 -m pip install tasklib
python3 -m pip install py-trello

Get the keys

TrelloWarrior access to Trello via API. You need generate an access token for it.

First go to: https://trello.com/app-key to get your API Key and API Secret.

Then call TrelloWarrior with the authenticate command:

trellowarrior auth --api-key your_api_key --api-key-secret your_api_secret --expiration 30days --name TrelloWarrior

Note: --expiration and --name are optional, they are set by default to 30days and TrelloWarrior respectively.

You can set the TRELLO_EXPIRATION to 1hour, 1day, 30days, never. We recomend use 30days for tests and never for daily use.

This return some like this.

Request Token:
    - oauth_token        = 1c5ad394834dde42a7655437ab3e0060
    - oauth_token_secret = dffc3a62622ef450028f685406bceacc

Go to the following link in your browser:
https://trello.com/1/OAuthAuthorizeToken?oauth_token=1c5ad334134dde46a8659437ab3e0069&scope=read,write&expiration=30days&name=trellowarrior
Have you authorized me? (y/n)

You must visit the link to authorize the token. This gives you a pin like this.

You have granted access to your Trello information.

To complete the process, please give this verification code:

  17894a35a2f745c3a184cf8e4bb5f1f9

Respond yes, and insert the pin.

What is the PIN? 17894a35a2f745c3a184cf8e4bb5f1f9
Access Token:
    - oauth_token = 0469c6271416af6eae10123fdae0afc1135e9082bb0b5ba87b2f8a1db9d7f0b1
    - oauth_token_secret = a978b159692cfc315377790669ac99a0

You may now access protected resources using the access tokens above.

The config file is now initialized with the needed configuration variables.

Configuration

The TrelloWarrior config is very easy. There is a trellowarrior.conf sample file that you can modify to set with your data.

You can place the config file with trellowarrior, in your home as ~/.trellowarrior.conf or (by default if not previous config file exists) following the XDG Specification in $XDG_CONFIG_HOME/trellowarrior/trellowarrior.conf (fallbacks to ~/.config/trellowarrior/trellowarrior.conf), or set the configuration file path with -c or --config argument.

To synchronize Trello and Taskwarrior, simply call TrelloWarrior with the sync command or without any command.

trellowarrior sync

You can also add a list of project(s) to synchronize:

trellowarrior sync project1 project2

DEFAULT Section

In the DEFAULT section, it is mandatory to set your Trello API key and token and, at least, one sync project. The sync project corresponds to the following sections that define the Taskwarrior project and Trello board equivalence.

  • taskwarrior_taskrc_location Optional. Define where your taskrc file is located. Default: ~/.taskrc

  • taskwarrior_data_location Optional. Define where your task data dir is located. Default: ~/.task

  • trello_api_key MANDATORY. Your Trello Api Key.

  • trello_api_secret MANDATORY. Your Trello Api Secret.

  • trello_token MANDATORY. Your Trello Token.

  • trello_token_secret MANDATORY. Your Trello Token Secret.

  • sync_projects MANDATORY. Define what sections are loaded, separated by spaces.

Project/Board Sections

The Project/Board sections are called from sync_projects and define the equivalence between Taskwarrior and Trello.

  • taskwarrior_project_name MANDATORY. The name of project in Taskwarrior.
  • trello_board_name MANDATORY. The name of Trello Board.
  • trello_todo_list Optional. The name of Trello list where new pending tasks are stored. Default: To Do
  • trello_doing_list Optional. The name of Trello list for active tasks. Default: Doing
  • trello_done_list Optional. The name of Trello list for done taks. Default: Done
  • trello_lists_filter Optional. To filter Trello lists from syncing.
  • only_my_cards Optional. Sync ony cards / tasks assigned to me.

Equivalences

Taskwarrior Trello
UDA: trelloid Card ID
UDA: trellolistname List Name
Project Board Name
Description Card Name
Due Card Due Date
Tags Card Labels
Annotation: [Trello URL] Card URL
Annotation: [Trello Description] Card Description

Known limitations

The main objective of TrelloWarrior is to be simple so it doesn't manage collisions. The sync strategy is last modified wins, this means that if you do a modification in Trello and later a modification in Taskwarrior, TrelloWarrior does the sync and keeps the Taskwarrior data, because it is the last touched.

You can have infinite lists in your Trello, but all of them are considered as pending. You only can have one doing list and one done list, but these lists can be configured.

If you have several boards with same name or several labels with same name, TrelloWarrior always picks the first one.

Only Trello labels with names are synchronized, you can apply labels without name but these are ignored.

If you remove a name from a label and left it without name, the action don't touch date of cards and in next sync a new label will be created with the removed name. You can rename labels without problems.

New labels are created by TrelloWarrior in black color.

If you modify Card URL or Card Description in Trello, the old annotation will be deleted and replaced by a new one.

If you want to delete a due date you must do it in both Taskwarrior and Trello.

For now, only syncs Title/Description, Due dates, Labels, Card URL, Card Description and Status.

Contributing

See CONTRIBUTING.

License

This software is licensed under the terms of the GNU General Public License version 3 (GPLv3).

Full text of the license is available in the LICENSE file and online.

trellowarrior's People

Contributors

bestlibre avatar jean avatar ogarcia avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

trellowarrior's Issues

[Q] Daemon synchronisation process

Hey, community.

First of all, thanks for the flawless amazing integration!
I was wondering if there is any convenient way to keep the synchronization near "real-time" between Trello and taskwarrior? Perhaps some sort of a daemon process?

Decoding Unicode

Syncing a board failed with a traceback:

Traceback (most recent call last):
  File "./trellowarrior.py", line 411, in <module>
    main()
  File "./trellowarrior.py", line 400, in main
    project['trello_done_list'])
  File "./trellowarrior.py", line 273, in sync_trello_tw
    download_trello_card(project_name, list_name, trello_card, task_warrior, doing_list_name, done_list_name)
  File "./trellowarrior.py", line 183, in download_trello_card
    new_tw_task['description'] = trello_card.name.decode('utf-8')
  File "/home/john/repos/git/trellowarrior/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeEncodeError: 'ascii' codec can't encode character u'\u2019' in position 29: ordinal not in range(128)

I added a breakpoint to look more closely:

183         try:
184             new_tw_task['description'] = trello_card.name.decode('utf-8')
185         except:
186             import pdb
187             pdb.set_trace()
188  ->     if trello_card.due_date:
189             new_tw_task['due'] = trello_card.due_date
190         new_tw_task['trelloid'] = trello_card.id
191         new_tw_task['trellolistname'] = list_name.decode('utf-8')
192         new_tw_task.save()
193         if list_name == doing_list_name:
(Pdb) trello_card.name
u'Spicy Boat Noodles at Bangkok\u2019s Victory Monument'

So we're trying to decode something that is not encoded. If we encode it first, we can decode it:

(Pdb) print trello_card.name
Spicy Boat Noodles at Bangkok’s Victory Monument
(Pdb) print trello_card.name.encode('utf-8')
Spicy Boat Noodles at Bangkok’s Victory Monument
(Pdb) print trello_card.name.encode('utf-8').decode('utf-8')
Spicy Boat Noodles at Bangkok’s Victory Monument

My guess is that in the past py-trello did not return unicode strings, so it was necessary to decode them first. But now it looks like the .decode(...) calls are not necessary.

trellowarrior.py: error: unrecognized arguments: --trello-name

I'm getting this on install:

trellowarrior.py: error: unrecognized arguments: --trello-name xxx

using the line given from the docs:

trellowarrior.py -c path/to/your/configfile authenticate --api-key your_api_key --api-key-secret your_api_secret --trello-name TrelloWarrior --expiration 30days

...is there something I could have done wrong?

I cloned the project locally and have installed both of the python libraries. API Keys should be good (they came from Trello - as suggested).

I'm running Debian Buster.

cannot sync - get: ImportError: cannot import name lru_cache

Nice project - I'm struggling to get started with it though :(
I've just followed the README to install TrelloWarrior, but I'm not able to call TrelloWarrior with thh authenticate command.

I have:

(trw) marsh@wuji:~$ pip2 show py-trello tasklib
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
Name: py-trello
Version: 0.17.1
Summary: Python wrapper around the Trello API
Home-page: https://trello.com/board/py-trello/4f145d87b2f9f15d6d027b53
Author: Richard Kolkovich
Author-email: [email protected]
License: BSD License
Location: /home/marsh/trw/lib/python2.7/site-packages
Requires: pytz, requests, requests-oauthlib, python-dateutil
Required-by: trellowarrior
---
Name: tasklib
Version: 2.2.0
Summary: Python Task Warrior library
Home-page: https://github.com/robgolding63/tasklib
Author: Rob Golding
Author-email: [email protected]
License: BSD
Location: /home/marsh/trw/lib/python2.7/site-packages
Requires: tzlocal, pytz
Required-by: trellowarrior

when authorising I get:

(trw) marsh@wuji:~$ trellowarrior auth --api-key 5dc73ba01fd7a7d6b9b06f08b24e0f45 --api-key-secret xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx --expiration 30days --name TrelloWarrior
Traceback (most recent call last):
  File "/home/marsh/trw/bin/trellowarrior", line 5, in <module>
    from trellowarrior.main import main
  File "/home/marsh/trw/local/lib/python2.7/site-packages/trellowarrior/main.py", line 13, in <module>
    from tasklib.task import Task
  File "/home/marsh/trw/local/lib/python2.7/site-packages/tasklib/__init__.py", line 1, in <module>
    from .backends import TaskWarrior
  File "/home/marsh/trw/local/lib/python2.7/site-packages/tasklib/backends.py", line 9, in <module>
    from functools import lru_cache
ImportError: cannot import name lru_cache

Have I done something stupid?

Multiple "doing" lists?

I'm interested in support for multiple Trello lists for mapping to the "doing" status that could be differentiated with tags or a suffix to the project name. Just wondering if this is something that would be precluded or made more difficult by the current design in any way, and, if not, if this is something you'd accept a PR for.

due date removed in Taskwarrior do not propagate

  1. I add a due date in Taskwarrior.
  2. Run trellowarrior sync, due date syncs to Trello.
  3. Remove due date in Taskwarrior
  4. run trellowarrior sync, due date does not go away in Trello, and due date returns to task in taskwarrior

Timezone offsets cause due dates to be wrongly changed

Task warrior stores dates and times as UTC, and trello gives them with a timezone offset according to your local time (maybe that's the local time of who created the card, don't know). Somewhere during syncing, this timezone information is lost and the card due dates get moved back or forward according to the timezone offset. It must be something like this:

  • trellowarrior downloads trello cards (printing them in the console shows that timezone info is present there at least)
  • checks if modified by comparing to taskwarrior tasks
  • XXX here is where maybe tz info is dropped
  • since the dates are different, it syncs one way or another with the new date (may be correct for utc tz, but somewhere the timezone is re-interpreted and thus the date is wrong)

I'm in timezone UTC+10:30, and every time i run trellowarrior to sync, it pushes the due dates of cards/tasks forward by several hours (haven't determined if consistent, or by what exact amount each time)

TL;DR: a bug in timezone handling is causing due dates to be wrongly changed on sync when certain conditions are met.

Unintended new cards on sync

Hi ! Thanks for this amazing piece of software.

I have a few issues with it though,

Expected behaviour
On a board, when adding a card, when adding a card and syncing, everything sync properly, and I have the same card / task on both applications.

Observed behaviour
With each sync, a few new cards are added. The number of cards added is related to the number of cards already present.

It also seems that my tasks on taskwarrior have a few urls, as if there were no checks of an already present URL / card, and thus the creation of a new card.

After a few syncs on a blanck board with one task, it looks like that :
pic-full-210412-0806-20

Here are the contents of such a "created by sync" card on taskwarrior :

# Name               Editable details
# -----------------  ----------------------------------------------------
# ID:                22
# UUID:              xxxxxxxxxxx
# Status:            Pending
# Mask:              
# iMask:             
  Project:           test
# Separate the tags with spaces, like this: tag1 tag2
  Tags:              
  Description:       trellolistname:'A FAIRE'
  Created:           2021-04-12 08:09:46
  Started:           
  Ended:             
  Scheduled:         
  Due:               
  Until:             
  Recur:             
  Wait until:        
# Modified:          2021-04-12 08:10:18
  Parent:            
# Annotations look like this: <date> -- <text> and there can be any number of them.
# The ' -- ' separator between the date and text field should not be removed.
# A "blank slot" for adding an annotation follows for your convenience.
  Annotation:        2021-04-12 08:09:46 -- [Trello URL] https:\/\/trello.com\/c\/azertyuiop
  Annotation:        2021-04-12 08:10:18 -- [Trello URL] https:\/\/trello.com\/c\/lollipop ##they are different cards, with different links. 
  Annotation:        2021-04-12 08:21:56 -- 
# Dependencies should be a comma-separated list of task IDs/UUIDs or ID ranges, with no spaces.
  Dependencies:      
# User Defined Attributes
  UDA priority:      
  UDA trelloid:      
  UDA trellolistname: 
# End

Configuration files order

RawConfigParser.read([file1, file2, ...]) try to read all the files given as argument and override the conf values with the last read.

The order of the configuration file list is important and it should be clear to the user that a merge will occur. If a merge is not intended, it's easy to fix (I can create the PR later).

In all cases, what is the order of priority for the conf files ? I'm in favor of (by increasing priority) :

  • ~/.config/trellowarrior/trellowarrior.conf
  • ~/.trellowarrior.conf
  • ./trellowarrior.conf

Help with `sync_projects` to run `trellowarrior sync`

Hey,
Thanks for the amazing work with this project. I'm really excited to get it going.

I'm on Arch Linux

I installed trellowarrior through the AUR successfully

Right now I'm setting everything up, the whole API setup was super clear thanks for the clean instructions.

I got everything regarding the API working

Issues with Mandatory Fields after sync_projects

I only run into a problem with running the initial trellowarrior sync

There's something I'm not setting correctly in the last MANDATORY FIELDS

sync_projects
Can I have more info please on how to fill-up this field? What is meant by Define what sections are loaded,

sync_projects MANDATORY. Define what sections are loaded, separated by spaces.

Then I filled up these ones

taskwarrior_project_name MANDATORY. The name of project in Taskwarrior.
trello_board_name MANDATORY. The name of Trello Board.

My trello bard is called "TODO"
so I put this in my trellowarrior.conf
which was by defauly created in:
~/.config/trellowarrior/trellowarrior.conf

taskwarrior_project_name = TODO
trello_board_name = TODO

Should the task warrior project name be the same?

overall this is what my trellowarrior.conf looks like

trello_api_key = ********************************
trello_api_secret = ****************************************************************
trello_token = ****************************************************************
trello_token_secret = ********************************
sync_projects
taskwarrior_project_name = TODO
trello_board_name = TODO

This is the error I get

┗━━━━━━  trellowarrior sync
Traceback (most recent call last):
  File "/usr/bin/trellowarrior", line 33, in <module>
    sys.exit(load_entry_point('trellowarrior==1.2.1', 'console_scripts', 'trellowarrior')())
  File "/usr/lib/python3.8/site-packages/trellowarrior/main.py", line 128, in main
    config.configure(config_file=args.config, projects=args.projects)
  File "/usr/lib/python3.8/site-packages/trellowarrior/config.py", line 62, in configure
    config_parser.read(self.config_file)
  File "/usr/lib/python3.8/configparser.py", line 697, in read
    self._read(fp, filename)
  File "/usr/lib/python3.8/configparser.py", line 1113, in _read
    raise e
configparser.ParsingError: Source contains parsing errors: '/home/santi/.config/trellowarrior/trellowarrior.conf'
	[line  6]: 'sync_projects\n'

I'm sure I'm using sync_projects wrong I just need some direction on how to do it correctly and some help to see if there's anything else I'm missing.

Specs

Linux Manjaro XFCE with Awesome Window Manager

Thanks for the help!

2 computers with trello questions, current setbacks

I've just set up trello warrior to work from my linux laptop and my iMac.

This way I can sink them both to be indenticual and sync everything with the same trelloboard.

after making changes in my iMac and doing trellowarrior sync I move to my Linux laptop and once I do trellowarrior sync

I get the following

requests.exceptions.ConnectionError: HTTPSConnectionPool(host='api.trello.com', port=443): Max retries exceeded with url: /1/members/me/boards/?filter=open (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7f7ce3078ca0>: Failed to establish a new connection: [Errno -2] Name or service not known'))

I've also gotten

  File "/usr/lib/python3.8/site-packages/trello/trelloclient.py", line 231, in fetch_json
    raise ResourceUnavailable("%s at %s" % (response.text, url), response)
trello.exceptions.ResourceUnavailable: {"message":"Rate limit exceeded: requests per interval for API token","error":"API_TOKEN_LIMIT_EXCEEDED"} at https://api.trello.com/1/cards/********************* (HTTP status: 429)

If I open that link to api.trello.com I get this
image

Is there anyway to search what card it is? Either in trello, or with task warrior, since it's not a taskwarrior ID I can not easily search it, to see if that specific card is causing conflicts.

For both oth this errors, If I try again after 1 minute or 2 trellowarrior sync works again correctly.


Some tasks not showing in tasks' count

After this the only issue I can't figure out why is task count is not showing, I'm not sure if some tasks were not synced

I use VIT to visualize my tasks and edit them


when I go to next in my Linux laptop (the first computer where I set up all of my tasks) I have
177 tasks shown

after a trellowarrior sync

my imac shows

159 tasks shown

I can't figure out what are the missing tasks, nor do I get an error after sync, is there anything I'm missing.


I made the set up in my imac exactly the same as my linux set up. I copied the exact same api numbers, is this correct?

Please, let me know if there's any part of the process I'm missing, to have the exact same setup in both computer and in trello.

Thank you

Trellowarrior finds closed boards

To reproduce

  • Create Board A
  • Close Board A
  • Create another Board A
  • Add a task to the trellowarrior project with trello_board_name set to Board A

What I see

The card is added to the closed board.

What I expect to see

The card is added to the new open board.

Filtering by the assignee's username

This project works great for a personal board, but when I tried to run sync on a collaborative board, it would import all projects regardless of the assignee. The owner's username should be used to filter them out.

Some problem with 'localtime'

So I tried to run trellowarrior and it get's me this error:

Traceback (most recent call last):
  File "/usr/lib/python3.10/zoneinfo/_common.py", line 12, in load_tzdata
    return importlib.resources.open_binary(package_name, resource_name)
  File "/usr/lib/python3.10/importlib/resources.py", line 46, in open_binary
    return reader.open_resource(resource)
  File "/usr/lib/python3.10/importlib/abc.py", line 433, in open_resource
    return self.files().joinpath(resource).open('rb')
  File "/usr/lib/python3.10/pathlib.py", line 1119, in open
    return self._accessor.open(self, mode, buffering, encoding, errors,
FileNotFoundError: [Errno 2] No such file or directory: '/home/dinhego/.local/lib/python3.10/site-packages/tzdata/zoneinfo/localtime'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/sbin/trellowarrior", line 33, in <module>
    sys.exit(load_entry_point('trellowarrior==1.3.2', 'console_scripts', 'trellowarrior')())
  File "/sbin/trellowarrior", line 25, in importlib_load_entry_point
    return next(matches).load()
  File "/usr/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/usr/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/usr/lib/python3.10/site-packages/trellowarrior/main.py", line 13, in <module>
    from trellowarrior.commands.sync import sync
  File "/usr/lib/python3.10/site-packages/trellowarrior/commands/sync.py", line 9, in <module>
    from trellowarrior.clients.trellowarrior import TrelloWarriorClient
  File "/usr/lib/python3.10/site-packages/trellowarrior/clients/trellowarrior.py", line 9, in <module>
    from trellowarrior.clients.taskwarrior import TaskwarriorClient
  File "/usr/lib/python3.10/site-packages/trellowarrior/clients/taskwarrior.py", line 10, in <module>
    from tasklib.backends import TaskWarrior as Client
  File "/usr/lib/python3.10/site-packages/tasklib/__init__.py", line 1, in <module>
    from .backends import TaskWarrior
  File "/usr/lib/python3.10/site-packages/tasklib/backends.py", line 11, in <module>
    from .task import Task, TaskQuerySet, ReadOnlyDictView
  File "/usr/lib/python3.10/site-packages/tasklib/task.py", line 10, in <module>
    from .serializing import SerializingObject, local_zone
  File "/usr/lib/python3.10/site-packages/tasklib/serializing.py", line 13, in <module>
    local_zone = ZoneInfo('localtime')
  File "/usr/lib/python3.10/zoneinfo/_common.py", line 24, in load_tzdata
    raise ZoneInfoNotFoundError(f"No time zone found with key {key}")
zoneinfo._common.ZoneInfoNotFoundError: 'No time zone found with key localtime'

tzdata is installed, apparently, when I run pip list

[low priority] `sync_projects` and `sync_project` ambiguity or a parsing bug when quoting a string

It's not a high priority, as it a PEBKAC, still shows how one can make a mistake. If discussions were enabled I'd wouldn't make an issue out of this. Especially that I've just made the same mistake as in #21. Still there could be an issue with quoting a string.

As far as I see in the docs and in the code the configuration stanza is sync_projects (ending with a “s”). Yet if I quote the string:

❯ grep '^sync' ~/.config/trellowarrior/trellowarrior.conf
sync_projects = 'project_name'
❯ trellowarrior -v sync
INFO:TrelloWarrior:Setting loglevel to INFO
Traceback (most recent call last):
  File "/home/dzwiedziu/.local/bin/trellowarrior", line 8, in <module>
    sys.exit(main())
  File "/home/dzwiedziu/.local/lib/python3.10/site-packages/trellowarrior/main.py", line 128, in main
    config.configure(config_file=args.config, projects=args.projects)
  File "/home/dzwiedziu/.local/lib/python3.10/site-packages/trellowarrior/config.py", line 129, in configure
    logger.warning('Missing config section for sync project \'{}\', ignoring it'.format(sync_project))
NameError: name 'sync_project' is not defined

...so I've changed to sync_project:

❯ sed -i -e 's/^sync_projects/sync_project/' ~/.config/trellowarrior/trellowarrior.conf
❯ grep '^sync' ~/.config/trellowarrior/trellowarrior.conf
sync_project = 'project_name'
❯ trellowarrior -v sync
INFO:TrelloWarrior:Setting loglevel to INFO
No projects to sync

This made me search the docs and code again, as I was overthinking what can be the issue. AFAIK now trellowarrior did exactly what it was coded for – no sync_projects, no sync.

The fix? Remove apostrophes from sync_projects:

❯ grep '^sync' ~/.config/trellowarrior/trellowarrior.conf
sync_projects = project_name
❯ trellowarrior -v sync
INFO:TrelloWarrior:Setting loglevel to INFO
INFO:trellowarrior.clients.trellowarrior:Syncing project project_name step 1: delete Trello cards that already deleted in Taskwarrior
INFO:trellowarrior.clients.trellowarrior:Syncing project project_name step 2: syncing changes between Taskwarrior and Trello
INFO:trellowarrior.clients.trellowarrior:Syncing project project_name step 3: delete Takswarrior tasks that already deleted in Trello
INFO:trellowarrior.clients.trellowarrior:Syncing project project_name step 4: upload new Takswarrior tasks
INFO:trellowarrior.clients.trellowarrior:Project project_name synchronized

Error when sync deleted card

After deleting task in taskwarrior, trellowarrior sync return this error:

Traceback (most recent call last):
  File "/home/username/.local/bin/trellowarrior", line 8, in <module>
    sys.exit(main())
  File "/home/username/.local/lib/python3.8/site-packages/trellowarrior/main.py", line 134, in main
    args.func(args)
  File "/home/username/.local/lib/python3.8/site-packages/trellowarrior/commands/sync.py", line 15, in sync
    trellowarrior_client.sync_project(project)
  File "/home/username/.local/lib/python3.8/site-packages/trellowarrior/clients/trellowarrior.py", line 196, in sync_project
    self.trello_client.delete_card(taskwarrior_deleted_task['trelloid'])
AttributeError: 'TrelloClient' object has no attribute 'delete_card'

Do I miss any option in trellowarrior.conf?

[personal]
taskwarrior_project_name = REMIND
trello_board_name = remind
trello_todo_list = To do
trello_doing_list = Doing
trello_done_list = Done

Apply a cookiecutter template

Just as a heads-up: I'm in the process of applying cookiecutter to trellowarrior.
This adds a bunch of goodies like support for Sphinx docs, Travis CI, pytest, and the Click CLI framework.

At the moment this is mostly just a whole lot of stubs. Here's the big diff.
(It includes some tweaks to trellowarrior conf parsing which should be considered separately.)

I just wanted to mention it to check if you think it's a worthwhile idea.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.