Repository navigation
Releases: pjknkda/flake8-datetimez
Releases · pjknkda/flake8-datetimez
Release list
26.8.1
26.8.0
What's Changed
Breaking
- Python 3.8 is now the minimum. Support for 3.6 and 3.7 is dropped â both have been end-of-life for years, and the checker already relied on
ast.Constant, which only the 3.8+ parser produces. Tested on 3.8 through 3.14.
Added
DTZ901, for naivedatetime.datetime.minanddatetime.datetime.max. They overflow when converted to another timezone, and.timestamp()raises for any timezone west of UTC. The code matches Ruff's rule. Closes #13.
Changed
.astimezone()is accepted as a fix for DTZ001, DTZ002, DTZ005 and DTZ006, alongside DTZ007 which already did. It stays rejected forutcnow()andutcfromtimestamp(): those return a UTC wall clock, and reading it as local time shifts the instant by the local UTC offset rather than fixing it. Closes #9, #11.
Fixed
- On Python 3.14, DTZ007 raised
AttributeErrorand flake8 aborted on any file containingdatetime.strptime(x, "..."), because theast.Constant.salias was removed. datetime.n(),datetime.o()anddatetime.w()were reported asnow(), because the attribute was compared with a substring test.- The source of every linted file was read from disk a second time and discarded, even though flake8 already hands the plugin a parsed tree.
All of the above landed in #15, except the first step toward newer Python versions, contributed by @Kristinita in #14.
Special thanks to @sasanjac for #10. It could not be merged after the base moved on, which is on me, but the idea and the patch are what shaped how .astimezone() landed here.
Upgrading
On Python 3.6 or 3.7, stay on 20.10.0 â pip will not offer this release. Otherwise, expect new DTZ901 warnings and fewer .astimezone() warnings; nothing else changes.
For new projects, please prefer Ruff's DTZ rule set, which is faster and more actively maintained. This plugin remains for codebases that are still on flake8, and is maintained on a best-effort basis for backward compatibility.
New Contributors
- @Kristinita made their first contribution in #14
Full Changelog: 20.10.0...26.8.0