Skip to main content

Taskwarrior - Google Calendar synchroniser

This project has now migrated to taskwarrior-syncall. Please use that instead.


master devel
PyPI version Downloads Code style: black
 _            _                                _
| |_ __ _ ___| | ____      __   __ _  ___ __ _| |    ___ _   _ _ __   ___
| __/ _` / __| |/ /\ \ /\ / /  / _` |/ __/ _` | |   / __| | | | '_ \ / __|
| || (_| \__ \   <  \ V  V /  | (_| | (_| (_| | |   \__ \ |_| | | | | (__
 \__\__,_|___/_|\_\  \_/\_/____\__, |\___\__,_|_|___|___/\__, |_| |_|\___|
                         |_____|___/           |_____|   |___/

Description

taskw_gcal_sync provides a solution for bidirectional synchronisation between Taskwarrior and Google Calendar. Given a Calendar name for Google Calendar and a filter for Taskwarrior (currently only a single tag is supported and tested) synchronise all the events between them.

Overall, it supports synchronisation on the following events:

  • Creation of an event
  • Modification of an (existing) event
  • Deletion of an event

The aforementioned features should work bidirectional, meaning a reminder created, modified, or deleted from Google Calendar should also be created, modified, or deleted respectively in TaskWarrior and vice-versa

Demo - first run - populating calendar in GCal

demo_gif

Motivation

While Taskwarrior is an excellent tool when it comes to keeping TODO lists, keeping track of project goals etc., lacks the portability, simplicity and minimalistic design of Google Calendar. The latter also has the following advantages:

  • Automatic sync across all your devices
  • Comfortable addition/modification of events using voice commands
  • Actual reminding of events with a variety of mechanisms

Installation instructions

Requirements:

Installation Options:

  • Pypi (may not contain latest version): pip3 install --user --upgrade taskw_gcal_sync

  • Github: pip3 install --user git+https://github.com/bergercookie/taskw_gcal_sync

  • Download and install devel branch locally - bleeding edge

    git clone https://github.com/bergercookie/taskw_gcal_sync
    cd taskw_gcal_sync
    git checkout devel
    pip3 install --user --upgrade .
    
  • Setup using poetry - handy for local development:

    git clone https://github.com/bergercookie/taskw_gcal_sync
    poetry install
    # get an interactive shell
    poetry shell
    
    # now tw_gcal_sync is in your PATH in this shell and you can also edit and the
    # changes will take instant effect
    ...
    

Override Calendar API key

Unfortunately I've yet to verify this app with Google so new users are currently blocked from using it. To bypass that you can register for your own developer account with the Google Calendar API with the following steps:

Firstly, removed the ~/.gcal_credentials.pickle file on your system since that will be reused if found by the app.

For creating your own Google Developer App:

  • Go to the Google developer console
  • Make a new project
  • From the sidebar go to API & Services and once there click the ENABLE APIS AND SERVICES button
  • Look for and Enable the Calendar API

Your newly created app now has access to the Calendar API. We now have to create and download the credentials:

  • Again, from the sidebar under API And Services click Credentials

  • Enable the Calendar API

  • On the sidebar click Credentials, and once there click CREATE CREDENTIALS

  • Create a new OAuth Client ID. Set the type to Desktop App (app name is not important).

  • Finally download the credentials in JSON form by clicking the download button as shown below. This is the file you need to point to when running tw_gcal_sync.

    download-btn

To specify your custom credentials JSON file use the --gcal-secret flag as follows:

tw_gcal_sync -c "<calendar-name>" -t "<taskwarrior-tag>" --gcal-secret "<path/to/downloaded/json/file>"

Usage instructions

Run the tw_gcal_sync to synchronise the Google calendar of your choice with the selected Taskwarrior tag(s). Run with --help for the list of options.

# Sync the +remindme Taskwarrior tag with the calendar named "TW Reminders"

tw_gcal_sync --help
tw_gcal_sync -t remindme -c "TW Reminders"

Mechanics / Automatic Synchronisation

To achieve synchronization across the two services, we use a push-pull mechanism which is far easier and less troublesome than an automatic synchronization solution. In case the latter behavior is desired, users may just run the script periodically e.g., using cron:

$ crontab -e
...

# Add the following to sync every 10' - modify Calendar and Tag name accordingly
# See output and potential errors in your system logs (e.g., `/var/log/syslog`)
*/10 * * * * tw_gcal_sync -c "TW Reminders" -t "remindme"

Troubleshooting

  • Having trouble installing or using the tool? Take a look at either the continuous-integration configuration or the unittsests for the installation steps or the recommended way of using the python code respectively.

  • Something doesn't work? Does the script fail midway through?

    • Record the problem and report it in the ISSUES page. Include as much information as possible so that I can reproduce it.

    • Clean the configuration file. By default that's going to be $HOME/.config/taskw_gcal_sync:

      rm -rf ~/.config/taskw_gcal_sync

    • Remove the corresponding Google Calendar

    • Rerun synchronisation from scratch to populate Google Calendar with all the events from your selected taskwarrior filter.

Self Promotion

If you find this tool useful, please star it on Github

TODO List

See ISSUES list for the things that I'm currently either working on or interested in implementing in the near future. In case there's something you are interesting in working on, don't hesitate to either ask for clarifications or just do it and directly make a PR.

Release files for taskw-gcal-sync 1.0.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for taskw-gcal-sync 1.0.2
File Size Uploaded
taskw_gcal_sync-1.0.2.tar.gz 23.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for taskw-gcal-sync 1.0.2
File Interpreter ABI Platform
taskw_gcal_sync-1.0.2-py3-none-any.whl Python 3 none any Details

Total release size: 47.0 kB

Release files / taskw_gcal_sync-1.0.2.tar.gz

Download URL taskw_gcal_sync-1.0.2.tar.gz
Size 23.1 kB
Tags Source
SHA-256 checksum
How to use checksums
8ca236f27b864b17712757f9f74c9551fda0c471193654cca732d74731461f50
BLAKE2b-256 checksum
How to use checksums
4dab2a5155f373f66de61f16577542233727dfba1a6094b45405083cf6b1cce0
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-91-generic

Release files / taskw_gcal_sync-1.0.2-py3-none-any.whl

Download URL taskw_gcal_sync-1.0.2-py3-none-any.whl
Size 24.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
1666d243b0546bd2f1c9bbc65ec5c3c05a5112624cfd5cff3ec2fe9b1bc8b435
BLAKE2b-256 checksum
How to use checksums
4d50e9d282fe787295216ef7c03d8a67312fc4eb192ec526b93af3f870494a50
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via poetry/1.1.12 CPython/3.8.10 Linux/5.4.0-91-generic

Release history Release notifications | RSS feed

This release

1.0.2 This release

2 release files

1.0.1

2 release files

1.0.0

2 release files

0.7.0

2 release files

0.6.0

2 release files

0.5.1

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.3.1

2 release files

0.0.2

2 release files

0.0.1

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page