Skip to content

Commit f6b7696

Browse files
committed
requirements: Add backports.datetime_fromisoformat for Py<3.11.
1 parent df7e7c9 commit f6b7696

File tree

3 files changed

+8
-0
lines changed

3 files changed

+8
-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: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@
3535
# Ensure the Python version is supported
3636
assert sys.version_info >= (3, 6)
3737

38+
# Patch datetime.fromisoformat for Python < 3.11
39+
if sys.version_info < (3, 11):
40+
from backports.datetime_fromisoformat import MonkeyPatch
41+
42+
MonkeyPatch.patch_fromisoformat()
43+
3844
logger = logging.getLogger(__name__)
3945

4046
API_VERSTRING = "v1/"

0 commit comments

Comments
 (0)