Skip to content

docs: clarify Event.new() optional and auto-generated properties - #1504

Open
checkzhao8888 wants to merge 1 commit into
collective:mainfrom
checkzhao8888:docs/clarify-event-new-docstring
Open

docs: clarify Event.new() optional and auto-generated properties#1504
checkzhao8888 wants to merge 1 commit into
collective:mainfrom
checkzhao8888:docs/clarify-event-new-docstring

Conversation

@checkzhao8888

Copy link
Copy Markdown

Linked issue

Description

Clarifies the Event.new() docstring to align with RFC terminology used elsewhere in the project (for example, #1459 for Calendar.new()).

Changes:

  • Replace the misleading summary "with all required properties" with "Create a new event."
  • Mark optional parameters explicitly.
  • Document auto-generated UID and DTSTAMP values when arguments are None.

AI disclosure: Grok assisted with reviewing RFC terminology, comparing existing new() docstring patterns, and drafting the update.

Checklist

  • I've added a change log entry to /news, following the instructions in Change log entry format.
  • I've added or updated tests if applicable.
  • I've run and ensured all tests pass locally by following Run tests.
  • I've added or edited documentation, both as docstrings to be rendered in the API documentation and narrative documentation, as necessary.

Align Event.new() parameter documentation with RFC terminology by
marking optional arguments explicitly and documenting auto-generated
UID and DTSTAMP values.

See collective#1473

AI: Grok — reviewed Event.required, Calendar.new (collective#1459), and Alarm.new
PR patterns; drafted the docstring wording.
@github-actions

Copy link
Copy Markdown
Contributor

Profile summary:

GitHub user: checkzhao8888
🟢 No concerns found with user's profile.
🟢 No concerns found with recent PR activity.
🟢 No concerns found with recent issue activity.

For a more detailed report, run `gh-profiler checkzhao8888`.
Full profile
GitHub user: checkzhao8888
🟢 No concerns found with user's profile.
   🟢 Account age: 5 months
   🟢 Profile information:
        name: Checkzhao
        blog: aws.checkzhao.com
        location: Singapore
        email: 475152974zhao@gmail.com
        bio:
          Former ops → AI automation solo builder.
          Building http://aws.checkzhao.com in public.
          Codex · Antigravity · GPT · agents · workflows
        twitter: https://x.com/wkngsn72674
      Empty fields: company

🟢 No concerns found with recent PR activity.
   1 PR opened in the last 21 days.
      0 opened against repos the user owns.
      0 opened against repos in publicly associated orgs.
      1 opened against external repos.

   🟢 0 of 1 external PRs merged in the last 21 days.
   🟢 0 of 1 external PRs closed without merging in the last 21 days.

🟢 No concerns found with recent issue activity.
   🟢 No new issues opened in the last 21 days.

@read-the-docs-community

Copy link
Copy Markdown

Documentation build overview

📚 icalendar | 🛠️ Build #33302006 | 📁 Comparing e750894 against latest (937f6fc)

  🔍 Preview build  

4 files changed
± 404.html
± contribute/documentation/style-guide.html
± reference/api/icalendar.cal.event.html
± _modules/icalendar/cal/event.html

summary: The :attr:`summary` of the event.
transparency: The :attr:`transparency` of the event.
If ``None``, this is set to the current UTC time.
start: Optional. The :attr:`start` of the event.

@angatha angatha Jun 26, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Misleading since it is not true in all cases. Please manually check the RFC.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also, do not write Optional. That is covered by typing.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. @checkzhao8888, please remove the Optional. Then this should be a small change. If you want, you can include the condition when start is required but please word it so that users understand, that they can specify it later. You may also add that this validates start <= end iff. both where specified.

If you do not want to continue with this, I will close this PR in one week.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @niccokunzmann to remove all the "Optional. "s.

@niccokunzmann

Copy link
Copy Markdown
Member

@angatha, I will assign this to you. I cannot wrap my head around wether this is useful. Feel free to call in steve or close it if there is no response.

summary: The :attr:`summary` of the event.
transparency: The :attr:`transparency` of the event.
If ``None``, this is set to the current UTC time.
start: Optional. The :attr:`start` of the event.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good point. @checkzhao8888, please remove the Optional. Then this should be a small change. If you want, you can include the condition when start is required but please word it so that users understand, that they can specify it later. You may also add that this validates start <= end iff. both where specified.

If you do not want to continue with this, I will close this PR in one week.

@stevepiercy stevepiercy left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With the suggested changes, I will approve. Thank you!

summary: The :attr:`summary` of the event.
transparency: The :attr:`transparency` of the event.
If ``None``, this is set to the current UTC time.
start: Optional. The :attr:`start` of the event.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree with @niccokunzmann to remove all the "Optional. "s.

url: str | None = None,
):
"""Create a new event with all required properties.
"""Create a new event.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I often wonder what are the required properties, so this suggestion would help stop me from wondering. The properties are the Python representations of DTSTAMP and UID.

Suggested change
"""Create a new event.
"""Create a new event with the required properties of ``stamp`` and ``uid``.

"""Create a new event with all required properties.
"""Create a new event.

This creates a new Event in accordance with :rfc:`5545`.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This creates a new Event in accordance with :rfc:`5545`.
This creates a new ``Event`` in accordance with :rfc:`5545#section-3.6.1`.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants