Skip to main content

iCalendar events plugin for Pelican

Project description

Pelican Events: iCalendar Plugin for Pelican

build PyPI Version License

Pelican plugin to embed event data in posts and generate iCalendar data

This project was created for the Portland Linux Kernel Meetup (PDX-LKMU) site. This is a refresh of the 2015 events plugin and includes improvements from Makerspace Esslingen.

This plugin/module was made to generate iCalendar data for the Linux Kernel Meetup in Portland, Oregon and also to be general-use for other groups who find it helpful. The PDX-LKMU site uses the static site generator Pelican.

We intended to use the previously-existing "events" plugin to automatically generate iCalendar entries from events with calendar metadata. But the events plugin was unmaintained. It also didn't generate enough iCalendar properties for our needs, where we need the Portland-area Calagator system to process our iCalendar output. Also, the original events plugin was so old it didn't implement the current "namespace plugin" standard for Pelican plugins, namely being a standalone Python module. That's what this project was intended to solve - rewrite it as a Python module and bring it up to current plugin standards.

Let's give credit to the volunteers who created the foundation this is built upon. This plugin pulls together code from the legacy events plugin by Federico Ceratto and the forked pelican-events-plugin by Makerspace Esslingen into a plugin compliant with the current namespace plugin structure. We also added support for more iCalendar properties, as many as make sense in a public setting. A security review excluded some properties which are intended for private email use, and could cause misconfiguration or be used for mischief. Those details are documented below.

Installation

This plugin is available as 'pelican-events' on PyPI and can be installed via:

python -m pip install pelican-events

Dependencies

The pelican-events plugin depends on the following Python packages:

  • pelican
  • icalendar
  • recurrent
  • html2text
  • and others

Some dependencies are available for installation via OS-native packages.

  • on RPM-based systems (Fedora, RHEL, Rocky, Alma, etc):

    dnf install python3-pelican python3-icalendar python3-html2text

  • on DEB-based systems (Debian, Ubuntu, etc):

    apt install pelican python3-icalendar python3-html2text

Pelican uses PDM (Python Dependency Manager) for builds and Ruff as its linter. So the Pelican-Events plugin does too. PDM determines the project's dependencies with the command

pdm lock

Dependencies which aren't available as OS-native packages may be installed via PDM:

pdm install

Settings

As long as you have not explicitly added a PLUGINS setting to your Pelican settings file, then the newly-installed plugin should be detected as a Python module with a "pelican.plugins" prefix, and then automatically enabled. Otherwise, you must add pelican-events to your existing PLUGINS list. For more information, please see the How to Use Plugins documentation.

Define settings in pelicanconf.py with the PLUGIN_EVENTS variable:

PLUGIN_EVENTS = {
    'ics_fname': 'calendar.ics',
    'metadata_field_for_summary': 'title',
},
'TIMEZONE': 'US/Pacific',  # use your local time zone

Settings available in the PLUGIN_EVENTS dictionary variable:

  • ics_fname: where the iCal file is written - disables plugin if not set
  • metadata_field_for_summary: which field to use for the event summary, default: summary
  • recurring_events: recurring event rules in recurrent module format. If not set, then recurring events will not be generated. This feature was added by Makerspace Esslingen. (This feature is now minimally tested with some unit tests. But we don't use it on the PDX-LKMU site.)

Settings used from Pelican's top-level configuration:

  • TIMEZONE: time zone to use for events in icalendar output, default: UTC. If set, this must be an official time zone name from the IANA Time Zone Database. This feature was added by Ian Kluft for Portland Linux Kernel Meetup.

Usage

You can use the following metadata in your Pelican content, which are from the original 2015 events plugin:

  • event-start: When the event will start in "YYYY-MM-DD hh:mm"
  • event-end: When the event will stop in "YYYY-MM-DD hh:mm"
  • event-duration: The duration of the event [note 1]
  • event-location: Where the event takes place [RFC5545, Section 3.8.1.7]

Note 1: To specify the event duration, use a number followed by a time unit, for example "2h 30m"

  • w: weeks
  • d: days
  • h: hours
  • m: minutes
  • s: seconds

Support for more iCalendar properties, prefixed with "event-" in the post metadata, were added in the update for the Portland Linux Kernel Meetup.

However, not all iCalendar properties make sense in the context of a public post. Those intended for private emails were excluded in a security review to prevent misconfiguration and mischief. A few were disallowed because they are redundant with metadata settings that generate those properties in the original events plugin. If you think you need a property which was excluded, submit an issue to the project stating which property is requested and explaining why it should be allowed in a public setting.

The disallowed iCalendar properties are: acknowledged action attach attendee busytype calendar-address calscale class color completed contact dtend dtstamp dtstart due duration exdate exrule freebusy last-modified location-type method organizer participant-type percent-complete priority prodid proximity rdate recurrence-id refresh-interval related-to repeat request-status resources resource-type rrule sequence source structured-data transp trigger tzid tzid-alias-of tzname tzoffsetfrom tzoffsetto tzuntil tzurl version xml

Contributing

Contributions are welcome and much appreciated. Every little bit helps. You can contribute by improving the documentation, adding missing features, and fixing bugs. You can also help out by reviewing and commenting on existing issues.

To start contributing to this plugin, review the Contributing to Pelican documentation, beginning with the Contributing Code section.

Development Environment

Upon commit to the repository, the Github workflow will perform unit tests on current versions of Python. So prior to checking in code, at least run the tests on your local environment to make sure you won't break the build.

pdm run invoke tests

It will also do a lint check which shows diffs that the linter wants for proper formatting. This is also marked as a build failure if it doesn't work.

pdm run invoke lint --diff

If it says there are changes to make, you can run this in your workspace to apply those changes.

pdm run invoke lint --fix

To make a local git hook to perform these checks before each commit, make a symbolic link as follows:

ln -s "../../docs/pre-commit-git-hook.sh" .git/hooks/pre-commit

Example usage

The pelican-events plugin was made for and is used by the Portland Linux Kernel Meetup in Portland, Oregon, USA.

License

This project is licensed under the AGPL-3.0 license in order to be compatible with Pelican.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pelican_events-0.1.1.tar.gz (37.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

pelican_events-0.1.1-py3-none-any.whl (41.5 kB view details)

Uploaded Python 3

File details

Details for the file pelican_events-0.1.1.tar.gz.

File metadata

  • Download URL: pelican_events-0.1.1.tar.gz
  • Upload date:
  • Size: 37.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.13.7 Linux/6.16.10-100.fc41.x86_64

File hashes

Hashes for pelican_events-0.1.1.tar.gz
Algorithm Hash digest
SHA256 6657c7bf2c34f964954209453c2c9e2441fc753107590570e359805d20961103
MD5 d63d1ebc5a593dfa4ceb3f96c933c965
BLAKE2b-256 3db3f197872aa83fdb83d01f5f350a330625456c5fd8685235a65b1692ed9b16

See more details on using hashes here.

File details

Details for the file pelican_events-0.1.1-py3-none-any.whl.

File metadata

  • Download URL: pelican_events-0.1.1-py3-none-any.whl
  • Upload date:
  • Size: 41.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: pdm/2.25.9 CPython/3.13.7 Linux/6.16.10-100.fc41.x86_64

File hashes

Hashes for pelican_events-0.1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 ea4e17c57b2f3f7190c2c9a441cf121eebf2e7a1a772371a736074b6350db43e
MD5 33a075732c622e8320a59202ccec26e4
BLAKE2b-256 4af8a8a81bc309a63adeac226ee528197b84d45f4d6ebc10e72fc3a50faa44d7

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page