Canvas Calendar Sync: Canvas assignments to Google Calendar, kept current
$9
Canvas Calendar Sync is a small Python tool that copies your Canvas LMS assignments onto a dedicated Google Calendar and keeps them accurate every time it runs. Canvas's built-in calendar feed...
Read full descriptionDescription
Canvas Calendar Sync is a small Python tool that copies your Canvas LMS assignments onto a dedicated Google Calendar and keeps them accurate every time it runs.
Canvas's built-in calendar feed can't be customized, and one-off imports go stale the moment an instructor moves a deadline. This tool tracks each assignment by its Canvas ID, so every run makes your calendar match Canvas:
- New assignment: an event is created at the exact due time
- Due date or title changed: the existing event is updated in place, not duplicated
- Assignment removed: its event is deleted
- Lost state file: events carry a private tag, so tracking is rebuilt from the calendar instead of creating copies
$ python -m canvas_calendar_sync run --dry-run
New: BIO 110: Lab Report 4 (due Wed Oct 15, 11:59 PM) would be added
Moved: HIST 205: Essay 2 Draft Tue Oct 14, 11:59 PM -> Fri Oct 17, 11:59 PM would be updated
Removed: STAT 200: Quiz 5 (no longer in Canvas) would be deletedWho it's for
Students at any school that uses Canvas, plus tutors, parents, and developers who want deadlines in Google Calendar with reminders, colors, and sharing, and who are comfortable running a Python script on a schedule.
Features
- Works with any Canvas instance (
*.instructure.comor self-hosted) using your own access token. It only reads from Canvas. - Syncs into a separate calendar (created for you), with events marked free so they don't block your schedule
- Configurable titles, event length, reminders, time zone, and course include/exclude lists
- Skips ungraded or optional items by pattern, and doesn't backfill old past-due work on the first run
- Safety checks: it only touches events it created, never treats a failed Canvas request as "no assignments", and holds back mass deletions
--dry-runshows exactly what would change without changing anything- Optional Discord digest of calendar changes, new grades, and deadline-related announcements
- About 700 lines of readable Python with 3 dependencies and 30 offline tests
Setup overview
- Install the three Python dependencies.
- Create a Canvas access token in your Canvas account settings.
- Create a Google Cloud project, enable the Google Calendar API, and download a Desktop OAuth client. The README walks through it (about 15 minutes).
- Run the
authcommand once to authorize Google and list the courses that will sync. - Preview with
--dry-run, then schedule it with cron or Task Scheduler.
Disclaimer
Provided as is, without warranty. Canvas remains the official source for due dates, so always confirm important deadlines in Canvas. The tool depends on Canvas and Google APIs that may change. You run it with your own credentials and are responsible for its use on your accounts and under your school's policies.
Not affiliated with or endorsed by Instructure or Google. Canvas is a trademark of Instructure, Inc. Google Calendar is a trademark of Google LLC.
Files included
canvas-calendar-synccanvas-calendar-sync
teststests
- test_sync.pytest_sync.py14.2 KB
canvas_calendar_synccanvas_calendar_sync
- sync.pysync.py13 KB
- config.pyconfig.py4.2 KB
- gcal.pygcal.py3.7 KB
- canvas.pycanvas.py3.2 KB
- __main__.py__main__.py3 KB
- notify.pynotify.py840 B
- __init__.py__init__.py76 B
- README.mdREADME.md9.3 KB
- CHANGELOG.mdCHANGELOG.md626 B
- config.example.jsonconfig.example.json553 B
- requirements.txtrequirements.txt96 B
- .gitignore.gitignore57 B
README
canvas-calendar-sync/README.md
Canvas Calendar Sync
Puts every Canvas assignment on its own Google Calendar and keeps it accurate when instructors move due dates, rename assignments, or delete them.
Most Canvas-to-calendar setups (the built-in iCal feed, one-off imports) either can't be customized or go stale when a deadline moves. This tool tracks each Canvas assignment ID, so every run makes the calendar match Canvas:
- New assignment: an event is created at the due time.
- Due date or title changed: the existing event is updated in place.
- Assignment removed: its event is deleted.
- Reruns never duplicate. Events are tagged in the calendar itself, so even a lost state file is rebuilt instead of creating copies.
It also has:
- A separate calendar ("Canvas Assignments" by default, created for you) that you can color, hide, or share. Events are marked free, so they don't block your schedule.
- Safety checks: it only ever edits events it created. If Canvas fails to load a course, that course is skipped, not treated as empty. If many assignments vanish from a course at once, the deletions are held back and reported.
--dry-run, which shows exactly what would change without touching anything.- An optional Discord digest of calendar changes, new grades, and announcements that mention words like due, exam, or moved. Leave the webhook empty and it's off.
- A small codebase: about 700 lines of readable Python, three dependencies, and tests.
It only reads from Canvas. It never submits, edits, or changes anything in your Canvas account.
Requirements
- macOS, Linux, or Windows with Python 3.9+
- A Canvas account at any school (
*.instructure.comor a self-hosted Canvas) that allows students to create access tokens. Most schools do. - A Google account and a free Google Cloud project (step 3 walks through it)
Setup (about 15 minutes)
1. Install
pip install -r requirements.txt
cp config.example.json config.json2. Create a Canvas access token
- Log in to Canvas in a browser and open Account → Settings.
- Under Approved Integrations, click + New Access Token. Give it a purpose like "calendar sync" and an expiry date if you want one, then click Generate Token.
- Copy the token. Canvas only shows it once.
- In
config.json, setcanvas_base_urlto the address you use for Canvas (for examplehttps://yourschool.instructure.com). - Put the token in an environment variable named
CANVAS_TOKEN(recommended), or incanvas_tokeninconfig.json. Treat it like a password: it can read everything your Canvas account can see.
If + New Access Token is missing, your school has turned off student tokens and this tool can't connect.
3. Create Google Calendar credentials (one time; Google requires your own)
- Go to https://console.cloud.google.com/ and create a project (any name).
- Go to APIs & Services → Library, search for Google Calendar API, and click Enable.
- Go to APIs & Services → OAuth consent screen (called Google Auth Platform in newer consoles). Choose External, fill in an app name and your email, and add your own Google address as a test user.
- Go to Credentials → Create credentials → OAuth client ID, choose Desktop app, then Download JSON.
- Save the file as
~/.config/canvas-calendar-sync/credentials.json(or pointcredentials_fileinconfig.jsonat it). - Recommended for unattended use: on the consent screen page, click Publish app (move it to "In production"). Apps left in "Testing" have their sign-in expire every 7 days. You don't need Google's verification for your own use. You'll just see an "unverified app" warning once.
4. Authorize and check your courses
python -m canvas_calendar_sync authA browser opens once to authorize Google Calendar. The token is saved with owner-only
permissions. It then lists your active Canvas courses and marks which ones will sync. Use
include_courses or exclude_courses to leave out non-class courses like orientation shells.
5. Preview, then run
python -m canvas_calendar_sync run --dry-run
python -m canvas_calendar_sync runConfiguration
All keys are optional except the Canvas URL and token. Unknown keys are rejected so typos don't fail silently.
| Key | Default | What it does |
|---|---|---|
canvas_base_url | Your Canvas address. /api/v1 is added automatically. Env: CANVAS_BASE_URL. | |
canvas_token | Canvas access token. Env: CANVAS_TOKEN (takes priority). | |
calendar_name | Canvas Assignments | Calendar to sync into. Created if missing. |
calendar_id | Use a specific existing calendar ID instead of looking it up by name. | |
timezone | system | IANA name (America/Chicago) for due times shown in event text and output. |
title_format | {course}: {name} | Event title. Placeholders: {course}, {name}. |
course_label | code | Use the Canvas course code or the full course name as {course}. |
event_minutes | 30 | Event length, ending after the due time. |
reminder_minutes | null | null uses the calendar's defaults, [] turns reminders off, and [1440, 120] sets popups 1 day and 2 hours before. |
ignore_due_before_days | 7 | Don't add assignments that were due more than this many days ago, so the first run doesn't fill your calendar with the past semester. |
skip_name_patterns | (not graded), {optional} | Case-insensitive regexes. Matching assignments are not synced. |
include_courses | [] | Course IDs or text in the course label. If set, only these sync. |
exclude_courses | [] | Course IDs or text in the course label to leave out. |
max_deletes_per_course | 10 | If more assignments than this disappear from one course in one run, deletions are held back and reported. |
digest_grades | true | Report newly posted or changed grades. |
digest_announcements | true | Report new announcements that contain any of announcement_keywords. |
announcement_keywords | due, exam, moved, ... | Word starts to look for. An empty list reports every new announcement. |
discord_webhook_url | Optional. Env: DISCORD_WEBHOOK_URL. Empty means no Discord. | |
discord_send_when_empty | false | Post "No changes." on quiet runs, as a heartbeat. |
state_file, token_file, credentials_file | ~/.config/canvas-calendar-sync/ | File locations. |
On the first run, existing grades and announcements are only recorded, not reported, so you don't get a flood of old items.
Discord digest (optional)
In Discord, open Server Settings → Integrations → Webhooks → New Webhook, choose a
channel, and copy the URL into discord_webhook_url (or the DISCORD_WEBHOOK_URL
environment variable). The digest is posted only when something changed or failed, unless
discord_send_when_empty is on.
Run it automatically
macOS/Linux (cron), every hour:
0 * * * * cd /path/to/canvas-calendar-sync && CANVAS_TOKEN=... /usr/bin/python3 -m canvas_calendar_sync run >> sync.log 2>&1Windows: create a Task Scheduler task that runs python -m canvas_calendar_sync run in
this folder.
The command exits with code 1 if any course or digest step failed, so schedulers and monitoring can detect problems. Code 2 means a config error.
How it behaves
- The calendar mirrors Canvas. If you delete one of its events by hand, it comes back on
the next run. To hide an assignment permanently, add a
skip_name_patternsentry. - Courses that end (no longer active in Canvas) are left alone. Their events stay.
- Changing
calendar_namestarts tracking fresh in the new calendar. The old calendar is not touched. - Your own events in the same calendar are never edited or deleted. Only events with this tool's private tag are.
Troubleshooting
401 Unauthorizedfrom Canvas: the token expired or was deleted. Make a new one (step 2).Missing ... credentials.json: redo step 3 and check the file path.- "Google is not authorized yet": run the
authcommand once in a terminal. - Google sign-in stops working after a week: the consent screen is still in "Testing".
Publish it (step 3.6), delete
token.json, and runauthagain. - Deletions held back: a course lost many assignments at once. Check Canvas. If it's
expected (for example, an instructor reorganized the course), raise
max_deletes_per_coursefor one run. - Wrong times: set
timezone. Event times are always exact, because Canvas gives UTC and Google shows it in your calendar's time zone.timezoneonly affects the text.
Tests
pip install pytest && python -m pytest testsThe tests are fully mocked and need no Canvas or Google account.
Disclaimer
This software is provided "as is", without warranty of any kind. Canvas remains the official source for due dates. Check Canvas before relying on the calendar for anything important. Syncing depends on Canvas and Google APIs that can change or fail. You run it with your own Canvas token and Google credentials and are responsible for how it is used on your accounts and under your school's policies. The author is not liable for missed deadlines, incorrect events, or any resulting loss.
Not affiliated with or endorsed by Instructure or Google. Canvas is a trademark of Instructure, Inc. Google Calendar is a trademark of Google LLC.
Reviews
No reviews