Skip to content

Commit d42eddb

Browse files
committed
Support Python 3.12 and update dependencies
1 parent 37f8eb2 commit d42eddb

File tree

10 files changed

+281
-132
lines changed

10 files changed

+281
-132
lines changed

.github/workflows/lint.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,12 +7,12 @@ jobs:
77
runs-on: ubuntu-latest
88

99
steps:
10-
- uses: actions/checkout@v3
10+
- uses: actions/checkout@v4
1111

12-
- name: Set up Python 3.11
13-
uses: actions/setup-python@v4
12+
- name: Set up Python 3.12
13+
uses: actions/setup-python@v5
1414
with:
15-
python-version: '3.11'
15+
python-version: '3.12'
1616

1717
- name: Install dependencies
1818
run: |

.github/workflows/publish.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,12 @@ jobs:
1010
runs-on: ubuntu-latest
1111

1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414

15-
- name: Set up Python 3.11
16-
uses: actions/setup-python@v4
15+
- name: Set up Python 3.12
16+
uses: actions/setup-python@v5
1717
with:
18-
python-version: '3.11'
18+
python-version: '3.12'
1919

2020
- name: Build wheel and source tarball
2121
run: |

.github/workflows/test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88

99
strategy:
1010
matrix:
11-
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', 'pypy3.9']
11+
python-version: ['3.7', '3.8', '3.9', '3.10', '3.11', '3.12', 'pypy3.9', 'pypy3.10']
1212

1313
steps:
1414
- uses: actions/checkout@v3

poetry.lock

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

pyproject.toml

Lines changed: 24 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ classifiers = [
2020
"Programming Language :: Python :: 3.8",
2121
"Programming Language :: Python :: 3.9",
2222
"Programming Language :: Python :: 3.10",
23-
"Programming Language :: Python :: 3.11"
23+
"Programming Language :: Python :: 3.11",
24+
"Programming Language :: Python :: 3.12",
2425
]
2526
packages = [
2627
{ include = "graphql", from = "src" },
@@ -41,41 +42,51 @@ Changelog = "https://github.com/graphql-python/graphql-core/releases"
4142
[tool.poetry.dependencies]
4243
python = "^3.7"
4344
typing-extensions = [
44-
{ version = "^4.5", python = "<3.10" }
45+
{ version = "^4.9", python = ">=3.8,<3.10" },
46+
{ version = "^4.7.1", python = "<3.8" },
4547
]
4648

4749
[tool.poetry.group.test]
4850
optional = true
4951

5052
[tool.poetry.group.test.dependencies]
51-
pytest = "^7.3"
52-
pytest-asyncio = ">=0.21,<1"
53+
pytest = [
54+
{ version = "^8.0", python = ">=3.8" },
55+
{ version = "^7.4", python = "<3.8"}
56+
]
57+
pytest-asyncio = [
58+
{ version = "^0.23.5", python = ">=3.8" },
59+
{ version = "~0.21.1", python = "<3.8"}
60+
]
5361
pytest-benchmark = "^4.0"
5462
pytest-cov = "^4.1"
55-
pytest-describe = "^2.1"
56-
pytest-timeout = "^2.1"
63+
pytest-describe = "^2.2"
64+
pytest-timeout = "^2.2"
5765
tox = [
58-
{ version = ">=4.12,<5", python = ">=3.8" },
59-
{ version = ">=3.28,<4", python = "<3.8" }
66+
{ version = "^4.12", python = ">=3.8" },
67+
{ version = "^3.28", python = "<3.8" }
6068
]
6169

6270
[tool.poetry.group.lint]
6371
optional = true
6472

6573
[tool.poetry.group.lint.dependencies]
66-
ruff = ">=0.2,<0.3"
67-
mypy = "1.8.0"
74+
ruff = ">=0.2.1,<0.3"
75+
mypy = [
76+
{ version = "^1.8", python = ">=3.8" },
77+
{ version = "~1.4", python = "<3.8" }
78+
]
6879
bump2version = ">=1.0,<2"
6980

7081
[tool.poetry.group.doc]
7182
optional = true
7283

7384
[tool.poetry.group.doc.dependencies]
7485
sphinx = [
75-
{ version = ">=4,<7", python = ">=3.8" },
86+
{ version = ">=7,<8", python = ">=3.8" },
7687
{ version = ">=4,<6", python = "<3.8" }
7788
]
78-
sphinx_rtd_theme = ">=1,<2"
89+
sphinx_rtd_theme = "^2.0"
7990

8091
[tool.ruff]
8192
line-length = 88
@@ -281,5 +292,5 @@ timeout = "100"
281292
filterwarnings = "ignore::pytest.PytestConfigWarning"
282293

283294
[build-system]
284-
requires = ["poetry_core>=1.6,<2"]
295+
requires = ["poetry_core>=1.6.1,<2"]
285296
build-backend = "poetry.core.masonry.api"

src/graphql/pyutils/is_iterable.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
"""Check whether objects are iterable"""
22

33
from array import array
4-
from typing import Any, ByteString, Collection, Iterable, Mapping, ValuesView
4+
from typing import Any, Collection, Iterable, Mapping, ValuesView
55

66
try:
77
from typing import TypeGuard
@@ -20,7 +20,7 @@
2020
collection_types[0] if len(collection_types) == 1 else tuple(collection_types)
2121
)
2222
iterable_types: Any = Iterable
23-
not_iterable_types: Any = (ByteString, Mapping, str)
23+
not_iterable_types: Any = (bytearray, bytes, str, memoryview, Mapping)
2424

