docs: replace RFC copy-paste docstrings with Pythonic docstrings - #1385
docs: replace RFC copy-paste docstrings with Pythonic docstrings#1385ykd007 wants to merge 7 commits into
Conversation
|
@ykd007 would you please resolve the merge conflicts by moving your change log entry into the new format that we adopted in 7.1.2, as documented at https://icalendar.readthedocs.io/en/stable/contribute/index.html#change-log-entry-format? |
|
@ykd007 would you also edit your PR description from |
stevepiercy
left a comment
There was a problem hiding this comment.
This is phenomenal work! Thank you!
There are some weird prepended and appended docstrings from a parent method that I'd like to see added to this PR, which will improve other docstrings automatically.
The change log needs to be moved, per the release of 7.1.1, and described in https://icalendar.readthedocs.io/en/stable/contribute/index.html#change-log-entry-format.
Other than that, I pretty much had only grammar and style fixes.
|
@ykd007 in addition to addressing my comments, would you please:
Please let us know if you need assistance with moving this forward. Thank you! |
|
Thank you for the detailed feedback, @stevepiercy! I've pushed two commits addressing your requests:
Please let me know if anything else needs attention! |
|
@ykd007 GitHub shows that there are merge conflicts that need to be resolved. Would you please take care of that? Then I can complete a review and proceed. Thank you! |
86791a0 to
ea0101f
Compare
|
Hi @stevepiercy — I've rebased on current main and resolved all merge conflicts. The branch is clean now. Also tightened a few things during the rebase:
Should be conflict-free now — please let me know if anything else needs attention. |
Coverage Report for CI Build 26384814733Coverage at 97.784% (no base build to compare)Details
Uncovered ChangesNo uncovered changes found. Coverage RegressionsNo coverage regressions found. Coverage Stats
💛 - Coveralls |
ea0101f to
7c55781
Compare
stevepiercy
left a comment
There was a problem hiding this comment.
I started to review your changes, but it appears you missed about two dozen of my suggestions and comments. I stopped. Would you please take care of them all? Thank you!
|
@ykd007 Thanks for your contribution so far. Let us know if you need anything. I know it can sometimes take a bit longer but we would like to see this added :) Please have a look again! |
|
@ykd007 there's also some merge conflicts to resolve. I'd like to see your work make it into a release of icalendar. Please let us know if you need any help to get this across the finish line. Thank you! |
…lective#1244) Rewrote RFC-verbatim docstrings for the following properties: alarm.py: - Alarm.ACKNOWLEDGED: replaced RFC 9074 Purpose/Description wall-of-text with a concise summary, Return, Example and See also sections. - Alarm.TRIGGER: replaced RFC 5545 Purpose/Value-Type verbatim with a clear summary, type info, Example and See also. component.py: - Component.DTSTAMP / stamp: replaced 'RFC 5545: Conformance/Description' block with a Pythonic summary, context note, Example and See also. - Component.LAST_MODIFIED: same pattern - Pythonic summary, Example, See also. - Component.CREATED: same pattern - Pythonic summary, Example, See also. calendar.py: - Calendar.calendar_name: removed Property Parameters/Conformance/Description RFC headings; added See also. - Calendar.description: same cleanup. - Calendar.color: removed Property Parameters/Conformance/Description RFC headings; added CSS3 link reference and See also. - Calendar.prodid: replaced Conformance/Description verbatim with Pythonic summary, Example and See also. - Calendar.version: replaced Purpose RFC text with Pythonic summary + Example. - Calendar.calscale: replaced Conformance/Description/Compatibility with Pythonic summary, RFC 7529 note, Example and See also. - Calendar.method: replaced Description RFC block with Pythonic summary, iTIP/RFC 5546 reference, Example and See also. - Calendar.refresh_interval: replaced Conformance/Description headings with Pythonic summary, updated Raises, added Example and See also.
…fix ACKNOWLEDGED and p_doc text
7c55781 to
562fb57
Compare
|
Thanks for the nudge, @niccokunzmann and @stevepiercy. I rebased the branch on current main and pushed the remaining review cleanup. I also moved the news fragment to Checked locally with:
|
stevepiercy
left a comment
There was a problem hiding this comment.
Thanks for your patience. I found a couple of incorrect RFC section references. I also realized that including section headings in {doc} isn't as helpful as I would like. I'd like your thoughts on this. Please let me know. Thank you!
| Parameters: | ||
| {", ".join(t.__name__ for t in value_type)}. |
There was a problem hiding this comment.
A trailing . appeared in the list. Let's remove it.
| Parameters: | |
| {", ".join(t.__name__ for t in value_type)}. | |
| Parameters: | |
| {", ".join(t.__name__ for t in value_type)} |
I also think that this is too clever. It only gives us the name of the value_types passed in, returned as an unordered list. If we want to support type hints or links to the types, then this is not helpful. I think we ought to move this into each of the properties' docstring instead.
@niccokunzmann can I get your thoughts on this?
There was a problem hiding this comment.
There is also __qualname__. That might allow referencing them. That could be worth trying out.
f":class:`{x.__qualname__}`"
There was a problem hiding this comment.
The initial idea for me was to create a doc template to reduce time spent on writing, copy&paste errors and ensure consistency. Since you are the docs lead, it is your call if you would rather have proper functions with docstrings and maybe wrappers or calls to ensure good docs.
I am not attached to keeping it like this.
One positive argument for change is that we now start testing the docs for consistency, based on the AST, not generated values.
There was a problem hiding this comment.
Yes, also, I think trying to test generated docs will be a layer on top of a layer, which would be an unsupported use case.
There was a problem hiding this comment.
Also, I didn't see any type hints on the properties that call create_single_property, only on create_single_property itself. There's also no return type hint on create_single_property, which makes me wonder whether properties should have a Returns docstring heading. What do you think?
There was a problem hiding this comment.
There is also
__qualname__. That might allow referencing them. That could be worth trying out.f":class:`{x.__qualname__}`"
Parameters:
{", ".join(t.__qualname__ for t in value_type)}Same result as __name__.
Parameters:
{", ".join(":class:`" + t.__qualname__ + "`" for t in value_type)}
Obliterates the Parameters section heading, too. I experimented a little bit to no avail. Ultimately, I think generated docstrings are more trouble than using static docstrings.
|
|
||
| Returns: | ||
| A :class:`~datetime.datetime` or :class:`~datetime.timedelta` if the | ||
| value is valid. ``None`` if the value is absent. |
There was a problem hiding this comment.
Oops. The Returns section is not correct for all its usages. See:
- https://icalendar--1385.org.readthedocs.build/en/1385/reference/api/icalendar.cal.free_busy.html#icalendar.cal.free_busy.FreeBusy.start
- https://icalendar--1385.org.readthedocs.build/en/1385/reference/api/icalendar.cal.free_busy.html#icalendar.cal.free_busy.FreeBusy.end
- https://icalendar--1385.org.readthedocs.build/en/1385/reference/api/icalendar.cal.free_busy.html#icalendar.cal.free_busy.FreeBusy.DTSTART
- https://icalendar--1385.org.readthedocs.build/en/1385/reference/api/icalendar.cal.free_busy.html#icalendar.cal.free_busy.FreeBusy.DTEND
And that's just one module. There is a total of 14 places where create_single_property is called.
And now that I think about it, does each property actually return anything when it's called? Can it even be called? What do you think?
@niccokunzmann can you add your thoughts on this?
There was a problem hiding this comment.
And now that I think about it, does each property actually return anything when it's called? Can it even be called?
@niccokunzmann can you respond to these questions, too? Thank you!
| """The display name of this calendar, per :rfc:`7986#section-5.1`. | ||
|
|
||
| This implements :rfc:`7986` ``NAME`` and ``X-WR-CALNAME``. | ||
| Implements both the ``NAME`` property from :rfc:`7986#section-5.3` and the widely used |
There was a problem hiding this comment.
This was a bad copy-paste by me.
| Implements both the ``NAME`` property from :rfc:`7986#section-5.3` and the widely used | |
| Implements both the ``NAME`` property from :rfc:`7986#section-5.1` and the widely used |
| DTSTAMP = stamp = single_utc_property( | ||
| "DTSTAMP", | ||
| """RFC 5545: | ||
| """The UTC datetime stamp recording when this component instance was created or last revised. |
There was a problem hiding this comment.
It doesn't. 😢 See other comments in attr.py.
See #1244
Rewrites RFC copy-paste docstrings across
Alarm,Component, andCalendarinto clean Pythonic format with concise summaries, examples, and see-also references.Updated (12 properties across 3 files):
Alarm:ACKNOWLEDGED,TRIGGERComponent:DTSTAMP/stamp,LAST_MODIFIED,CREATEDCalendar:calendar_name,description,color,prodid,version,calscale,method,refresh_intervalValidation:
make formatuv run pytest src/icalendar/tests/test_with_doctest.pymake html