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-2025.10.9.tar.gz (17.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

datetype-2025.10.9-py3-none-any.whl (15.4 kB view details)

Uploaded Python 3

File details

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

File metadata

  • Download URL: datetype-2025.10.9.tar.gz
  • Upload date:
  • Size: 17.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.8

File hashes

Hashes for datetype-2025.10.9.tar.gz
Algorithm Hash digest
SHA256 42ac51ed9b33a6eaf082802b8a83d14f456b51e715b1167c131acd352595aacd
MD5 185b6e7b9e18a9047e089180264acb23
BLAKE2b-256 63cc33056e3ab496d452ddcd63482b966298228715810e26cdad63b859214b91

See more details on using hashes here.

File details

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

File metadata

  • Download URL: datetype-2025.10.9-py3-none-any.whl
  • Upload date:
  • Size: 15.4 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.8

File hashes

Hashes for datetype-2025.10.9-py3-none-any.whl
Algorithm Hash digest
SHA256 e2ee42e5f31eb5b9d560dcb29d84fc2f0b404b74e8b0a4b2bf6318b868dd8059
MD5 18a6f822e085754973d2f0c6a4cb9817
BLAKE2b-256 c3f83b1f57226143d7306a01ab358a135e7be2b4c26f7899864dce0177b02b8b

See more details on using hashes here.

Supported by

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