taskchampion

This module wraps TaskChampion in a Python API.

Most types and functions match those of the TaskChampion Rust API, with exceptions noted in the documentation here. See the TaskChampion documentation for details.

For the Rust Option type, the None variant is represented by Python's None, while the Some variant is represented by the contained value. For example, Task.get_value returns either None or a string containing the value.

Timestamps are represented as Python datetime.datetime values. UUIDs are represented as strings.

1from .taskchampion import *
2
3__doc__ = taskchampion.__doc__
4if hasattr(taskchampion, "__all__"):
5    __all__ = taskchampion.__all__
class Replica:

A replica represents an instance of a user's task data, providing an easy interface for querying and modifying that data.

A replica can only be used in the thread in which it was created. Use from any other thread will panic.

def new_on_disk(path, create_if_missing, access_mode=Ellipsis):

Create a Replica with on-disk storage.

This is equivalent to created a StorgeConfig::OnDisk with the given parameters and passing that to Replica::new.

Raises RuntimeError if the database does not exist, and create_if_missing is false

def new_in_memory():

Create a Replica with in-memory storage.

def create_task(self, /, uuid, ops):
def all_tasks(self, /):
def all_task_data(self, /):
def all_task_uuids(self, /):
def working_set(self, /):
def dependency_map(self, /, force):
def get_task(self, /, uuid):
def get_task_data(self, /, uuid):
def commit_operations(self, /, ops):
def sync_to_local(self, /, server_dir, avoid_snapshots):

Sync with a server crated from ServerConfig::Local.

def sync_to_remote(self, /, url, client_id, encryption_secret, avoid_snapshots):

Sync with a server created from ServerConfig::Remote.

def sync_to_gcp(self, /, bucket, credential_path, encryption_secret, avoid_snapshots):

Sync with a server created from ServerConfig::Gcp.

def rebuild_working_set(self, /, renumber):
def num_local_operations(self, /):
def num_undo_points(self, /):
def get_undo_operations(self, /):
def commit_reversed_operations(self, /, operations):
def expire_tasks(self, /):
class Task:

A TaskChampion Task.

This type is not Send, so it cannot be used from any thread but the one where it was created.

def into_task_data(self, /):
def get_uuid(self, /):
def get_status(self, /):
def get_description(self, /):
def get_entry(self, /):
def get_priority(self, /):
def get_wait(self, /):
def is_waiting(self, /):
def is_active(self, /):
def is_blocked(self, /):
def is_blocking(self, /):
def has_tag(self, /, tag):
def get_tags(self, /):
def get_annotations(self, /):
def get_uda(self, /, namespace, key):
def get_udas(self, /):
def get_modified(self, /):
def get_due(self, /):
def get_dependencies(self, /):
def get_value(self, /, property):
def set_status(self, /, status, ops):
def set_description(self, /, description, ops):
def set_priority(self, /, priority, ops):
def set_entry(self, /, entry, ops):
def set_wait(self, /, wait, ops):
def set_modified(self, /, modified, ops):
def set_value(self, /, property, value, ops):
def start(self, /, ops):
def stop(self, /, ops):
def done(self, /, ops):
def add_tag(self, /, tag, ops):
def remove_tag(self, /, tag, ops):
def add_annotation(self, /, annotation, ops):
def remove_annotation(self, /, timestamp, ops):
def set_due(self, /, due, ops):
def set_uda(self, /, namespace, key, value, ops):
def remove_uda(self, /, namespace, key, ops):
def set_legacy_uda(self, /, key, value, ops):
def remove_legacy_uda(self, /, key, ops):
def add_dependency(self, /, dep, ops):
def remove_dependency(self, /, dep, ops):
class TaskData:
def create(uuid, ops):
def get_uuid(self, /):
def get(self, /, value):
def has(self, /, value):
def update(self, /, property, value, ops):
def delete(self, /, ops):
class Operation:

A TaskChampion Operation.

This is an enum in Rust, represented here with four static constructors for the variants, four is_.. methods for determining the type, and getters for each variant field. The getters raise AttributeError for variants that do not have the given property.

def Create(uuid):
def Delete(uuid, old_task):
def Update(uuid, property, timestamp, old_value=None, value=None):
def UndoPoint():
def is_create(self, /):
def is_delete(self, /):
def is_update(self, /):
def is_undo_point(self, /):
value

Present on the Update variant.

old_value

Present on the Update variant.

uuid

Present on the Create, Update, and Delete variants.

old_task

Present on the Delete variant.

property

Present on the Update variant.

timestamp

Present on the Update variant.

class Operations:

A sequence of Operations.

This is a list-like type, and can be indexed, iterated over, and so on like any other list-like type.

def append(self, /, op):
class WorkingSet:
def largest_index(self, /):
def is_empty(self, /):
def by_index(self, /, index):
def by_uuid(self, /, uuid):
class DependencyMap:
def dependencies(self, /, dep_of):
def dependents(self, /, dep_on):
class Annotation:

An annotation for the task

entry
description
class Status:
Pending = Status.Pending
Completed = Status.Completed
Deleted = Status.Deleted
Recurring = Status.Recurring
Unknown = Status.Unknown
class Tag:

A TaskChampion Tag.

The constructor for this type parses its argument using the FromStr trait, and supports both synthetic and user tags.

def is_synthetic(self, /):
def is_user(self, /):
class AccessMode:
ReadOnly = AccessMode.ReadOnly
ReadWrite = AccessMode.ReadWrite