3.3 KiB
3.3 KiB
Repository Guidelines
Project Structure and Module Organization
- python version is
python3.13 generator.pyis the main CLI that builds a single.icscalendar file from a story JSON.config.tomlholds schedule rules (start date/time, blocked weeks/dates, organizer info).stories/contains story inputs; each file includes ametaobject and aneventslist.stories/template.jsonis a starter template for new stories.fredagsbar_output/stores generated.icsand preview.htmlfiles (local artifacts ignored via.gitignore).requirements.txtpins Python dependencies.
Build, Test, and Development Commands
python -m venv .venvandsource .venv/bin/activateto create a local virtualenv.pip install -r requirements.txtinstalls dependencies.python generator.py stories/object_87-B.jsongenerates a calendar file infredagsbar_output/.python generator.py stories/object_87-B.json --preview-htmlalso writes an HTML preview tofredagsbar_output/.- Optional flags:
--config,--output-dir,--timezone,--duration-minutes,--no-color. python generator.py stories/<your_story>.jsonruns the generator with another story file.
Coding Style and Naming Conventions
- Use standard Python style: 4-space indentation, snake_case for functions and variables.
- Keep JSON keys consistent with existing stories (
meta.name,meta.theme_color,events[].title,events[].story). - For stable calendar updates, set
meta.idandevents[].id(orevents[].uidto force a specific UID). Optionally setconfig.tomluid_namespaceto change the deterministic UID namespace. - The generator writes back
events[].uidafter a successful run and validates existing UID values for mismatches or duplicates. - If a prior
fredagsbar_output/FULL_SERIES_<slug>.icsexists, its UIDs are reused and injected into the story JSON. - Name story files with descriptive, lowercase filenames using underscores or hyphens (for example:
stories/new_story.json). - Output filenames are derived from
meta.nameand written asfredagsbar_output/FULL_SERIES_<slug>.ics.
Testing Guidelines
- Automated tests live in
tests/. Runpython -m unittest discover. - Coverage includes date skipping, UID mapping, HTML injection, and preview rendering.
- When altering scheduling logic, confirm blocked weeks/dates and holiday skipping behavior from
config.toml.
Commit and Pull Request Guidelines
- Use short, imperative commit subjects consistent with history (for example: "update repo path").
- Do not commit generated
.icsfiles;fredagsbar_output/is treated as a local artifact directory. - In PRs, describe the story or scheduling changes, and mention the output filename you generated for verification.
- If you modify
config.toml, call out changes to dates, blocked weeks, or organizer settings in the PR description.
Configuration and Content Tips
- Stories can include HTML in
events[].story; the generator converts HTML to plain text for descriptions and renders the HTML in previews. - Keep
repo_urlinconfig.tomlaccurate, as it is embedded in the event description. blocked_datessupports bothYYYY-MM-DDandMM-DDentries.- Optional
repo_url,organizer_email, anduid_namespacemust be strings when set. - HTML previews include a skipped-dates section when blocked dates/weeks are encountered.