Skip to content

Commit 0845aa9

Browse files
jkimbojrd
andauthored
Python 3.10 compatibility (#1350)
Co-authored-by: Cyrille Pontvieux <[email protected]>
1 parent aba771b commit 0845aa9

File tree

6 files changed

+30
-8
lines changed

6 files changed

+30
-8
lines changed

.github/workflows/tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ jobs:
88
strategy:
99
max-parallel: 4
1010
matrix:
11-
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"]
11+
python-version: ["2.7", "3.6", "3.7", "3.8", "3.9", "3.10-dev"]
1212

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

graphene/relay/connection.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import re
2-
from collections import Iterable, OrderedDict
2+
from collections import OrderedDict
3+
4+
try:
5+
from collections.abc import Iterable
6+
except ImportError:
7+
from collections import Iterable
8+
39
from functools import partial
410

511
from graphql_relay import connection_from_list

graphene/types/field.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
import inspect
2-
from collections import Mapping, OrderedDict
2+
from collections import OrderedDict
3+
4+
try:
5+
from collections.abc import Mapping
6+
except ImportError:
7+
from collections import Mapping
8+
39
from functools import partial
410

511
from .argument import Argument, to_arguments

graphene/utils/crunch.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,9 @@
11
import json
2-
from collections import Mapping
2+
3+
try:
4+
from collections.abc import Mapping
5+
except ImportError:
6+
from collections import Mapping
37

48

59
def to_key(value):

graphene/utils/deduplicator.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
1-
from collections import Mapping, OrderedDict
1+
from collections import OrderedDict
2+
3+
try:
4+
from collections.abc import Mapping
5+
except ImportError:
6+
from collections import Mapping
27

38

49
def deflate(node, index=None, path=None):

tox.ini

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
[tox]
2-
envlist = py{27,36,37,38,39},flake8,pre-commit,mypy
2+
envlist = py{27,36,37,38,39,310},flake8,pre-commit,mypy
33

44
[gh-actions]
55
python =
@@ -8,18 +8,19 @@ python =
88
3.7: py37
99
3.8: py38
1010
3.9: py39
11+
3.10-dev: py310
1112

1213
[testenv]
1314
passenv = *
1415
usedevelop = True
1516
deps =
1617
-e.[test]
17-
py{36,37,38,39}: pytest-asyncio
18+
py{36,37,38,39,310}: pytest-asyncio
1819
setenv =
1920
PYTHONPATH = .:{envdir}
2021
commands =
2122
py{27}: py.test --cov=graphene graphene examples {posargs}
22-
py{36,37,38,39}: py.test --cov=graphene graphene examples tests_asyncio tests_py36 {posargs}
23+
py{36,37,38,39,310}: py.test --cov=graphene graphene examples tests_asyncio tests_py36 {posargs}
2324

2425
[testenv:pre-commit]
2526
deps =

0 commit comments

Comments
 (0)