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.11.30.tar.gz (17.4 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.11.30-py3-none-any.whl (15.7 kB view details)

Uploaded Python 3

File details

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

File metadata

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

File hashes

Hashes for datetype-2025.11.30.tar.gz
Algorithm Hash digest
SHA256 96ca1e81788e2978ec17eef0bb2286ca9dd5c418091a918881c607367f364578
MD5 7e2e117391b1290e9fe115788c0df266
BLAKE2b-256 72cd7a7f867807eefe1a74a39e104a379adef2f8d3a986fb84abbf0c887b08f8

See more details on using hashes here.

File details

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

File metadata

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

File hashes

Hashes for datetype-2025.11.30-py3-none-any.whl
Algorithm Hash digest
SHA256 b88db471ad3ef19c06e5b7f411d6333b8ff6412a00a55a32d66dbccdea40c143
MD5 3d9f2664404f6c6660c7809691117f1b
BLAKE2b-256 24735f888710da76659c183cd16488272e747c837cbbd560f5077b78cf29b504

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