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

Do caldalv improvements #129

Merged
merged 2 commits into from
Aug 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
72 changes: 42 additions & 30 deletions docs/readme-tw-caldav.md
Original file line number Diff line number Diff line change
@@ -1,46 +1,55 @@
# [Taskwarrior](https://taskwarrior.org/) ⬄ Caldav Server
# [Taskwarrior](https://taskwarrior.org/) ⬄ CalDAV Server

## Description

Synchronize Taskwarrior tasks to a generic caldav server.
This service has been tested using a self-hosted [nextcloud](https://nextcloud.com/) server as well as , but should theoretically work with any server that implements the [caldav specification](https://www.rfc-editor.org/rfc/rfc4791)
Synchronize Taskwarrior tasks to a generic CalDAV server.
This service has been tested using a self-hosted
[nextcloud](https://nextcloud.com/) server as well as , but should theoretically
work with any server that implements the [CalDAV
specification](https://www.rfc-editor.org/rfc/rfc4791)

Upon execution, `tw_caldav_sync` will synchronize, and on subsequent runs of the
program keep synchronized, the following attributes (tw entries will be converted to a vCard format and visa versa):
program keep synchronized, the following attributes (TW entries will be
converted to a vCard format and visa versa):

## Demo - first run - populating tasklist in Nextcloud

![demo_gif](../misc/tw_caldav_sync.gif)

### Mappings

TW <-> Caldav will make the following mappings between items:

- `description` <-> `SUMMARY`
- `status` <-> `STATUS`
- `pending`, `waiting` <-> `NEEDS-ACTION`
- `completed` <-> `COMPLETED`
- `deleted` <-> `CANCELLED`
- TW `entry` <-> `CREATED`
- TW `end` <-> `COMPLETED`
- TW `modified` <-> `LAST-MODIFIED`
- TW `prioriy` <-> `PRIORITY`
- `""` <-> `None`
- `L` <-> 9
- `M` <-> 5
- `H` <-> 1
- TW `annotations` <-> `DESCRIPTION` (one annotation <-> one line in description)
- TW `uuid` <-> `X-SYNCALL-TW-UUID`
- TW `tags` <-> `CATEGORIES`
`tw_caldav_sync` will make the following mappings between items:

- `description` ↔ `SUMMARY`
- `status` ↔ `STATUS`
- `pending`, `waiting` ↔ `NEEDS-ACTION`
- `completed` ↔ `COMPLETED` / `CANCELLED` (using a custom `UDA`
`caldav_completion_status`, in Taskwarrior to mark cancelled items)
- `deleted` ↔ (deletion of CalDAV item)

Regarding timestamps:

- TW `entry` ↔ `CREATED`
- TW `end` ↔ `COMPLETED`
- TW `modified` ↔ `LAST-MODIFIED`
- TW `prioriy` ↔ `PRIORITY`
- `""` ↔ `None`
- `L` ↔ 9
- `M` ↔ 5
- `H` ↔ 1
- TW `annotations` ↔ `DESCRIPTION` (one annotation ↔ one line in description)
- TW `uuid` ↔ `X-SYNCALL-TW-UUID`
- TW `tags` ↔ `CATEGORIES`

### Current limitations

- No specific support for "waiting" tasks in Taskwarrior, they will be treated like any other "needs-action" caldav task
- No specific support for "waiting" tasks in Taskwarrior, they will be treated
like any other "needs-action" CalDAV task
- No support for recurring tasks sync in either direction

## Installation

Install the `syncall` package from PyPI, enabling the `caldav` and `Taskwarrior`
Install the `syncall` package from PyPI, enabling the CalDAV and `Taskwarrior`
extra:

```sh
Expand All @@ -58,19 +67,19 @@ project.
Use `--taskwarrior-tags ...` or `--taskwarrior-project` respectively for the
above

### Caldav
### CalDAV

In order to successfully run a sync, you will need the following flags set (mandatory):

- `--caldav-url`: URL where the caldav calendar is hosted at (including `/dav` if applicable)
- `--caldav-user`: Username required to authenticate your caldav instance
- `--caldav-url`: URL where the CalDAV calendar is hosted at (including `/dav` if applicable)
- `--caldav-user`: Username required to authenticate your CalDAV instance
- Can also be provided via the `CALDAV_USERNAME` environment variable
- `--caldav-passwd`, `--caldav-passwd-pass-path`: Path to your password `.gpg` file in your [password store](https://wiki.archlinux.org/title/Pass)
- Alternatively, the password can be provided directly via the `CALDAV_PASSWD` environment variable

The following flag is optional:

- `--calendar`: Name of the caldav Calendar to sync (will be created if not there), will default to `Personal` if not set
- `--calendar`: Name of the CalDAV Calendar to sync (will be created if not there), will default to `Personal` if not set

### Example Usage

Expand All @@ -88,8 +97,11 @@ CALDAV_USERNAME=myUser CALDAV_PASSWD=myPass tw_caldav_sync --caldav-url https://

## Future Work

- [ ] See if we can handle TW "waiting" tasks a little better (possibly by setting the caldav `start` field to when the wait expires)
- [ ] Consider how to refactor out extra steps in conversion, and just store caldav items in their vTodo formats (though this will make test files much uglier)
- [ ] See if we can handle TW "waiting" tasks a little better (possibly by
setting the CalDAV `start` field to when the wait expires)
- [ ] Consider how to refactor out extra steps in conversion, and just store
CalDAV items in their vTodo formats (though this will make test files much
uglier)

## See also

Expand Down
132 changes: 23 additions & 109 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ identify = "^2.6.0"
isort = "^5.13.2"
mock = "*"
mypy = "*"
pdbpp = "^0.10.3"
pre-commit = "^2.21.0"
pyfakefs = [
{ version = "^4.7.0", python = "<3.12" },
Expand Down
Loading