Skip to main content

A type wrapper for the standard library `datetime` that supplies stricter checks, such as making 'datetime' not substitutable for 'date', and separating out Naive and Aware datetimes into separate, mutually-incompatible types.

Project description

DateType

A Workaround

DateType is a workaround for this bug to demonstrate that we could have a type-checking-time wrapper for datetime that doesn't change (or almost doesn't change) the implementation, but fixes up two very annoying behaviors of the stdlib datetime module:

  1. a datetime now won't type-check as a date - it still inherits at runtime (the implementation is, after all, not changed) but it doesn't inherit at type-time.

  2. there are separate types for naive and aware datetimes.

There's a very small bit of implementation glue (concrete @classmethods for construction on the Naive and Aware types, and a few functions that do runtime checks to convert to/from stdlib types).

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

datetype-2022.6.5.tar.gz (5.5 kB view details)

Uploaded Source

Built Distribution

datetype-2022.6.5-py3-none-any.whl (5.2 kB view details)

Uploaded Python 3

File details

Details for the file datetype-2022.6.5.tar.gz.

File metadata

  • Download URL: datetype-2022.6.5.tar.gz
  • Upload date:
  • Size: 5.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for datetype-2022.6.5.tar.gz
Algorithm Hash digest
SHA256 d67825d49ee7bec8a5b9b465c2cbfe4a5380532fa99e40bb0c0bccce6443c58f
MD5 a652e25f7fe7333a0381ba28e5af944b
BLAKE2b-256 85fcaa7a5de489f8d138a928cf16cfcdd050269d9d1dd8317507b8edaf58e73e

See more details on using hashes here.

File details

Details for the file datetype-2022.6.5-py3-none-any.whl.

File metadata

  • Download URL: datetype-2022.6.5-py3-none-any.whl
  • Upload date:
  • Size: 5.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.4

File hashes

Hashes for datetype-2022.6.5-py3-none-any.whl
Algorithm Hash digest
SHA256 f32567d797ef1a3a77579f65b92efde129a35c52a4330b6fe23af74ff7fa50f2
MD5 0c1c0b399428c177b73b8c5cb0addb43
BLAKE2b-256 77e3235ffc422f8801fcee9e8c294102edc453bf0587198eda0840352f73693e

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