Pendulum was started more than 1 year and a half ago to provide a decent datetime library to Python, with a clear and intuitive API to make the most complex things trivial.
The main goal, and at the same time the main challenge, was that all types provided by pendulum would be drop-in replacements for the native ones (
datetime -> Pendulum,
timedelta -> Interval/Period) while fixing some shortcomings of the standard library.
The first stable was released January 17th, 2017 after many useful feedbacks from the community.
The reception was mostly positive and step by step it gain some traction being referred on StackOverflow or being the subject of some well written articles.
But, at the same, as more and more people were using it some bad decisions and "poorly" thought out API became more appearant.
And so the decision to start thinking about the next major was made with some important points in mind.
Supported Python versions
Currently pendulum supports Python 2.7+, 3.4+ and PyPy.
Maintaining all these versions requires some efforts and prevents the library from using and taking advantage of the latest features the language offers (like type annotations, f-strings or the newly introduced
pendulum also relies on C-extensions for some parts of the library that require improved performances, like parsing datetime strings. However, the C-API Python provides are different between Python 2.7 and Python 3.6 so that adds to the difficulty of maintaining both major versions.
And, finally, Python 2.7 is near its end of life (set to January 1st 2020).
However, some projects using pendulum are still compatible with Python 2.7, and I would like them to use the new features and improvements provided by this major version.
With all of this in my mind, it was decided that the
2.x releases will be the last to support Python 2.7, the
3.x releases will only support Python 3.6+. Also, pendulum 2.0 will not provide the C extensions for Python 2.7.
It’s important to note that this does not change anything for the
1.x versions which will still receive new bugfix releases. Both branches will coexist and a 1.5 version will be released with deprecation warnings to ease the transition.
But, and this is the most important, start putting
pendulum<2.0.0 in your dependency files to avoid things breaking when the new major version will be released.
Improve ISO 8601 support
While pendulum already supports parsing ISO 8601 datetimes, the specification goes beyond that and supports defining durations and intervals.
So, it was decided that
parse() would also support it.
And since, the specification mention years and months as valid units in durations, pendulum's durations (previously intervals) will support them as well.
Improve timezone system
Currently, pendulum has an approach similar to
pytz regarding timezone management. Basically, it will
tzinfo to a fixed object that holds the offset to UTC, the timezone abbreviation, etc. While this
is fast, since it avoids transitions lookup each time
utcoffset() is called, it is not friendly to the way
datetime API was designed.
So, as of version 2.0, each timezone returned by pendulum will be native, singleton
There was also a thing in the timezone database that was not used by pendulum: the POSIX TZ specification.
Basically, the database provides transition information until 2038, so any datetime beyond that would not have the correct DST information. However, the database also provides rules to determine transitions beyond 3038 in the form:
From now on, pendulum will use it to compute transitions.
Rename poorly named classes
Some classes in the pendulum codebase are poorly named (like
So, the decision was made to rename them, along with there corresponding helpers:
While the exact release date is not set yet, expect it to be in April.
Most of the work is already done, and the only thing that's left is being sure that it is fully compatible with Python 2.7.
It will be the best version yet and we hope that it will help you handle time in your projects.
If you want to see more of what is actually being changed you can check the Change log.