types-datetimerange

raw JSON →
2.0.0.6 verified Mon Apr 27 auth: no python

Typing stubs for DateTimeRange, part of the typeshed project. Provides type hints for the DateTimeRange library. Version 2.0.0.6; updated periodically with typeshed releases.

pip install types-datetimerange
error ModuleNotFoundError: No module named 'datetimerange'
cause DateTimeRange not installed.
fix
pip install DateTimeRange
error ImportError: cannot import name 'DateTimeRange' from 'DateTimeRange'
cause Wrong import path (capitalized module).
fix
Use: from datetimerange import DateTimeRange
breaking Types stubs may lag behind DateTimeRange releases; if you encounter type errors, ensure both packages are up-to-date.
fix pip install --upgrade types-datetimerange DateTimeRange
gotcha These are third-party stubs maintained by typeshed; they may not cover all edge cases. Report missing stubs to typeshed.
fix Use `# type: ignore` if needed.

Basic usage of DateTimeRange with typing stubs.

from datetimerange import DateTimeRange
# No extra import needed for typing stubs; they are automatically used by mypy/pyright when types-datetimerange is installed.
range = DateTimeRange("2023-01-01", "2023-01-31")
print(range)