From e9a787b470970611190535f3cfc4cc5d843366e3 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Tue, 3 Oct 2023 20:09:44 +0800 Subject: [PATCH 1/7] chore: update to flask 3 --- setup.py | 2 +- tests/flask/test_graphqlview.py | 19 ++++++++++++++++--- 2 files changed, 17 insertions(+), 4 deletions(-) diff --git a/setup.py b/setup.py index bf3f24f..2a89ccf 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ ] + tests_requires install_flask_requires = [ - "flask>=1,<3", + "flask>=1,<4", ] install_sanic_requires = [ diff --git a/tests/flask/test_graphqlview.py b/tests/flask/test_graphqlview.py index a222381..34ddcb9 100644 --- a/tests/flask/test_graphqlview.py +++ b/tests/flask/test_graphqlview.py @@ -1,5 +1,4 @@ import json -from io import StringIO from urllib.parse import urlencode import pytest @@ -518,10 +517,24 @@ def test_allow_empty_custom_context(app, client): def test_post_multipart_data(app, client): query = "mutation TestMutation { writeTest { test } }" + + data = ( + "------flaskgraphql\r\n" + 'Content-Disposition: form-data; name="query"\r\n' + "\r\n" + query + "\r\n" + "------flaskgraphql--\r\n" + "Content-Type: text/plain; charset=utf-8\r\n" + 'Content-Disposition: form-data; name="file"; filename="text1.txt";' + " filename*=utf-8''text1.txt\r\n" + "\r\n" + "\r\n" + "------flaskgraphql--\r\n" + ) + response = client.post( url_string(app), - data={"query": query, "file": (StringIO(), "text1.txt")}, - content_type="multipart/form-data", + data=data, + content_type="multipart/form-data; boundary=----flaskgraphql", ) assert response.status_code == 200 From d9fb1e58fe9dbf32f69f2982fd8f9b4123f4122a Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Tue, 3 Oct 2023 20:11:19 +0800 Subject: [PATCH 2/7] chore: update to sanic 23 --- setup.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 2a89ccf..d66178c 100644 --- a/setup.py +++ b/setup.py @@ -12,7 +12,7 @@ "pytest-asyncio>=0.20,<1", "pytest-cov>=4,<5", "Jinja2>=3.1,<4", - "sanic-testing>=22.3,<23", + "sanic-testing>=22.3,<24", ] dev_requires = [ @@ -28,7 +28,7 @@ ] install_sanic_requires = [ - "sanic>=21.12,<23", + "sanic>=21.12,<24", ] install_webob_requires = [ From 60551858428d342574ba0898dec6c7ba0d8492e1 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Tue, 3 Oct 2023 20:21:18 +0800 Subject: [PATCH 3/7] fix: remove use of deprecated cgi module --- graphql_server/sanic/graphqlview.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/graphql_server/sanic/graphqlview.py b/graphql_server/sanic/graphqlview.py index e8af82d..50e9922 100644 --- a/graphql_server/sanic/graphqlview.py +++ b/graphql_server/sanic/graphqlview.py @@ -1,6 +1,5 @@ import asyncio import copy -from cgi import parse_header from collections.abc import MutableMapping from functools import partial from typing import List @@ -8,6 +7,7 @@ from graphql import GraphQLError, specified_rules from graphql.pyutils import is_awaitable from graphql.type.schema import GraphQLSchema +from sanic.headers import parse_content_header from sanic.response import HTTPResponse, html from sanic.views import HTTPMethodView @@ -213,7 +213,7 @@ def get_mime_type(request): if "content-type" not in request.headers: return None - mime_type, _ = parse_header(request.headers["content-type"]) + mime_type, _ = parse_content_header(request.headers["content-type"]) return mime_type def should_display_graphiql(self, request): From effa4a407cca4d1e9920f98783e60774931a145c Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 4 Aug 2023 02:01:59 +0800 Subject: [PATCH 4/7] chore: remove Python 3.7 from CI EOL since 2023-06-27 https://devguide.python.org/versions/ --- .github/workflows/tests.yml | 4 +--- setup.py | 3 +-- tox.ini | 5 ++--- 3 files changed, 4 insertions(+), 8 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index 7e58bb5..b81a313 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -8,11 +8,9 @@ jobs: strategy: max-parallel: 4 matrix: - python-version: ["3.7", "3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11"] os: [ubuntu-latest, windows-latest] exclude: - - os: windows-latest - python-version: "3.7" - os: windows-latest python-version: "3.8" - os: windows-latest diff --git a/setup.py b/setup.py index d66178c..dc0f38c 100644 --- a/setup.py +++ b/setup.py @@ -71,11 +71,10 @@ "Development Status :: 3 - Alpha", "Intended Audience :: Developers", "Topic :: Software Development :: Libraries", - "Programming Language :: Python :: 3.6", - "Programming Language :: Python :: 3.7", "Programming Language :: Python :: 3.8", "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", + "Programming Language :: Python :: 3.11", "License :: OSI Approved :: MIT License", ], keywords="api graphql protocol rest", diff --git a/tox.ini b/tox.ini index 1c534fd..4eaf51a 100644 --- a/tox.ini +++ b/tox.ini @@ -1,12 +1,11 @@ [tox] envlist = black,flake8,import-order,mypy,manifest, - py{37,38,39,310,311} + py{38,39,310,311} ; requires = tox-conda [gh-actions] python = - 3.7: py37 3.8: py38 3.9: py39 3.10: py310 @@ -23,7 +22,7 @@ whitelist_externals = python commands = pip install -U setuptools - py{37,38,39,311}: pytest tests {posargs} + py{38,39,311}: pytest tests {posargs} py{310}: pytest tests --cov-report=term-missing --cov=graphql_server {posargs} [testenv:black] From e401fec779f67ea4096699e2d039f3949b1647ae Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 4 Aug 2023 02:02:48 +0800 Subject: [PATCH 5/7] chore: remove unused context --- .github/workflows/tests.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index b81a313..e4f00b2 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -30,8 +30,6 @@ jobs: pip install tox tox-gh-actions - name: Test with tox run: tox - env: - TOXENV: ${{ matrix.toxenv }} coverage: runs-on: ubuntu-latest From 4786e460b9baaeac7abd70672a791b8ef96fbde0 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 13 Oct 2023 10:54:27 +0800 Subject: [PATCH 6/7] chore: update versions of dev tools --- setup.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/setup.py b/setup.py index dc0f38c..ee568ab 100644 --- a/setup.py +++ b/setup.py @@ -16,10 +16,10 @@ ] dev_requires = [ - "flake8>=5,<6", + "flake8>=6,<7", "isort>=5,<6", - "black>=22.12,<22.13", - "mypy>=0.991,<1", + "black>=23.9,<23.10", + "mypy>=1.6,<1.7", "check-manifest>=0.47,<1", ] + tests_requires From 8ea42c0d37b7d94bf6a2dcae7124e2346bdc8751 Mon Sep 17 00:00:00 2001 From: Kien Dang Date: Fri, 13 Oct 2023 10:56:01 +0800 Subject: [PATCH 7/7] chore: make 3.11 the default python version in CI --- .github/workflows/deploy.yml | 2 +- .github/workflows/lint.yml | 2 +- .github/workflows/tests.yml | 2 +- tox.ini | 14 +++++++------- 4 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 271642c..454da04 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -14,7 +14,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - name: Build wheel and source tarball run: | pip install wheel diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 454ab1b..0f7453c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -11,7 +11,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - name: Install dependencies run: | python -m pip install --upgrade pip diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index e4f00b2..ceecb95 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -39,7 +39,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v4 with: - python-version: "3.10" + python-version: "3.11" - name: Install test dependencies run: | python -m pip install --upgrade pip diff --git a/tox.ini b/tox.ini index 4eaf51a..6627604 100644 --- a/tox.ini +++ b/tox.ini @@ -22,35 +22,35 @@ whitelist_externals = python commands = pip install -U setuptools - py{38,39,311}: pytest tests {posargs} - py{310}: pytest tests --cov-report=term-missing --cov=graphql_server {posargs} + py{38,39,310}: pytest tests {posargs} + py{311}: pytest tests --cov-report=term-missing --cov=graphql_server {posargs} [testenv:black] -basepython = python3.10 +basepython = python3.11 deps = -e.[dev] commands = black --check graphql_server tests [testenv:flake8] -basepython = python3.10 +basepython = python3.11 deps = -e.[dev] commands = flake8 setup.py graphql_server tests [testenv:import-order] -basepython = python3.10 +basepython = python3.11 deps = -e.[dev] commands = isort graphql_server/ tests/ [testenv:mypy] -basepython = python3.10 +basepython = python3.11 deps = -e.[dev] commands = mypy graphql_server tests --ignore-missing-imports [testenv:manifest] -basepython = python3.10 +basepython = python3.11 deps = -e.[dev] commands = check-manifest -v