3.0.0
Added 2
- Added dateutil.tz.TZPATH and dateutil.tz.reset_tzpath for runtime configuration of the IANA time zone data search path
- dateutil now depends on the tzdata package, which gettz consults after the search path and before the Windows registry requirement raised · inferred, marked in the notes below
Changed 5
- tz.tzfile was rewritten based on a backport of the zoneinfo pure-Python implementation, adding support for Version 2 and Version 3 tzfile(5) binaries, timestamps beyond 2038, and slim format binaries behavior changed · inferred, marked in the notes below
- On Windows, names that are both IANA keys and Windows time zone names, such as UTC, now return a tzfile rather than a tzwin
- The minimum supported version of six was raised to 1.6, fixing No module named 'six.moves' errors with older versions requirement raised · inferred, marked in the notes below
- Intersphinx was added to the docs build and some broken links were cleaned up
- Releases are now uploaded to PyPI using trusted publishing, and built sdist and wheel are tested on all supported platforms before upload
Fixed 6
- tz.tzfile follows PEP 495 for times in a gap: fold=0 uses the offset from before the transition and fold=1 uses the offset from after it
- tz.tzfile objects for fixed-offset zones such as tz.gettz("UTC") now return their offset, DST offset and abbreviation when utcoffset, dst and tzname are called with None behavior changed · inferred, marked in the notes below
- tz.tzfile now infers dst() from the standard time on both sides of each DST period, fixing dst() for double summer time, half-hour DST, and simultaneous standard offset and DST transitions
- rrulestr no longer raises ValueError on experimental X- parameters in an RRULE line; these are now ignored
- Pickling and deepcopy of cached rrule and rruleset instances is now enabled
- relativedelta.__ne__ now returns True when compared against an unsupported type instead of raising TypeError
Removed 2
- The bundled copy of the IANA time zone database is no longer shipped; time zone data now comes from the system search path or the tzdata dependency
- The mutable dateutil.tz.TZPATHS list was removed and replaced by dateutil.tz.TZPATH and dateutil.tz.reset_tzpath inferred, marked in the notes below
Deprecated 3
- The dateutil.zoneinfo module is deprecated and will be removed in a future version; users should migrate to dateutil.tz.gettz or the standard library zoneinfo module vendor-flagged, marked in the notes below
- dateutil.zoneinfo.rebuild.rebuild no longer does anything and by default raises RebuildDeprecationWarning as an error behavior changed · vendor-flagged, marked in the notes below
- Passing gettz a relative key referring to a file outside every directory on TZPATH is deprecated and by default raises DeprecatedTzKeyWarning as an error vendor-flagged, marked in the notes below
8 changes to check, marked in the notes below
From dateutil
This is the last major version of dateutil that will support any version of Python older than 3.11. The next release will be the 4.x series, which will support Python 3.11 and later. We may release fixes for serious bugs in the 3.0.x series, but there are no plans for new features there.
The biggest change in this release is a rewrite of tz.tzfile, which affects nearly every user of dateutil.tz and changes the UTC offset of nonexistent times (see below). dateutil also now depends on the tzdata package, and no longer ships its own time zone database.
Data updates
dateutilno longer bundles a copy of the IANA time zone database. Time zone data now comes from the system (seedateutil.tz.TZPATH) or, failing that, from the newtzdatadependency, so the data version is whatever version oftzdatais installed. (gh pr #1130) removed · inferred
Features
- Rewrote
tz.tzfilebased on a backport of thezoneinfomodule's pure-Python implementation. This adds support for Version 2 and Version 3tzfile(5)binaries, resolving issues with timestamps beyond 2038 and "slim" format binaries. (gh issues #462, #1059, gh pr #1130) - Added
dateutil.tz.TZPATHanddateutil.tz.reset_tzpathto allow for runtime configuration of the IANA time zone data search path. These replace the mutabledateutil.tz.TZPATHSlist, which has been removed. (gh pr #1130) removed · inferred dateutilnow depends on thetzdatapackage, whichgettzconsults after the search path and before the Windows registry. On Windows this means that names that are both IANA keys and Windows time zone names, such as"UTC", now return atzfilerather than atzwin. (gh pr #1130) requirement raised · inferred behavior changed · inferred
Bugfixes
tz.tzfilenow follows PEP 495 for times that fall in a gap: withfold=0it uses the offset from before the transition, and withfold=1the offset from after it. Previously it always used the offset from after the transition, so for exampledatetime(2003, 4, 6, 2, 30, tzinfo=tz.gettz("America/New_York"))had a UTC offset of -04:00, where it now has -05:00, the same as withzoneinfo. (gh pr #1130) behavior changed · inferredtz.tzfileobjects for fixed-offset zones, such astz.gettz("UTC"), now return their offset, DST offset and abbreviation whenutcoffset,dstandtznameare called withNone, astz.tzutc,tz.tzoffsetandzoneinfo.ZoneInfodo. This means thatdatetime.timeobjects with such a zone attached are now aware:time(12, tzinfo=tz.gettz("UTC")).isoformat()is now"12:00:00+00:00"rather than"12:00:00". (gh pr #1130) behavior changed · inferredtz.tzfilenow infersdst()from the standard time on both sides of each DST period, rather than only the one before it, and does so for each transition rather than for each local time type. This fixesdst()for double summer time (e.g. inEurope/Londonin the 1940s), for half-hour DST (e.g. inPacific/Rarotonga) and where the standard offset changed at the same time as a DST transition (e.g. inAmerica/Bahia_Banderasin 2010). Against the standard offsets in the tz database source, the only remaining errors are inEurope/Parisin 1944 and 1945. (gh pr #1130)- Fixed
rrulestrraisingValueErroron experimentalX-parameters in anRRULEline (such as GNOME Evolution'sX-EVOLUTION-ENDDATE); these are now ignored as RFC 5545 permits. Fixed by @yajo (gh pr #1374) - Enabled pickling and deepcopy of cached
rruleandrrulesetinstances. The cache setting is preserved, and cached results are regenerated on demand without copying locks or generators. Reported by @niccokunzmann (gh issue #1369). Fixed by @Jay1023CN (gh pr #1600). - Fixed
relativedelta.__ne__raisingTypeErrorwhen comparing against an unsupported type such asNone; it now returnsTrue. Reported and fixed by @kevinkt1 (gh issue #1157, gh pr #1158) - Raised the minimum version of
sixto 1.6, fixingNo module named 'six.moves'errors with older versions. Reported by @skytreader (gh issue #1415), fixed by @jdarias3 (gh pr #1424). requirement raised · inferred
Deprecations
- Deprecated the
dateutil.zoneinfomodule. The module now acts as a wrapper around thetzdatapackage and will be removed in a future version. Users are encouraged to migrate todateutil.tz.gettzor the standard library'szoneinfomodule.dateutil.zoneinfo.rebuild.rebuildno longer does anything, and by default raisesRebuildDeprecationWarningas an error; filter the warning to call it as a no-op. (gh pr #1130) deprecated · vendor-flagged behavior changed · vendor-flagged - Deprecated passing
gettza relative key that refers to a file outside of every directory onTZPATH, such as"../../etc/localtime". By default this now raisesdateutil.tz.DeprecatedTzKeyWarningas an error; filter the warning to keep the old behavior for now, or pass an absolute path instead. (gh pr #1130) deprecated · vendor-flagged
Documentation changes
- Added intersphinx to the docs build and cleaned up some broken links. (gh pr #1463)
Misc
- Releases are now uploaded to PyPI using trusted publishing, and the built sdist and wheel are tested on all supported platforms before upload. (gh pr #1619, #1622)
- Changes to CI, tests and release tooling that do not affect users of the package: gh pr #1417, #1462, #1464, #1465, #1466, #1467, #1468, #1469, #1470, #1499, #1501, #1504, #1576, #1577, #1578, #1581, #1585.