Skip to main content

Plugin to check that utcnow() is not used in favour of now(UTC)

Project description

flake8_datetime_utcnow_plugin

Rationale

Plugin for flake8 to warn the developer of the usage of datetime.utcnow().

The problem with datetme.utcnow() is that indeed returns the current timestamp in the UTC timzone but the object is a naive datetime, that is doesn't have the tzinfo argument set.

Instead [datetime.now()](https://docs.python.org/3/library/datetime.html#datetime.datetime.utcnow] shoukd be used passing the UTC timezone:

from datetime import datetime, timezone

datetime.now(timezone.utc)

Installation

To install the plugin and flake8:

pip install flake8_datetime_utcnow_plugin

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

flake8_datetime_utcnow_plugin-0.1.0.tar.gz (2.4 kB view details)

Uploaded Source

Built Distribution

File details

Details for the file flake8_datetime_utcnow_plugin-0.1.0.tar.gz.

File metadata

  • Download URL: flake8_datetime_utcnow_plugin-0.1.0.tar.gz
  • Upload date:
  • Size: 2.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for flake8_datetime_utcnow_plugin-0.1.0.tar.gz
Algorithm Hash digest
SHA256 232fdc8a1f63f00bf86fa1a061f79e5da6aea52fe4e4cbdeade3cdad3916a357
MD5 56164a57ae260945489e21a2030b5db7
BLAKE2b-256 ea3baa6abb567ad3569bb2173710342dd02ebf834e9de189d8635803e200eed1

See more details on using hashes here.

File details

Details for the file flake8_datetime_utcnow_plugin-0.1.0-py3-none-any.whl.

File metadata

  • Download URL: flake8_datetime_utcnow_plugin-0.1.0-py3-none-any.whl
  • Upload date:
  • Size: 4.3 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.2.0 pkginfo/1.5.0.1 requests/2.24.0 setuptools/50.3.0 requests-toolbelt/0.9.1 tqdm/4.48.2 CPython/3.6.7

File hashes

Hashes for flake8_datetime_utcnow_plugin-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 8ddec647c639a9a0123995556bba2683a6975d77935c78e201bab9bec89d5a60
MD5 03bd1764c502a9fbf965f053414ce942
BLAKE2b-256 fae74a88a19f468b33873e8687cb24f8e2bcf695044a4c79bcd9751bf10ddad8

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page