Skip to content

Releases: pjknkda/flake8-datetimez

26.8.1

Choose a tag to compare

@pjknkda pjknkda released this 12 Aug 11:49
949ac73

What's Changed

  • Fix README rendering on PyPI and update project metadata by @pjknkda in #16

Full Changelog: 26.8.0...26.8.1

26.8.0

Choose a tag to compare

@pjknkda pjknkda released this 12 Aug 11:29
6fe6414

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 naive datetime.datetime.min and datetime.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 for utcnow() and utcfromtimestamp(): 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 AttributeError and flake8 aborted on any file containing datetime.strptime(x, "..."), because the ast.Constant.s alias was removed.
  • datetime.n(), datetime.o() and datetime.w() were reported as now(), 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

Full Changelog: 20.10.0...26.8.0

20.10.0

Choose a tag to compare

@pjknkda pjknkda released this 20 Oct 05:32
  • allow the use case where datetime class is imported from datetime module.

20.6.0

Choose a tag to compare

@pjknkda pjknkda released this 10 Jun 01:51
  • allow the use of datetime.strptime() with %z format
  • allow the use of datetime.strptime() with .astimezone()
  • change version scheme from {year.month.week.rev} to {year.month.rev}

19.5.4.0

Choose a tag to compare

@pjknkda pjknkda released this 30 May 07:16

add test suite file to distribution and remove the unused logger

19.4.5.0

Choose a tag to compare

@pjknkda pjknkda released this 30 Apr 10:27
add datetime.date related rules and advance kwargs check

19.4.4.0

Choose a tag to compare

@pjknkda pjknkda released this 30 Apr 10:26
add repo url to setup.py