2525

2626
def is_collection(value: Any) -> TypeGuard[Collection]:

tests/execution/test_flatten_async_iterable.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@ async def nested3() -> AsyncGenerator[float, None]:
100100

101101
# throw error
102102
with pytest.raises(RuntimeError, match="ouch"):
103-
await doubles.athrow(RuntimeError, "ouch")
103+
await doubles.athrow(RuntimeError("ouch"))
104104

105105
@pytest.mark.asyncio()
106106
async def completely_yields_sub_iterables_even_when_anext_called_in_parallel():

tests/execution/test_map_async_iterable.py

Lines changed: 3 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -151,7 +151,7 @@ async def __anext__(self):
151151
await anext(doubles)
152152

153153
@pytest.mark.asyncio()
154-
async def allows_throwing_errors_with_values_through_async_iterables():
154+
async def allows_throwing_errors_with_traceback_through_async_iterables():
155155
class Iterable:
156156
def __aiter__(self):
157157
return self
@@ -163,42 +163,16 @@ async def __anext__(self):
163163

164164
assert await anext(one) == 2
165165

166-
# Throw error with value passed separately
167166
try:
168167
raise RuntimeError("Ouch")
169168
except RuntimeError as error:
170169
with pytest.raises(RuntimeError, match="Ouch") as exc_info:
171-
await one.athrow(error.__class__, error)
170+
await one.athrow(error)
172171

173172
assert exc_info.value is error # noqa: PT017
174-
assert exc_info.tb is error.__traceback__ # noqa: PT017
175-
176-
with pytest.raises(StopAsyncIteration):
177-
await anext(one)
178-
179-
@pytest.mark.asyncio()
180-
async def allows_throwing_errors_with_traceback_through_async_iterables():
181-
class Iterable:
182-
def __aiter__(self):
183-
return self
184-
185-
async def __anext__(self):
186-
return 1
187-
188-
one = map_async_iterable(Iterable(), double)
189-
190-
assert await anext(one) == 2
191-
192-
# Throw error with traceback passed separately
193-
try:
194-
raise RuntimeError("Ouch")
195-
except RuntimeError as error:
196-
with pytest.raises(RuntimeError) as exc_info:
197-
await one.athrow(error.__class__, None, error.__traceback__)
198-
199173
assert exc_info.tb
200174
assert error.__traceback__ # noqa: PT017
201-
assert exc_info.tb.tb_frame is error.__traceback__.tb_frame # noqa: PT017
175+
assert exc_info.tb is error.__traceback__ # noqa: PT017
202176

