diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index b7050d6a..c8e32e59 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -21,7 +21,7 @@ jobs: - name: Install dependencies run: | python -m pip install --upgrade pip - pip install "tox>=4.12,<5" "tox-gh-actions>=3.2,<4" + pip install "tox>=3.28,<5" "tox-gh-actions>=3.2,<4" - name: Run unit tests with tox run: tox diff --git a/README.md b/README.md index 5cf727d1..66c07116 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # GraphQL-core 3 -GraphQL-core 3 is a Python 3.7+ port of [GraphQL.js](https://github.com/graphql/graphql-js), +GraphQL-core 3 is a Python 3.6+ port of [GraphQL.js](https://github.com/graphql/graphql-js), the JavaScript reference implementation for [GraphQL](https://graphql.org/), a query language for APIs created by Facebook. @@ -203,7 +203,7 @@ Design goals for the GraphQL-core 3 library were: Some restrictions (mostly in line with the design goals): -* requires Python 3.7 or newer +* requires Python 3.6 or newer (Python 3.7 and newer in latest version) * does not support some already deprecated methods and options of GraphQL.js * supports asynchronous operations only via async.io (does not support the additional executors in GraphQL-core) diff --git a/pyproject.toml b/pyproject.toml index 45759531..29b9d21e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -64,7 +64,7 @@ optional = true [tool.poetry.group.lint.dependencies] ruff = ">=0.2,<0.3" -mypy = "1.3.0" +mypy = "1.8.0" bump2version = ">=1.0,<2" [tool.poetry.group.doc] diff --git a/src/graphql/execution/execute.py b/src/graphql/execution/execute.py index 8884cb7e..2a9f8cc5 100644 --- a/src/graphql/execution/execute.py +++ b/src/graphql/execution/execute.py @@ -2039,7 +2039,7 @@ def execute( raise GraphQLError(UNEXPECTED_MULTIPLE_PAYLOADS) async def await_result() -> Any: - awaited_result = await result # type: ignore + awaited_result = await result if isinstance(awaited_result, ExecutionResult): return awaited_result return ExecutionResult( @@ -2388,7 +2388,7 @@ def subscribe( return map_async_iterable(result, ensure_single_execution_result) async def await_result() -> Union[AsyncIterator[ExecutionResult], ExecutionResult]: - result_or_iterable = await result # type: ignore + result_or_iterable = await result if isinstance(result_or_iterable, AsyncIterable): return map_async_iterable( result_or_iterable, ensure_single_execution_result @@ -2496,9 +2496,7 @@ async def await_result() -> Any: awaited_result_or_stream = await result_or_stream # type: ignore if isinstance(awaited_result_or_stream, ExecutionResult): return awaited_result_or_stream - return context.map_source_to_response( # type: ignore - awaited_result_or_stream - ) + return context.map_source_to_response(awaited_result_or_stream) return await_result() diff --git a/src/graphql/type/definition.py b/src/graphql/type/definition.py index 2982ea4f..9bea7eed 100644 --- a/src/graphql/type/definition.py +++ b/src/graphql/type/definition.py @@ -1055,7 +1055,7 @@ def __init__( isinstance(name, str) for name in values ): try: - values = dict(values) # type: ignore + values = dict(values) except (TypeError, ValueError) as error: msg = ( f"{name} values must be an Enum or a mapping" diff --git a/src/graphql/utilities/strip_ignored_characters.py b/src/graphql/utilities/strip_ignored_characters.py index 3e2c1658..1824c102 100644 --- a/src/graphql/utilities/strip_ignored_characters.py +++ b/src/graphql/utilities/strip_ignored_characters.py @@ -11,7 +11,7 @@ def strip_ignored_characters(source: Union[str, Source]) -> str: - """Strip characters that are ignored anyway. + '''Strip characters that are ignored anyway. Strips characters that are not significant to the validity or execution of a GraphQL document: @@ -51,20 +51,20 @@ def strip_ignored_characters(source: Union[str, Source]) -> str: SDL example:: - \"\"\" + """ Type description - \"\"\" + """ type Foo { - \"\"\" + """ Field description - \"\"\" + """ bar: String } Becomes:: - \"\"\"Type description\"\"\" type Foo{\"\"\"Field description\"\"\" bar:String} - """ + """Type description""" type Foo{"""Field description""" bar:String} + ''' if not is_source(source): source = Source(cast(str, source)) diff --git a/src/graphql/validation/validate.py b/src/graphql/validation/validate.py index 13c75d89..0035d877 100644 --- a/src/graphql/validation/validate.py +++ b/src/graphql/validation/validate.py @@ -59,7 +59,7 @@ def validate( errors: List[GraphQLError] = [] def on_error(error: GraphQLError) -> None: - if len(errors) >= max_errors: # type: ignore + if len(errors) >= max_errors: raise validation_aborted_error errors.append(error) diff --git a/tests/test_user_registry.py b/tests/test_user_registry.py index bcb8321e..42cb579a 100644 --- a/tests/test_user_registry.py +++ b/tests/test_user_registry.py @@ -492,13 +492,13 @@ async def mutate_users(): ) async def receive_one(): - async for result in subscription_one: # type: ignore # pragma: no cover + async for result in subscription_one: # pragma: no cover received_one.append(result) if len(received_one) == 3: # pragma: no cover else break async def receive_all(): - async for result in subscription_all: # type: ignore # pragma: no cover + async for result in subscription_all: # pragma: no cover received_all.append(result) if len(received_all) == 6: # pragma: no cover else break diff --git a/tests/type/test_definition.py b/tests/type/test_definition.py index d57f558e..cb38a678 100644 --- a/tests/type/test_definition.py +++ b/tests/type/test_definition.py @@ -735,7 +735,7 @@ def defines_an_enum_type_with_a_description(): description = "nice enum" enum_type = GraphQLEnumType( "SomeEnum", - {}, # type: ignore + {}, description=description, ) assert enum_type.description is description @@ -887,7 +887,7 @@ def accepts_an_enum_type_with_ast_node_and_extension_ast_nodes(): extension_ast_nodes = [EnumTypeExtensionNode()] enum_type = GraphQLEnumType( "SomeEnum", - {}, # type: ignore + {}, ast_node=ast_node, extension_ast_nodes=extension_ast_nodes, ) diff --git a/tox.ini b/tox.ini index 9dd30855..9121bf74 100644 --- a/tox.ini +++ b/tox.ini @@ -23,7 +23,7 @@ commands = [testenv:mypy] basepython = python3.11 deps = - mypy==1.3.0 + mypy==1.8.0 pytest>=7.3,<8 commands = mypy src tests