Skip to content

Commit ec4ed15

Browse files
committed
Support Python 3.10
Also restrict web frameworks to supported versions
1 parent bda6a87 commit ec4ed15

File tree

15 files changed

+61
-47
lines changed

15 files changed

+61
-47
lines changed

.github/workflows/deploy.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,10 +11,10 @@ jobs:
1111

1212
steps:
1313
- uses: actions/checkout@v2
14-
- name: Set up Python 3.8
14+
- name: Set up Python 3.9
1515
uses: actions/setup-python@v2
1616
with:
17-
python-version: 3.8
17+
python-version: 3.9
1818
- name: Build wheel and source tarball
1919
run: |
2020
pip install wheel
@@ -23,4 +23,4 @@ jobs:
2323
uses: pypa/[email protected]
2424
with:
2525
user: __token__
26-
password: ${{ secrets.pypi_password }}
26+
password: ${{ secrets.pypi_password }}

.github/workflows/lint.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,15 @@ jobs:
88

99
steps:
1010
- uses: actions/checkout@v2
11-
- name: Set up Python 3.8
11+
- name: Set up Python 3.9
1212
uses: actions/setup-python@v2
1313
with:
14-
python-version: 3.8
14+
python-version: 3.9
1515
- name: Install dependencies
1616
run: |
1717
python -m pip install --upgrade pip
1818
pip install tox
1919
- name: Run lint and static type checks
2020
run: tox
2121
env:
22-
TOXENV: flake8,black,import-order,mypy,manifest
22+
TOXENV: flake8,black,import-order,mypy,manifest

.github/workflows/tests.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,17 @@ jobs:
88
strategy:
99
max-parallel: 4
1010
matrix:
11-
python-version: ["3.6", "3.7", "3.8", "3.9"]
11+
python-version: ["3.6", "3.7", "3.8", "3.9", "3.10"]
1212
os: [ubuntu-latest, windows-latest]
1313
exclude:
1414
- os: windows-latest
1515
python-version: "3.6"
1616
- os: windows-latest
1717
python-version: "3.7"
1818
- os: windows-latest
19-
python-version: "3.9"
19+
python-version: "3.8"
20+
- os: windows-latest
21+
python-version: "3.10"
2022

2123
steps:
2224
- uses: actions/checkout@v2
@@ -38,10 +40,10 @@ jobs:
3840

3941
steps:
4042
- uses: actions/checkout@v2
41-
- name: Set up Python 3.8
43+
- name: Set up Python 3.9
4244
uses: actions/setup-python@v2
4345
with:
44-
python-version: 3.8
46+
python-version: 3.9
4547
- name: Install test dependencies
4648
run: |
4749
python -m pip install --upgrade pip

graphql_server/__init__.py

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,17 @@
99
import json
1010
from collections import namedtuple
1111
from collections.abc import MutableMapping
12-
from typing import Any, Callable, Collection, Dict, List, Optional, Type, Union
12+
from typing import (
13+
Any,
14+
Callable,
15+
Collection,
16+
Dict,
17+
List,
18+
Optional,
19+
Type,
20+
Union,
21+
cast,
22+
)
1323

1424
from graphql.error import GraphQLError
1525
from graphql.execution import ExecutionResult, execute
@@ -56,7 +66,7 @@
5666

5767
def format_error_default(error: GraphQLError) -> Dict:
5868
"""The default function for converting GraphQLError to a dictionary."""
59-
return error.formatted
69+
return cast(Dict, error.formatted)
6070

6171

6272
def run_http_query(

graphql_server/aiohttp/graphqlview.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -201,7 +201,9 @@ async def __call__(self, request):
201201
return web.Response(text=source, content_type="text/html")
202202

203203
return web.Response(
204-
text=result, status=status_code, content_type="application/json",
204+
text=result,
205+
status=status_code,
206+
content_type="application/json",
205207
)
206208

207209
except HttpQueryError as err:

graphql_server/flask/graphqlview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,9 @@
55

66
from flask import Response, render_template_string, request
77
from flask.views import View
8+
from graphql import specified_rules
89
from graphql.error import GraphQLError
910
from graphql.type.schema import GraphQLSchema
10-
from graphql import specified_rules
1111

1212
from graphql_server import (
1313
GraphQLParams,

graphql_server/sanic/graphqlview.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,8 +212,8 @@ def request_wants_html(request):
212212
return "text/html" in accept or "*/*" in accept
213213

214214
def process_preflight(self, request):
215-
""" Preflight request support for apollo-client
216-
https://www.w3.org/TR/cors/#resource-preflight-requests """
215+
"""Preflight request support for apollo-client
216+
https://www.w3.org/TR/cors/#resource-preflight-requests"""
217217
origin = request.headers.get("Origin", "")
218218
method = request.headers.get("Access-Control-Request-Method", "").upper()
219219

graphql_server/webob/graphqlview.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,9 @@
33
from functools import partial
44
from typing import List
55

6+
from graphql import specified_rules
67
from graphql.error import GraphQLError
78
from graphql.type.schema import GraphQLSchema
8-
from graphql import specified_rules
99
from webob import Response
1010

1111
from graphql_server import (

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@
2424
]
2525

2626
install_sanic_requires = [
27-
"sanic>=21,<22",
27+
"sanic>=20.3,<21",
2828
]
2929

3030
install_webob_requires = [
@@ -35,7 +35,7 @@
3535
"aiohttp>=3.8,<4",
3636
]
3737

38-
install_quart_requires = ["quart>=0.6.15,<1"]
38+
install_quart_requires = ["quart>=0.6.15,<0.15"]
3939

4040
install_all_requires = (
4141
install_requires
@@ -71,6 +71,7 @@
7171
"Programming Language :: Python :: 3.7",
7272
"Programming Language :: Python :: 3.8",
7373
"Programming Language :: Python :: 3.9",
74+
"Programming Language :: Python :: 3.10",
7475
"License :: OSI Approved :: MIT License",
7576
],
7677
keywords="api graphql protocol rest",

tests/aiohttp/schema.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,10 @@ def resolve_raises(*_):
1818
QueryRootType = GraphQLObjectType(
1919
name="QueryRoot",
2020
fields={
21-
"thrower": GraphQLField(GraphQLNonNull(GraphQLString), resolve=resolve_raises,),
21+
"thrower": GraphQLField(
22+
GraphQLNonNull(GraphQLString),
23+
resolve=resolve_raises,
24+
),
2225
"request": GraphQLField(
2326
GraphQLNonNull(GraphQLString),
2427
resolve=lambda obj, info, *args: info.context["request"].query.get("q"),

0 commit comments

Comments
 (0)