Implement full recurrence spec - #566
Closed
stutrek wants to merge 12 commits into
Closed
Conversation
…nents, add test example from spec
stutrek
commented
Jan 26, 2026
| @classmethod | ||
| def __encode_property_json__( | ||
| cls, value: "str | RecurrenceId" | ||
| ) -> str | dict[str, str]: |
Contributor
Author
There was a problem hiding this comment.
this may break JSON consumers that don't follow the same patterns as DateTimeEncoder, such as JavaScript.
allenporter
reviewed
Jan 26, 2026
allenporter
left a comment
Owner
There was a problem hiding this comment.
Appreciate the work here. Just wanted to ACK that I see this, and that it may take some time to review.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #566 +/- ##
==========================================
+ Coverage 97.15% 97.23% +0.08%
==========================================
Files 53 53
Lines 3234 3366 +132
==========================================
+ Hits 3142 3273 +131
- Misses 92 93 +1 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
Contributor
Author
|
This is probably taken care of by #565 and it's unlikely that I will have the time to give it the energy it needs. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #513
Builds on #565
My apologies for a large PR, but this is a big item that deserves extensive testing. This fully implements the ical spec for recurring events, in an almost completely backwards compatible way; JSON consumers may break. The code should be commented well enough to help you in your review.
This PR handles:
Test coverage is 99%. The only cases not tested are very remote error cases.
Changes
ical/types/recur.pyRecurrenceIdnow parses and preserves theRANGEparameterical/recur_adapter.pyThisAndFutureEdit- captures edit with computed time shiftThisAndFutureRecurAdapter- applies modifications during timeline expansionmerge_and_expand_items()to detect and apply THISANDFUTURE editsTest coverage
recur_adapter.py, 98% ontypes/recur.pyNot implemented
Performance
The worst I see is that it will run over every edit for every instance of the event. In the real world, this seems like it shouldn't be bad, as very few events will have more than 2 or 3 edits.
Disclaimer
AI did a lot of the heavy lifting, but check the commit list to see that it's not pure slop. I have read every line of code, although Python is not my strongest language. I have taken care to ensure that types are strong, the tests are complete and comply with the spec, and edge cases are handled correctly.