SchedPlus

API Reference

CurrentPublication 1By @ZFordDev

SchedPlus Python API Reference

SchedPlus exposes its task-management functionality through the scheduler core.

Applications and user interfaces integrating with SchedPlus should use this layer rather than accessing the SQLite database directly.

Scheduler Core

logic.scheduler.Task

Task is a dataclass representing a scheduled task.

Its core fields are:

Field Description
id Unique task identifier (UUID)
date Scheduled date
time Scheduled time
text Task description
createdAt Creation timestamp
updatedAt Last modification timestamp

Additional fields introduced in v0.9.0 include:

Field Description
completed Completion status
completedAt Completion timestamp
notes Additional task notes
priority Task priority
duration Estimated duration
category Task category
recurrence Recurring schedule
recurrenceEnd Recurrence end date
reminder Reminder configuration

New tasks receive a UUID and UTC ISO timestamps by default.

logic.scheduler.Scheduler

Scheduler manages task validation, persistence and the in-memory task list.

Method or property Behaviour
load_tasks() Loads tasks from SQLite into memory and returns the list
get_tasks() Returns the current in-memory task list
add_task(date, time, text) Validates, saves and returns a new Task
update_task(task) Validates and persists changes to an existing task
delete_task(task_id) Removes a task from storage and memory
complete_task(task_id) Completes a task and generates the next occurrence for recurring tasks
uncomplete_task(task_id) Reverses task completion
undo_manager Provides access to the UndoManager for reversing recent actions

Example: Create and Update a Task

python
from logic.scheduler import Scheduler

scheduler = Scheduler()
scheduler.load_tasks()

task = scheduler.add_task(
    "2026-08-20",
    "09:30",
    "Review schedule"
)

task.text = "Review the weekly schedule"
scheduler.update_task(task)

This example loads the task list, creates a task and updates its description using the scheduler core.

Task Validation

logic.validation

The validate_task(task) function validates a task-like object and trims applicable values in place.

Validation requires:

  • A valid calendar date in YYYY-MM-DD format
  • A valid 24-hour time in HH:MM format
  • A non-empty task description

Invalid task data raises ValidationError.

Use the scheduler's task-management methods for normal application operations, as these apply validation before persisting changes.

SQLite Storage

logic.storage.sqlite_storage

The storage module provides the database operations used internally by Scheduler.

Function Purpose
initialize_database() Initializes or checks the database
create_entry(task) Creates a task record
update_entry(task) Updates an existing record
delete_entry(task_id) Deletes a record
get_entry(task_id) Retrieves a record by ID
list_entries() Retrieves stored task records

Database Initialization

Call initialize_database() before using storage from a new application boundary.

The function returns:

python
RecoveryInfo | None

When recovery information is available, RecoveryInfo includes the preserved database path and a user-facing message.

Storage Errors

Database failures are reported through StorageError, including:

  • Unavailable or read-only databases
  • Locked or corrupted databases
  • Integrity failures
  • Incompatible database schemas
  • Unexpected storage conditions

If a database uses an unsupported newer schema, SchedPlus reports it as unavailable and does not modify it.

Direct Storage Access

Important: The storage module is a low-level interface.

Directly modifying the database while a Scheduler instance is active can leave its in-memory task list out of date.

After making external storage changes, call load_tasks() to refresh the scheduler's state.

For normal application integrations, prefer Scheduler over direct storage operations.

DocsHub · Capybara

Documentation

SSchedPlus@ZFordDev