flake8-datetimez
flake8-datetimez copied to clipboard
pytz lint
I'm interested in pytz linting, specifically preventing pytz timezone classes (BaseTzInfo
) from being used directly as the tzinfo
argument with datetime.datetime(tzinfo=)
and with .replace(tzinfo=)
, since that is almost always an error.
Would you be open to a PR adding pytz added as a dependency and checks around those cases?
You should probably avoid using pytz: https://blog.ganssle.io/articles/2018/03/pytz-fastest-footgun.html
@djmattyg007 Yes, I would agree 🙂 We have some legacy code in pytz that we aren't prepared to rewrite, but we also don't want any new usage of pytz sneaking into the codebase. It would be easier to enforce this with a linting rule since we can't yet remove pytz as a direct dependency and it is a downstream dependency of a lot of other packages we use at this point.