Skip to content

Commit 73cfde1

Browse files
authored
Feature/add python3.12 drop python3.7 (#112)
1 parent 0e7adb3 commit 73cfde1

18 files changed

+457
-518
lines changed

.github/workflows/workflow.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
runs-on: ubuntu-latest
1616
strategy:
1717
matrix:
18-
python-version: ["3.7", "3.8", "3.9", "3.10"]
18+
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
1919
steps:
2020
- uses: actions/checkout@v2
2121
- name: Set up Python
@@ -34,8 +34,6 @@ jobs:
3434
matrix:
3535
include:
3636
# test python versions
37-
- python: "3.7"
38-
os: ubuntu-latest
3937
- python: "3.8"
4038
os: ubuntu-latest
4139
- python: "3.9"
@@ -44,6 +42,8 @@ jobs:
4442
os: ubuntu-latest
4543
- python: "3.11"
4644
os: ubuntu-latest
45+
- python: "3.12"
46+
os: ubuntu-latest
4747
# test OSs
4848
- python: "3.x"
4949
os: macos-latest

Makefile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,8 +27,8 @@ init: .clean .init
2727
@echo ---- 🔧 Re-initialized project ----
2828

2929
lint: .init
30-
poetry run ruff --fix di tests
31-
poetry run black di tests
30+
poetry run ruff --fix di tests docs_src
31+
poetry run black di tests docs_src
3232
poetry run mypy di tests
3333

3434
test: .init

di/_container.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,6 @@
11
from __future__ import annotations
22

33
import inspect
4-
import sys
54
import typing
65
from contextlib import AsyncExitStack, ExitStack, contextmanager
76
from types import TracebackType
@@ -12,6 +11,7 @@
1211
Generic,
1312
Iterable,
1413
Mapping,
14+
Protocol,
1515
Sequence,
1616
TypeVar,
1717
cast,
@@ -57,11 +57,6 @@
5757
WiringError,
5858
)
5959

60-
if sys.version_info < (3, 8): # pragma: no cover
61-
from typing_extensions import Protocol
62-
else: # pragma: no cover
63-
from typing import Protocol
64-
6560

6661
class BindHook(Protocol):
6762
def __call__(

di/_utils/concurrency.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,9 @@
1717
overload,
1818
)
1919

20-
if sys.version_info < (3, 10):
20+
if sys.version_info < (3, 10): # pragma: no cover
2121
from typing_extensions import ParamSpec
22-
else:
22+
else: # pragma: no cover
2323
from typing import ParamSpec
2424

2525
import anyio

di/_utils/inspect.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
import sys
44
from typing import Any, Callable, Dict, Mapping, Optional, Union
55

6-
if sys.version_info < (3, 9):
6+
if sys.version_info < (3, 9): # pragma: no cover
77
from typing_extensions import Annotated, get_args, get_origin, get_type_hints
8-
else:
8+
else: # pragma: no cover
99
from typing import Annotated, get_args, get_origin, get_type_hints
1010

1111
from di._utils.types import Some

di/_utils/types.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,6 @@
1-
import sys
21
from dataclasses import dataclass
32
from types import TracebackType
4-
from typing import Generic, Optional, Type, TypeVar, Union
5-
6-
if sys.version_info < (3, 8): # pragma: no cover
7-
from typing_extensions import Protocol
8-
else: # pragma: no cover
9-
from typing import Protocol
10-
3+
from typing import Generic, Optional, Protocol, Type, TypeVar, Union
114

125
T = TypeVar("T")
136

di/_utils/typing.py

Lines changed: 0 additions & 10 deletions
This file was deleted.

di/api/dependencies.py

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,14 @@
11
import inspect
2-
import sys
3-
from typing import Any, Generic, List, NamedTuple, Optional, TypeVar
4-
5-
if sys.version_info < (3, 8):
6-
from typing_extensions import Protocol, runtime_checkable
7-
else:
8-
from typing import Protocol, runtime_checkable
2+
from typing import (
3+
Any,
4+
Generic,
5+
List,
6+
NamedTuple,
7+
Optional,
8+
Protocol,
9+
TypeVar,
10+
runtime_checkable,
11+
)
912

1013
from di._utils.types import CacheKey
1114
from di.api.providers import DependencyProviderType

di/api/executor.py

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,6 @@
11
from __future__ import annotations
22

3-
import sys
4-
from typing import Iterable, Union
5-
6-
if sys.version_info < (3, 8):
7-
from typing_extensions import Protocol
8-
else:
9-
from typing import Protocol
3+
from typing import Iterable, Protocol, Union
104

115
from di._task import AsyncTask, ExecutionState, SyncTask
126

di/typing.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
import sys
22
from typing import Generator, Type, TypeVar
33

4-
if sys.version_info < (3, 9):
4+
if sys.version_info < (3, 9): # pragma: no cover
55
from typing_extensions import Annotated, get_args, get_origin
6-
else:
6+
else: # pragma: no cover
77
from typing import Annotated, get_args, get_origin
88

99
from di._utils.inspect import get_parameters
1010

11-
__all__ = ("get_parameters", "get_markers_from_annotation")
11+
__all__ = ("Annotated", "get_parameters", "get_markers_from_annotation")
1212

1313

1414
T = TypeVar("T")

0 commit comments

Comments
 (0)