Skip to content

Commit e5fea14

Browse files
authored
Require typing_extensions on Python < 3.13 (#193)
On newer Python releases, the typing module has all we need. Fixes: #189
2 parents cc1e751 + e076042 commit e5fea14

5 files changed

Lines changed: 22 additions & 6 deletions

File tree

confuse/core.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,16 @@
3030

3131
import errno
3232
import os
33+
import sys
3334
from collections import OrderedDict
3435
from typing import TYPE_CHECKING, Any, TypeVar, overload
3536

37+
if sys.version_info < (3, 11):
38+
from typing_extensions import Self
39+
else:
40+
from typing import Self
41+
3642
import yaml
37-
from typing_extensions import Self
3843

3944
from . import templates, util, yaml_util
4045
from .exceptions import ConfigError, ConfigTypeError, NotFoundError

confuse/templates.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,16 @@
44
import os
55
import pathlib
66
import re
7+
import sys
78
from collections import abc
89
from collections.abc import Hashable, Iterable, Mapping
910
from functools import singledispatchmethod
1011
from typing import TYPE_CHECKING, Any, Generic, NoReturn, overload
1112

12-
from typing_extensions import TypeVar
13+
if sys.version_info < (3, 13):
14+
from typing_extensions import TypeVar
15+
else:
16+
from typing import TypeVar
1317

1418
from . import exceptions, util
1519

docs/changelog.rst

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
11
Changelog
22
=========
33

4+
Unreleased
5+
----------
6+
7+
- Require `typing_extensions` on older Python versions (and use `typing` on
8+
newer versions). [#189](https://github.com/beetbox/confuse/issues/189)
9+
410
v2.2.0
511
------
612

poetry.lock

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ classifiers = [
1818
]
1919
dependencies = [
2020
"pyyaml",
21+
"typing_extensions >= 4.4; python_version < '3.13'",
2122
]
2223

2324
[dependency-groups]

0 commit comments

Comments
 (0)