After more than 300 commits and 21 beta releases, pendulum finally reaches its first stable version.

What does that mean? Well, the API is now stable, so no backwards compatibility breaking changes will be introduced in any 1.x releases (pendulum will follow Semantic Versioning).

So, you can safely use pendulum in production without worrying about things breaking.

As for the changes specific to this version you can refer to the Change Log or read a more explanatory list below.

Changes

Using the PRE_TRANSITION rule no longer produces a time in a DST gap.

Before this change, pendulum could produce times in a DST gap when the PRE_TRANSITION rule was used:

>>> import pendulum
>>> pendulum.set_transition_rule(pendulum.PRE_TRANSITION)
>>> dt = pendulum.create(2013, 3, 31, 2, 30, tz='Europe/Paris')
>>> dt.isoformat()
'2013-03-31T02:30:00+01:00'

But this time does not exist and therefore is incorrect. So now, pendulum will always return a correct time when using PRE_TRANSITION by going back in time.

>>> import pendulum
>>> pendulum.set_transition_rule(pendulum.PRE_TRANSITION)
>>> dt = pendulum.create(2013, 3, 31, 2, 30, tz='Europe/Paris')
>>> dt.isoformat()
'2013-03-31T01:30:00+01:00'

Improved parsing of ISO 8601 strings.

While ISO 8601 week number date format was supported (2012-W05-5 or 2012-W05), it would not be parsed if it was associated with a time definition: 2012-W05-5T09.

It now works properly:

>>> import pendulum
>>> dt = pendulum.parse('2012-W05-5T09')
>>> print(dt)
'2012-02-03T09:00:00+00:00'

Removed deprecated methods

All previously deprecated methods and properties have now been removed. Here is the list:

  • timestamp is now a method just like in the standard datetime class.
  • Interval properties and methods related to years and months.
  • Interval.days_exclude_weeks (replaced by remaining_days).
  • with_date() and with_time() (replaced by on() and at()).
  • create_from_date() and create_from_time(). Use create() instead.
View Comments