Whenever – typed and DST-safe datetimes for Python
a year ago
- #timezone
- #python
- #datetime
- Introduces 'whenever', a Python library for typed and DST-safe datetimes, available in Rust or pure Python.
- Addresses common pitfalls with Python's datetime, such as mixing naive and aware datetimes and DST handling.
- Offers DST-safe arithmetic, typesafe API to prevent common bugs, and fixes issues not addressed by Arrow or Pendulum.
- Features include explicit types for different use cases, DST-safe arithmetic, comparison and equality, rounding and truncation, and formatting & parsing common formats.
- Performance is a key feature, with the library being faster than other third-party libraries and usually the standard library.
- Supports date arithmetic, nanosecond precision, and has experimental support for the latest GIL-related improvements.
- Future roadmap includes API stability, customizable parsing and formatting, intervals, ranges, recurring times, and parsing leap seconds.
- Limitations include support for the proleptic Gregorian calendar between 1 and 9999 AD, whole second timezone offsets, and no leap second support.
- Licensed under MIT, with Rust dependencies under similarly permissive licenses.
- Inspired by and borrows concepts from other projects, using Python's zoneinfo module for timezone data.