203177
with pytest.raises(StopAsyncIteration):
204178
await anext(one)

tests/execution/test_stream.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1801,6 +1801,7 @@ async def iterable(_info):
18011801
with pytest.raises(StopAsyncIteration):
18021802
await anext(iterator)
18031803

1804+
await sleep(0)
18041805
assert finished
18051806

18061807
@pytest.mark.asyncio()
@@ -1850,6 +1851,8 @@ async def __anext__(self):
18501851
with pytest.raises(StopAsyncIteration):
18511852
await anext(iterator)
18521853

1854+
await sleep(0)
1855+
await sleep(0)
18531856
assert iterable.index == 4
18541857

18551858
@pytest.mark.asyncio()
@@ -1891,4 +1894,5 @@ async def iterable(_info):
18911894
with pytest.raises(StopAsyncIteration):
18921895
await anext(iterator)
18931896

1897+
await sleep(0)
18941898
assert finished

tox.ini

Lines changed: 21 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py3{7,8,9,10,11}, pypy39, ruff, mypy, docs
2+
envlist = py3{7,8,9,10,11,312}, pypy{39,310}, ruff, mypy, docs
33
isolated_build = true
44

55
[gh-actions]
@@ -10,43 +10,45 @@ python =
1010
3.9: py39
1111
3.10: py310
1212
3.11: py311
13-
pypy3: pypy39
13+
3.12: py312
14+
pypy3: pypy9
1415
pypy3.9: pypy39
16+
pypy3.10: pypy310
1517

1618
[testenv:ruff]
17-
basepython = python3.11
18-
deps = ruff>=0.2,<0.3
19+
basepython = python3.12
20+
deps = ruff>=0.2.1,<0.3
1921
commands =
2022
ruff check src tests
2123
ruff format --check src tests
2224

2325
[testenv:mypy]
24-
basepython = python3.11
26+
basepython = python3.12
2527
deps =
26-
mypy==1.8.0
27-
pytest>=7.3,<8
28+
mypy>=1.8.0,<1.9
29+
pytest>=8.0,<9
2830
commands =
2931
mypy src tests
3032

3133
[testenv:docs]
32-
basepython = python3.10
34+
basepython = python3.12
3335
deps =
34-
sphinx>=5.3,<6
35-
sphinx_rtd_theme>=1.1,<2
36+
sphinx>=7,<8
37+
sphinx_rtd_theme>=2.0,<3
3638
commands =
3739
sphinx-build -b html -nEW docs docs/_build/html
3840

3941
[testenv]
4042
deps =
41-
pytest>=7.3,<8
42-
pytest-asyncio>=0.21,<1
43+
pytest>=7.4,<9
44+
pytest-asyncio>=0.21.1,<1
4345
pytest-benchmark>=4,<5
4446
pytest-cov>=4.1,<5
45-
pytest-describe>=2.1,<3
46-
pytest-timeout>=2.1,<3
47-
py37,py38,py39,pypy39: typing-extensions>=4.5,<5
47+
pytest-describe>=2.2,<3
48+
pytest-timeout>=2.2,<3
49+
py37,py38,py39,pypy39: typing-extensions>=4.7.1,<5
4850
commands =
49-
# to also run the time-consuming tests: tox -e py310 -- --run-slow
50-
# to run the benchmarks: tox -e py310 -- -k benchmarks --benchmark-enable
51-
py37,py38,py39,py311,pypy39: pytest tests {posargs}
52-
py310: pytest tests {posargs: --cov-report=term-missing --cov=graphql --cov=tests --cov-fail-under=100}
51+
# to also run the time-consuming tests: tox -e py311 -- --run-slow
52+
# to run the benchmarks: tox -e py311 -- -k benchmarks --benchmark-enable
53+
py37,py38,py39,py310,py311,pypy39,pypy310: pytest tests {posargs}
54+
py312: pytest tests {posargs: --cov-report=term-missing --cov=graphql --cov=tests --cov-fail-under=100}

0 commit comments

Comments
 (0)