Skip to content

Aid the creation of valid calendars. #843

@niccokunzmann

Description

@niccokunzmann

Some properties are required, others optional, some are strictly typed.

In order to start creating valid calendar times with many other features included, this issue proposes adding a new() method to the Component classes.

Example:

>>> event = Event.new(start=date(2025, 10, 11))
>>> print(event.to_ical().decode())
BEGIN:VEVENT
DTSTART;VALUE=DATE:20251011
UID:<randomly-generated-uuid4>
DTSTAMP:<now>
END:VEVENT
>>> calendar = Calendar.new(components=[event])

Benefits:

  • The calendar can create a valid calendar from the start
  • E.g. DTSTART is required IF the calendar has no method -> we can run checks on the whole object structure
  • We can use getters and setters to set the values, providing additional verification without code duplication
  • Generation and setting of default values is still possible
  • We do not deprecate or interfere with the minimal way of event = Event()

See also:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions