Registry / devops / flake8-datetimez

flake8-datetimez

JSON →
library20.10.0pypypiunverified

A flake8 plugin that flags usage of naive datetime objects, enforcing timezone-aware datetime handling. Current version 20.10.0, maintained infrequently (last release 2020).

pip install flake8-datetimez
INSTALL
IMPORT
SIG · FLAKE8-DATETIMEZ
F
flake8-datetimez
devopspythonv20.10.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Install flake8 and the plugin, then run flake8 on a file with naive datetime usage.

pip install flake8 flake8-datetimez echo 'dt = datetime.datetime.now()' > test.py flake8 test.py
Debug
Known issues
gotchaPlugin does not catch all naive datetime patterns: it only flags calls to datetime.datetime() without a tzinfo argument. Calls like datetime.datetime.utcnow() or datetime.datetime.now(pytz.UTC) are not flagged.
fix
Manually review code for other naive datetime patterns, or use additional tools like flake8-datetime-utcnow.
affects: all
gotchaThe plugin only works with flake8; it does not work standalone or with other linters.
fix
Ensure flake8 is installed and configured.
affects: all
Errors
Common errors & fixes
E902 TokenError: ('EOF in multi-line statement', ...) or general syntax errors
flake8-datetimez may conflict with other flake8 plugins or parse errors in files with non-standard encoding.
fix
Update flake8 and all plugins; ensure files are UTF-8 encoded.
ImportError: cannot import name 'check_naive_datetime' from 'flake8_datetimez'
Incorrect import attempt of internal functions. The plugin is auto-discovered by flake8; no explicit import needed.
fix
Remove any explicit import of 'flake8_datetimez' modules; simply add the package to the project and run flake8.
Upgrade
Version history
20.10.0latest on PyPI · released Oct 20, 2020
Audit
Dependencies
flake8requiredRequired plugin runner
Agent activity
2 hits · last 30 days
node
2
Resources
flake8-datetimez — pip install flake8-datetimez · libregistry