Upgrade guide#
This chapter describes how to upgrade icalendar to the latest version from previous versions. Its purpose is to help developers adapt their existing code.
This guide includes only breaking changes and deprecation notices. For a comprehensive list of new features and bug fixes, see the Change log.
7.0.0#
This section describes the major changes to icalendar in version 7.0.0.
Breaking changes#
This section describes the breaking changes in icalendar 7.0.0, and how to adapt your code to these changes.
Component.decoded return type changed#
The method Component.decoded now returns a string instead of bytes for text properties.
Property creation error change#
icalendar now correctly throws a TypeError for wrong types during property creation, instead of a ValueError.
If your code expects a ValueError when creating a property, then you should change your code to use TypeError.
Moved types_factory#
types_factory was moved into Component.types_factory.
Adjust your imports from the old location of types_factory:
from icalendar import cal
…to the new location.
from icalendar.cal.component import Component
Moved components_factory#
components_factory was moved into Component.get_component_class.
Adjust your imports from the old location of components_factory:
from icalendar import cal
…to the new location.
from icalendar.cal.component import Component
Moved IncompleteComponent#
The error icalendar.cal.IncompleteComponent was moved to icalendar.error.IncompleteComponent.
Adjust your imports from the old location of IncompleteComponent:
from icalendar.cal import IncompleteComponent
…to the new location.
from icalendar.error import IncompleteComponent
Removed icalendar.UIDGenerator#
icalendar.UIDGenerator was removed.
Use the Python standard library’s uuid module instead.
Deprecations#
The following deprecation notices describe which features may be removed in a future major release of icalendar.
Python 3.8 and 3.9 support#
Python 3.8 and 3.9 have reached end of life.
Nonetheless icalendar continues to be tested, and still works, on both Python 3.8 and 3.9.
However, if it becomes impractical for the icalendar community to provide support for these versions, then support for them would be removed in a future major release of icalendar.
6.0.0#
This section describes the major changes to icalendar in version 6.0.0.
Deprecations#
The following deprecation notice describes which features may be removed in a future major release of icalendar.
pytz support#
zoneinfo is the recommended replacement for pytz.
zoneinfo was added in Python 3.9, and is not available in Python 3.8.
In icalendar 6.0.0a, full support for zoneinfo was added.
pytz may still be used, but developers are encouraged to follow the advice of the maintainers of pytz and move to zoneinfo.