CalendarGen
CalendarGen turns a declarative TOML schedule into an iCalendar (.ics) file. It is designed for events that usually happen every week, such as university lectures. Define the term dates, class times, and weekly events once; CalendarGen expands them into individual calendar events.
Install
Requires Python 3.12 or later.
pip install calendargen
With uv, install the CLI as a tool:
uv tool install calendargen
To install from a local checkout for development, use uv tool install --editable .. You can also run it from this repository without a separate installation:
uv run calendargen init calendar.toml
uv run calendargen gen calendar.toml calendar.ics
Usage
Create a starter schedule, edit it, and generate an ICS file:
calendargen init calendar.toml
calendargen gen calendar.toml calendar.ics
Import calendar.ics into a calendar application that supports iCalendar files. init creates a new file and will not overwrite an existing one.
Updating an imported schedule
Edit calendar.toml and run calendargen gen calendar.toml calendar.ics again. Before importing the new ICS file, remove the events from the previous import in your calendar application. A distinctive description_footer helps you find those events; importing the new file alone may leave duplicates, depending on the application. Import the regenerated ICS file after removing the old events.
Schedule format
term_start = 2026-10-01
term_end = 2027-01-22
excluded_dates = [2026-11-03]
description_footer = "Generated by CalendarGen (Fall 2026)"
[time_slots]
"period 2" = { start = "10:30", end = "12:00" }
[[courses]]
title = "Applied Algebra"
weekday = "mon"
time_slot = "period 2"
location = "Room 201"
description = "Professor Smith"
[[day_overrides]]
date = 2026-10-15
use_weekday = "mon"
all_day_event_title = "Monday schedule"
term_startandterm_endare inclusive TOML dates.excluded_datesskips all events on the listed dates. It can be omitted.- Each
time_slotsentry defines a named local start and end time. Courses refer to these names throughtime_slot. - Each
[[courses]]entry defines a weekly event.title,weekday, andtime_slotare required;locationanddescriptionare optional. Weekdays aremon,tue,wed,thu,fri,sat, orsun. - A
[[day_overrides]]entry uses another weekday's course schedule on a specific date. In the example, October 15 follows the Monday schedule. Overrides are optional and cannot share a date withexcluded_dates. all_day_event_titleis an optional text field on a day override. When nonblank, it creates an additional all-day event on that date with the text as its title. Omit it on overrides that need no all-day event.description_footeris optional. When set, CalendarGen appends it after a blank line to each course description and adds it as the description of events that have none, including all-day override events. Omit it or set it to a blank string to leave descriptions unchanged. A distinctive footer makes it easier to search for and delete all generated events after importing an ICS file, so you can revise the schedule and import it again.
Unknown field names in the schedule, time slots, courses, or day overrides are errors. Dates in excluded_dates and day_overrides must fall between term_start and term_end, inclusive; out-of-range dates are also errors. CalendarGen does not create or replace the ICS file when validation fails.
Event times use the local timezone of the machine running CalendarGen. The generated ICS file contains one event for each occurrence within the term.
License
MIT. See LICENSE.
Metadata
Release files for calendargen 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| calendargen-0.1.0.tar.gz | 11.6 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| calendargen-0.1.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 19.6 kB
Release files / calendargen-0.1.0.tar.gz
| Download URL | calendargen-0.1.0.tar.gz |
|---|---|
| Size | 11.6 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
8c7e51d57c43c05b571e609dcd7e44767d94d023db2828f0dbeca2f7f67e8a05
|
|
BLAKE2b-256 checksum How to use checksums |
a0cb5aa948dda96d1e204f69f132f54f8b4c0cc77f6a419a1ed91c51117c89ce
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|
Release files / calendargen-0.1.0-py3-none-any.whl
| Download URL | calendargen-0.1.0-py3-none-any.whl |
|---|---|
| Size | 8.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
0809496149f48dbe7817616a461f8b2495333c5a32191c697b55bb1fd327f09e
|
|
BLAKE2b-256 checksum How to use checksums |
9d982ac2df60567e8abea2c2e6d7850084f6235a2f2f445e9f73afc2c09ccc6c
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
uv/0.12.21 {"installer":{"name":"uv","version":"0.12.21","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"Ubuntu","version":"24.04","id":"noble","libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":true}
|