Skip to content

Add docs in __new__ methods to resolve issue #1118#1318

Open
Shubham-Developer02 wants to merge 6 commits into
collective:mainfrom
Shubham-Developer02:icalendar_new_classes_document
Open

Add docs in __new__ methods to resolve issue #1118#1318
Shubham-Developer02 wants to merge 6 commits into
collective:mainfrom
Shubham-Developer02:icalendar_new_classes_document

Conversation

@Shubham-Developer02
Copy link
Copy Markdown

Closes issue
Closes #1118

Description
This pull request adds Google-style docstrings to the new methods of immutable value types in icalendar.prop so the API docs explain how instances are constructed and how params is attached:

vBoolean (icalendar.prop.boolean)
vFloat (icalendar.prop.float)
vText (icalendar.prop.text)
vCalAddress (icalendar.prop.cal_address)
vUri (icalendar.prop.uri)

  • Each docstring summarizes why new is overridden (subclass of int, float, or str), documents Parameters and Returns per the Python docstrings section of the documentation style guide, and includes runnable Examples using .. code-block:: pycon where appropriate.

  • No behavioral changes to serialization or parsing are intended; this is documentation only.

Link: icalendar documentation style guide — Python docstrings.

Closes issue

@read-the-docs-community
Copy link
Copy Markdown

read-the-docs-community Bot commented Apr 12, 2026

@niccokunzmann
Copy link
Copy Markdown
Member

@Shubham-Developer02 Could you please add a changelog entry?

Comment thread src/icalendar/prop/uri.py Outdated
@niccokunzmann
Copy link
Copy Markdown
Member

Thanks @Shubham-Developer02! I will leave the review to @stevepiercy.

@Shubham-Developer02
Copy link
Copy Markdown
Author

@Shubham-Developer02 Could you please add a changelog entry?
@niccokunzmann , I've added this.

@stevepiercy
Copy link
Copy Markdown
Member

I didn't know that __new__ behaves similarly to __init__ in regards to rendering docstrings. The important admonition at https://icalendar.readthedocs.io/en/latest/contribute/documentation/style-guide.html#docstring-structure describes how to merge a class's and its __init__'s docstrings, but should include __new__ as well.

Additionally, we need to remove duplication of the RFC in our docstrings, and instead document what the class actually does and how to use it, making the docstring more Pythonic. See related issue #1244 for guidance and the discussion.

With all that in mind, @Shubham-Developer02 would you please merge the docstrings of just one class and its __new__ method? Perhaps start with this one, and see how it goes.

https://icalendar--1318.org.readthedocs.build/en/1318/reference/api/icalendar.prop.boolean.html#module-icalendar.prop.boolean

It can be tricky, so I'd suggest building the docs locally. Thank you!

@niccokunzmann
Copy link
Copy Markdown
Member

Hi, we created a new release, please move your edits in CHANGES.rst to the new section.

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.

Document __new__ methods

4 participants