Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[gtasks] Add basic support for Google Tasks #79

Merged
merged 2 commits into from
Dec 23, 2023

Conversation

kisseliov
Copy link
Contributor

@kisseliov kisseliov commented Mar 12, 2023

Description

Added basic an integration with Google Tasks API to enable syncing Taskwarrior tasks as Google Tasks rather than events.

Fixes #21

Type of change

  • New feature (non-breaking change which adds functionality)
  • This change requires a documentation update

How Has This Been Tested?

Added tests similar to other integrations: conversions between Google Task and Taskwarrior task formats, creating, completing, deleting, annotating tasks.

Checklist:

  • My code follows the style guidelines of this project
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • Any dependent changes have been merged and published in downstream modules

@kstreser
Copy link

kstreser commented Aug 5, 2023

I like this very much! You are my hero. Thank you.

@bergercookie
Copy link
Owner

This works looks great and apologies I have not reviewed it sooner.

I'll be trying it out this weekend and I'll hopefully provide some feedback.

Thanks!

Copy link
Owner

@bergercookie bergercookie left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @kisseliov and sorry about the very late review.

All in all this is some great functionality! 👍🏾 🥳 . I haven't delved into it exhaustively but from a first look here's a few things to adress before merging:

  • I noticed that a completion of a task in google tasks result in a removal in taskwarrior. Is this intentional? This creates problems when tasks are marked as completed in Gtasks and then moved back to pending (again in gtasks): AssertionError: Item already has a UUID, try updating it instead of adding it. Could we instead have it so that a completion of a google task leads to a completion of the respective taskwarrior task?
  • Let's pt a higher-res gif - use something like gifski to generate it. I've used it with a command like this in the past: gifski --fast-forward 1.5 -o test.gif video.mp4
  • When creating the app in the Developer Console, the user needs to specifically add a bunch of scopes for the Google Tasks API to access: Create, edit, organize, and delete all your tasks and View your tasks. Could this be part of the readme notes?
  • Could we add a note in the tw<>gcal integration to redirect users to this integration instead? I think for the majority of cases a google task is what users would want - instead of a calendar event.

I'm also posting below a list of checks I usually do when I'm adding a new integration (sub XXX, YYY for Taskwarrior and Google Tasks :) ). if you have some time to go through them I 'd really appreciate, otherwise, no worries, I can do it on my own time.

  • Verify you can add items from XXX and they appear in YYY during the initial run with both sides being empty
  • Verify you can add items from XXX and they appear in YYY during the initial run with YYY being empty at first
  • Verify you can add items from YYY and they appear in XXX during the initial run with XXX being empty at first
  • Verify you can update the description of items from XXX and the changes appear in YYY
  • Verify you can update the description of items from YYY and the changes appear in XXX
  • Verify you can mark items as completed from XXX and they get completed in YYY
  • Verify you can mark items as completed from YYY and they get completed in XXX
  • Verify you can delete items from XXX and they get deleted in YYY
  • Verify you can delete items from YYY and they get deleted in XXX
  • Verify you can create completed items from XXX and they appear completed in YYY
  • Verify you can create completed items from YYY and they appear completed in XXX
  • Verify you can create deleted items from XXX and they appear deleted in YYY
  • Verify you can create deleted items from YYY and they appear deleted in XXX
  • Verify you can create in-progress items from XXX and they appear as in-progress/started in YYY
  • Verify you can create in-progress items from YYY and they appear as in-progress/started in XXX

Finally, putting this here so as to not forget, let's go through the following checks before merging:

  • Rebase branch on top of latest master
  • Resolve any conflicts
  • Squash all commits into one

readme-tw-gtasks.md Outdated Show resolved Hide resolved
syncall/google/gtasks_side.py Show resolved Hide resolved
syncall/tw_gtasks_utils.py Outdated Show resolved Hide resolved
syncall/tw_gtasks_utils.py Outdated Show resolved Hide resolved
syncall/types.py Outdated Show resolved Hide resolved
tests/conftest_gtasks.py Show resolved Hide resolved
pyproject.toml Outdated Show resolved Hide resolved
readme-tw-gtasks.md Outdated Show resolved Hide resolved
readme-tw-gtasks.md Outdated Show resolved Hide resolved
@bergercookie bergercookie added new-integration Adding support for a new integration of services tw_gtasks_sync labels Oct 30, 2023
@bergercookie
Copy link
Owner

Could you also add a line in generate-shell-completions.sh and call this script so as to generate new completions?

@kisseliov
Copy link
Contributor Author

@bergercookie All good! I'll work on it when I have some free time. :)

@bergercookie
Copy link
Owner

Hi @kisseliov ,

Did you have time to work on this? If not I can look at resolving some of the pending issues tomorrow.

@bergercookie
Copy link
Owner

Could you also add a line in generate-shell-completions.sh and call this script so as to generate new completions?

That's done now

@kisseliov
Copy link
Contributor Author

@bergercookie Hi! Not really, I would appreciate if you help :)

@bergercookie bergercookie self-assigned this Dec 22, 2023
@bergercookie
Copy link
Owner

I noticed that a completion of a task in google tasks result in a removal in taskwarrior. Is this intentional? This creates problems when tasks are marked as completed in Gtasks and then moved back to pending (again in gtasks): AssertionError: Item already has a UUID, try updating it instead of adding it. Could we instead have it so that a completion of a google task leads to a completion of the respective taskwarrior task?

When creating the app in the Developer Console, the user needs to specifically add a bunch of scopes for the Google Tasks API to access: Create, edit, organize, and delete all your tasks and View your tasks. Could this be part of the readme notes?

Could we add a note in the tw<>gcal integration to redirect users to this integration instead? I think for the majority of cases a google task is what users would want - instead of a calendar event.

All three points are now complete.

kisseliov and others added 2 commits December 23, 2023 13:42
Squashes the  following commits:

* [gtasks] Create tw_gtasks_sync.py based on tw_gcal_sync.py
* [gtasks] Comment out readline from dev dependencies, since it makes installation crash on macOS
* [gtasks] Install google-auth-httplib2 since google client requires it
* [gtasks] Add a line about tw_gtasks_sync executable to pyproject.toml
* [gtasks] Add cli option for google tasks list
* [gtasks] Implement gtasks_side.py based on gcal_side.py
* [gtasks] Remove default_event_duration param since Google tasks don't have duration
* [gtasks] Implement converters from Google Tasks to Taskwarrior and back
* [gtasks] Add get_task_completed_time method to GTasksSide class
* [gtasks] Change _identical_comparison_keys for Google tasks to compare based on title and notes
* [gtasks] Remove duration_serialize and tw_dudration_key imports
* [gtasks] Add Google Tasks to syncall __init__
* [gtasks] Remove opt_default_duration_event_mins from cli options
* [gtasks] Fix typo in tasklists request (tasklist -> tasklists)
* [gtasks] Remove unused timedelta import
* [gtasks] Remove unused timedelta import
* [gtasks] Fix typo (e -> t)
* [gtasks] Initialize notes and check if they are present on a given task
* [gtasks] Rename option from google-tasks-list to gtasks-list
* [gtasks] Set appropriate status for google tasks
* [gtasks] Check in 'completed' field is present on a task before trying to parse it
* [gtasks] Implement _clear_all_task_list_entries method using tasks().clear()
* [gtasks] Fix passing item id instead of item
* [gtasks] Add GTask type hint
* [gtasks] Fix GTaskItem type hint by making only some fields optional
* [gtasks] Add API reference link and apply formatting
* [gtasks] Add basic tests, parse datetime in tw_gtasks_utils before formatting it + formatting
* [gtasks] Add basic readme for gtasks sync
* [gtasks] Fix parsing cli argument for task list and API method
* [gtasks] Add GTasksList type
* [gtasks] Fix get_all_items method for GTasks and silence type warnings that arise due to google client library types being questionable
* [gtasks] Fix annotations being thrown away
* [gtasks] Check the length of annotations before iterating over them
* [gtasks] Check if annotations are even present
* Change check-added-large-files pre-commit hook to exclude option to ignore large demo gifs
* [gtasks] Add tw_gtasks_sync demo gif
* [gtasks] Update readme-tw-gtasks
* [gtasks] Return readline to pyproject dependencies
* [gtasks] Fix typo in readme-tw-gtasks
* [gtasks] Put auth-httplib2 under google extra
Includes  the following changes over the first iteration:

* [gtasks] Fix unittests
* [gtasks] Move docstrings before vars in GTasksItem, unrelated: Add
  ruff linter in dev-dependencies
* [gtasks] Run `generate-shell-completions`
* [docs][gtasks]
  * Refer to Taskwarrior in capitalized in READMEs
  * [gtasks] Add help page to main README
* [gtasks] Reduce code duplication between gtasks and gcal sides
* [gtasks] get_all_items to also list completed items (+gcal)
* [gtasks] Fix completion of tasks from gtasks -> TW
* [gcal] Remove unused method, correct typehints usage in gcal internals
* [aggregator] Correct typos
* [gtasks] Fix synchronization of due dates, notes
* [gtasks] Update demo gif
* [gtasks] Fix bug with single-letter title events not getting sync-ed properly
* [gtasks] Add note re the due dates in Google Tasks
* [gtasks] Use the "update" dates to trigger a sync
* [gtasks] Mark an item as changed if a date is different for more than
  1 minute - until now it was 10mins
@bergercookie
Copy link
Owner

Let's pt a higher-res gif - use something like gifski to generate it. I've used it with a command like this in the past: gifski --fast-forward 1.5 -o test.gif video.mp4

Also completed

@bergercookie
Copy link
Owner

Thank you so much for this work @kisseliov. 💯 💯 💯
I'll be merging this to main and soon I'll push a new version to pypi as well.

@bergercookie bergercookie merged commit a25a6eb into bergercookie:master Dec 23, 2023
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
new-integration Adding support for a new integration of services tw_gtasks_sync
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Sync as Google Tasks
3 participants