Skip to content

Commit ac76030

Browse files
Niloth-pandersk
andcommitted
requirements: Add backports.datetime_fromisoformat for Py<3.11.
Co-authored-by: Anders Kaseorg <[email protected]>
1 parent 8a165f1 commit ac76030

File tree

3 files changed

+9
-0
lines changed

3 files changed

+9
-0
lines changed

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,7 @@ warn_unreachable = true
6060
[[tool.mypy.overrides]]
6161
module = [
6262
"apiai.*",
63+
"backports.datetime_fromisoformat.*",
6364
"feedparser.*",
6465
"gitlint.*",
6566
"google.auth.*",

zulip/setup.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,6 +64,7 @@ def recur_expand(target_root: Any, dir: Any) -> Generator[Tuple[str, List[str]],
6464
],
6565
},
6666
install_requires=[
67+
"backports-datetime-fromisoformat; python_version < '3.11'",
6768
"requests[security]>=0.12.1",
6869
"distro",
6970
"click",

zulip/zulip/__init__.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,13 @@
3535
# Ensure the Python version is supported
3636
assert sys.version_info >= (3, 6)
3737

38+
if sys.version_info < (3, 11):
39+
from backports.datetime_fromisoformat import (
40+
datetime_fromisoformat as datetime_fromisoformat, # noqa: PLC0414
41+
)
42+
else:
43+
datetime_fromisoformat = datetime.fromisoformat
44+
3845
logger = logging.getLogger(__name__)
3946

4047
API_VERSTRING = "v1/"

0 commit comments

Comments
 (0)