A Python application that synchronizes Canvas assignments with Todoist tasks. This integration automatically fetches assignments from Canvas's ICS feed and creates corresponding tasks in Todoist, organizing them by course projects.
- Real-time Synchronization: Continuously monitors Canvas calendar feed for new assignments
- Smart Course Mapping: Automatically maps Canvas courses to Todoist projects
- Persistent Storage: SQLite database to track sync status and prevent duplicates
- Robust Error Handling: Comprehensive logging and error recovery mechanisms
- Flexible Configuration: Environment-based configuration for easy deployment
- Python 3.8+: Core programming language
- SQLite: Local database for event tracking
- icalendar: ICS feed parsing
- Todoist API: Task creation and management
- Docker: Containerization (optional)
- Python 3.8 or higher
- Todoist Premium account (for API access)
- Canvas calendar feed URL (instructions to obtain)
- Docker (optional, for containerized deployment)
- Clone the repository:
git clone https://github.com/yourusername/canvas-todoist-sync.git
cd canvas-todoist-sync
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Create a
.env
file in the project root:
CANVAS_ICS_URL=your_canvas_ics_url
TODOIST_API_TOKEN=your_todoist_api_token
FETCH_INTERVAL=3600 # Optional: defaults to 1 hour
- Build the Docker image:
docker build -t canvas-todoist-sync .
- Run the container:
docker run -d \
--name canvas-todoist-sync \
-e CANVAS_ICS_URL=your_canvas_ics_url \
-e TODOIST_API_TOKEN=your_todoist_api_token \
canvas-todoist-sync
- Build the container:
docker-compose build
- Start the container:
docker-compose up -d
Makefile contains aliases to these commands for quick access
The application uses a configuration system defined in config.py
. Key configurations include:
- Course to Project mapping in
COURSE_PROJECT_MAPPING
- Environment variables for API tokens and URLs
- Configurable fetch interval
The project follows a modular architecture with clear separation of concerns:
- ICSWatcher: Handles Canvas calendar feed monitoring
- EventProcessor: Processes and filters assignment events
- TodoistCreator: Manages Todoist task creation
- Database: Provides persistent storage and tracking
ICSWatcher
fetches and parses the Canvas ICS feedEventProcessor
filters assignments and extracts relevant dataDatabase
tracks processed events and their sync statusTodoistCreator
creates tasks in mapped Todoist projects
The application uses regex pattern matching to extract course numbers from assignment titles:
pattern = r'$$((?:CCS_)?\d{4}[A-Z]{2,3}_[A-Z_]+_\d+(?:-\d+)?(?:_SEC\d+|_ALL_SECTIONS)?)$$'
Comprehensive error handling ensures reliability:
- Connection error recovery
- Duplicate event prevention
- Failed sync tracking and retry capability
CREATE TABLE IF NOT EXISTS events (
uid TEXT PRIMARY KEY,
title TEXT,
course_number TEXT,
due_date TEXT,
processed_date TEXT,
todoist_task_id TEXT,
sync_status TEXT
)
Contributions are welcome! Please feel free to submit a Pull Request.
This project is licensed under the MIT License - see the LICENSE file for details.
- Add support for assignment details and descriptions
- Add web interface for configuration
- Support for multiple Canvas calendars
- Task priority mapping
This project was born from the need to streamline academic task management. As a student using both Canvas LMS and Todoist, I found myself manually copying assignments between platforms. This automation solution not only saves time but also ensures no assignments are missed.
The implementation showcases modern Python development practices including:
- Context managers for database connections
- Environment-based configuration
- Modular architecture
- Comprehensive logging
- Docker containerization