recurrent

raw JSON →
0.4.1 verified Sat May 09 auth: no python

Recurrent is a Python library for parsing and formatting recurring events expressed in natural language (e.g., 'every weekday', 'every 2 weeks on Monday'). The current version is 0.4.1, which has been stable with infrequent releases.

pip install recurrent
error AttributeError: module 'recurrent' has no attribute 'parse'
cause Importing the module directly without importing the parse function or class.
fix
Use 'from recurrent import parse' or 'from recurrent import RecurringEvent'.
error TypeError: 'NoneType' object is not iterable
cause The parse method returned None because the input could not be parsed.
fix
Check the result: result = re.parse('input'); if result: ...
error KeyError: 'month'
cause Trying to access a parsed component that doesn't exist because parsing failed.
fix
Always verify the parse result is not None before accessing its attributes.
gotcha The parse() function returns None on failure, not an exception. Check for None before using the result.
fix Always check if result is not None, or use the RecurringEvent format method which returns False on failure.
deprecated The module-level parse() function may be removed in future versions. Use RecurringEvent().parse() instead.
fix Use 'from recurrent import RecurringEvent; r = RecurringEvent(); result = r.parse(...)'.
gotcha Parsing is limited to English-like phrases. Non-English input or complex natural language may fail silently.
fix Stick to simple English patterns. For complex recurrence rules, consider dateutil.rrule directly.

Basic usage: parse a natural language string into an iCalendar RRULE.

from recurrent import parse, RecurringEvent

re = RecurringEvent()
result = re.parse('every day')
if result:
    print(result)  # Outputs: RRULE:FREQ=DAILY
else:
    print('Could not parse')