diff --git a/.bumpversion.cfg b/.bumpversion.cfg index e22c7dc9..61892e80 100644 --- a/.bumpversion.cfg +++ b/.bumpversion.cfg @@ -1,5 +1,5 @@ [bumpversion] -current_version = 3.3.0a3 +current_version = 3.3.0a4 commit = False tag = False diff --git a/README.md b/README.md index 66c07116..313af1ba 100644 --- a/README.md +++ b/README.md @@ -17,7 +17,7 @@ reliable and compatible with GraphQL.js. The current stable version 3.2.3 of GraphQL-core is up-to-date with GraphQL.js version 16.6.0 and supports Python version 3.7 and newer. -You can also try out the latest alpha version 3.3.0a3 of GraphQL-core +You can also try out the latest alpha version 3.3.0a4 of GraphQL-core which is up-to-date with GraphQL.js version 17.0.0a2. Please note that this new minor version of GraphQL-core does not support Python 3.6 anymore. diff --git a/docs/conf.py b/docs/conf.py index 246db043..414333bf 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,4 +1,3 @@ -# -*- coding: utf-8 -*- # # GraphQL-core 3 documentation build configuration file, created by # sphinx-quickstart on Thu Jun 21 16:28:30 2018. @@ -30,29 +29,29 @@ # extensions coming with Sphinx (named 'sphinx.ext.*') or your custom # ones. extensions = [ - 'sphinx.ext.autodoc', + "sphinx.ext.autodoc", ] # Add any paths that contain templates here, relative to this directory. -templates_path = ['_templates'] +templates_path = ["_templates"] # The suffix(es) of source filenames. # You can specify multiple suffix as a list of string: # # source_suffix = ['.rst', '.md'] -source_suffix = '.rst' +source_suffix = ".rst" # The encoding of source files. # # source_encoding = 'utf-8-sig' # The master toctree document. -master_doc = 'index' +master_doc = "index" # General information about the project. -project = 'GraphQL-core 3' -copyright = '2023, Christoph Zwerschke' -author = 'Christoph Zwerschke' +project = "GraphQL-core 3" +copyright = "2024, Christoph Zwerschke" +author = "Christoph Zwerschke" # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -61,14 +60,14 @@ # The short X.Y version. # version = '3.3' # The full version, including alpha/beta/rc tags. -version = release = '3.3.0a3' +version = release = "3.3.0a4" # The language for content autogenerated by Sphinx. Refer to documentation # for a list of supported languages. # # This is also used if you do content translation via gettext catalogs. # Usually you set "language" from the command line for these cases. -language = 'en' +language = "en" # There are two options for replacing |today|: either, you set today to some # non-false value, then it is used: @@ -82,23 +81,23 @@ # List of patterns, relative to source directory, that match files and # directories to ignore when looking for source files. # This patterns also effect to html_static_path and html_extra_path -exclude_patterns = ['_build', 'Thumbs.db', '.DS_Store'] +exclude_patterns = ["_build", "Thumbs.db", ".DS_Store"] # AutoDoc configuration autoclass_content = "class" autodoc_default_options = { - 'members': True, - 'inherited-members': True, - 'undoc-members': True, - 'show-inheritance': True + "members": True, + "inherited-members": True, + "undoc-members": True, + "show-inheritance": True, } autosummary_generate = True autodoc_type_aliases = { - 'AwaitableOrValue': 'graphql.pyutils.AwaitableOrValue', - 'FormattedSourceLocation': 'graphql.language.FormattedSourceLocation', - 'Middleware': 'graphql.execution.Middleware', - 'TypeMap': 'graphql.schema.TypeMap' + "AwaitableOrValue": "graphql.pyutils.AwaitableOrValue", + "FormattedSourceLocation": "graphql.language.FormattedSourceLocation", + "Middleware": "graphql.execution.Middleware", + "TypeMap": "graphql.schema.TypeMap", } # GraphQL-core top level modules with submodules that can be omitted. @@ -106,33 +105,41 @@ # qualified form, but the documentation has the shorter form. # We need to give autodoc a little help in this cases. graphql_modules = { - 'error': ['graphql_error'], - 'execution': ['execute', 'middleware'], - 'language': ['ast', 'directive_locations', 'location', - 'source', 'token_kind', 'visitor'], - 'pyutils': ['simple_pub_sub', 'frozen_list', 'path'], - 'type': ['definition', 'directives', 'schema'], - 'utilities': ['find_breaking_changes', 'type_info'], - 'validation': ['rules', 'validation_context']} + "error": ["graphql_error"], + "execution": ["execute", "middleware"], + "language": [ + "ast", + "directive_locations", + "location", + "source", + "token_kind", + "visitor", + ], + "pyutils": ["simple_pub_sub", "frozen_list", "path"], + "type": ["definition", "directives", "schema"], + "utilities": ["find_breaking_changes", "type_info"], + "validation": ["rules", "validation_context"], +} # GraphQL-core classes that autodoc sometimes cannot find # (e.g. where specified as string in type hints). # We need to give autodoc a little help in this cases, too: graphql_classes = { - 'GraphQLAbstractType': 'type', - 'GraphQLFieldResolver': 'type', - 'GraphQLObjectType': 'type', - 'GraphQLOutputType': 'type', - 'GraphQLTypeResolver': 'type', - 'AwaitableOrValue': 'execution', - 'Middleware': 'execution', - 'Node': 'language', - 'Source': 'language', - 'SourceLocation': 'language' + "GraphQLAbstractType": "type", + "GraphQLFieldResolver": "type", + "GraphQLObjectType": "type", + "GraphQLOutputType": "type", + "GraphQLTypeResolver": "type", + "AwaitableOrValue": "execution", + "Middleware": "execution", + "Node": "language", + "Source": "language", + "SourceLocation": "language", } # ignore the following undocumented or internal references: -ignore_references = set(''' +ignore_references = set( + """ GNT GT KT T VT enum.Enum traceback @@ -163,77 +170,79 @@ graphql.validation.validation_context.VariableUsage graphql.validation.rules.known_argument_names.KnownArgumentNamesOnDirectivesRule graphql.validation.rules.provided_required_arguments.ProvidedRequiredArgumentsOnDirectivesRule -'''.split()) +""".split() +) ignore_references.update(__builtins__.keys()) def on_missing_reference(app, env, node, contnode): """Fix or skip any missing references.""" - if node.get('refdomain') != 'py': + if node.get("refdomain") != "py": return None - target = node.get('reftarget') + target = node.get("reftarget") if not target: return None - if target in ignore_references or target.endswith('Kwargs'): + if target in ignore_references or target.endswith("Kwargs"): return contnode - typ = node.get('reftype') - name = target.rsplit('.', 1)[-1] - if name in ('GT', 'GNT', 'KT', 'T', 'VT'): + typ = node.get("reftype") + name = target.rsplit(".", 1)[-1] + if name in ("GT", "GNT", "KT", "T", "VT"): return contnode - if typ == 'obj': - if target.startswith('typing.'): - if name in ('Any', 'Optional', 'Union'): + if typ == "obj": + if target.startswith("typing."): + if name in ("Any", "Optional", "Union"): return contnode - if typ != 'class': + if typ != "class": return None - if '.' in target: # maybe too specific - base_module, target = target.split('.', 1) - if base_module == 'graphql': - if '.' not in target: + if "." in target: # maybe too specific + base_module, target = target.split(".", 1) + if base_module == "graphql": + if "." not in target: return None - base_module, target = target.split('.', 1) - if '.' not in target: + base_module, target = target.split(".", 1) + if "." not in target: return None sub_modules = graphql_modules.get(base_module) if not sub_modules: - return - sub_module = target.split('.', 1)[0] + return None + sub_module = target.split(".", 1)[0] if sub_module not in sub_modules: return None - target = 'graphql.' + base_module + '.' + target.rsplit('.', 1)[-1] + target = "graphql." + base_module + "." + target.rsplit(".", 1)[-1] else: # maybe not specific enough base_module = graphql_classes.get(target) if not base_module: return None - target = 'graphql.' + base_module + '.' + target + target = "graphql." + base_module + "." + target # replace target - if contnode.__class__.__name__ == 'Text': + if contnode.__class__.__name__ == "Text": contnode = contnode.__class__(target) - elif contnode.__class__.__name__ == 'literal': + elif contnode.__class__.__name__ == "literal": if len(contnode.children) != 1: return None textnode = contnode.children[0] contnode.children[0] = textnode.__class__(target) else: return None - node['reftarget'] = target - fromdoc = node.get('refdoc') + node["reftarget"] = target + fromdoc = node.get("refdoc") if not fromdoc: - doc_module = node.get('py:module') + doc_module = node.get("py:module") if doc_module: - if doc_module.startswith('graphql.'): - doc_module = doc_module.split('.', 1)[-1] - if doc_module not in graphql_modules and doc_module != 'graphql': + if doc_module.startswith("graphql."): + doc_module = doc_module.split(".", 1)[-1] + if doc_module not in graphql_modules and doc_module != "graphql": doc_module = None - fromdoc = 'modules/' + (doc_module or base_module) + fromdoc = "modules/" + (doc_module or base_module) # try resolving again with replaced target - return env.domains['py'].resolve_xref( - env, fromdoc, app.builder, typ, target, node, contnode) + return env.domains["py"].resolve_xref( + env, fromdoc, app.builder, typ, target, node, contnode + ) def on_skip_member(_app, what, name, _obj, skip, _options): - if what == 'class' and name == "__init__": + if what == "class" and name == "__init__": # we could set "special-members" to "__init__", # but this gives an error when documenting modules return False @@ -241,7 +250,7 @@ def on_skip_member(_app, what, name, _obj, skip, _options): def setup(app): - app.connect('missing-reference', on_missing_reference) + app.connect("missing-reference", on_missing_reference) app.connect("autodoc-skip-member", on_skip_member) @@ -269,7 +278,7 @@ def setup(app): # show_authors = False # The name of the Pygments (syntax highlighting) style to use. -pygments_style = 'sphinx' +pygments_style = "sphinx" # A list of ignored prefixes for module index sorting. # modindex_common_prefix = [] @@ -285,15 +294,13 @@ def setup(app): # The theme to use for HTML and HTML Help pages. See the documentation for # a list of builtin themes. # -html_theme = 'sphinx_rtd_theme' +html_theme = "sphinx_rtd_theme" # Theme options are theme-specific and customize the look and feel of a theme # further. For a list of options available for each theme, see the # documentation. # -html_theme_options = { - 'navigation_depth': 5 -} +html_theme_options = {"navigation_depth": 5} # Add any paths that contain custom themes here, relative to this directory. # html_theme_path = [] @@ -401,34 +408,36 @@ def setup(app): # html_search_scorer = 'scorer.js' # Output file base name for HTML help builder. -htmlhelp_basename = 'GraphQL-core-3-doc' +htmlhelp_basename = "GraphQL-core-3-doc" # -- Options for LaTeX output --------------------------------------------- latex_elements = { - # The paper size ('letterpaper' or 'a4paper'). - # - # 'papersize': 'letterpaper', - - # The font size ('10pt', '11pt' or '12pt'). - # - # 'pointsize': '10pt', - - # Additional stuff for the LaTeX preamble. - # - # 'preamble': '', - - # Latex figure (float) alignment - # - # 'figure_align': 'htbp', + # The paper size ('letterpaper' or 'a4paper'). + # + # 'papersize': 'letterpaper', + # The font size ('10pt', '11pt' or '12pt'). + # + # 'pointsize': '10pt', + # Additional stuff for the LaTeX preamble. + # + # 'preamble': '', + # Latex figure (float) alignment + # + # 'figure_align': 'htbp', } # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, # author, documentclass [howto, manual, or own class]). latex_documents = [ - (master_doc, 'GraphQL-core-3.tex', 'GraphQL-core 3 Documentation', - 'Christoph Zwerschke', 'manual'), + ( + master_doc, + "GraphQL-core-3.tex", + "GraphQL-core 3 Documentation", + "Christoph Zwerschke", + "manual", + ), ] # The name of an image file (relative to this directory) to place at the top of @@ -462,10 +471,7 @@ def setup(app): # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). -man_pages = [ - (master_doc, 'graphql-core', 'GraphQL-core 3 Documentation', - [author], 1) -] +man_pages = [(master_doc, "graphql-core", "GraphQL-core 3 Documentation", [author], 1)] # If true, show URL addresses after external links. # @@ -478,9 +484,15 @@ def setup(app): # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - (master_doc, 'GraphQL-core', 'GraphQL-core 3 Documentation', - author, 'GraphQL-core 3', 'One line description of project.', - 'Miscellaneous'), + ( + master_doc, + "GraphQL-core", + "GraphQL-core 3 Documentation", + author, + "GraphQL-core 3", + "One line description of project.", + "Miscellaneous", + ), ] # Documents to append as an appendix to all manuals. diff --git a/poetry.lock b/poetry.lock index 7903bb44..bc3735f0 100644 --- a/poetry.lock +++ b/poetry.lock @@ -756,13 +756,13 @@ testing = ["argcomplete", "attrs (>=19.2.0)", "hypothesis (>=3.56)", "mock", "no [[package]] name = "pytest" -version = "8.0.0" +version = "8.0.1" description = "pytest: simple powerful testing with Python" optional = false python-versions = ">=3.8" files = [ - {file = "pytest-8.0.0-py3-none-any.whl", hash = "sha256:50fb9cbe836c3f20f0dfa99c565201fb75dc54c8d76373cd1bde06b06657bdb6"}, - {file = "pytest-8.0.0.tar.gz", hash = "sha256:249b1b0864530ba251b7438274c4d251c58d868edaaec8762893ad4a0d71c36c"}, + {file = "pytest-8.0.1-py3-none-any.whl", hash = "sha256:3e4f16fe1c0a9dc9d9389161c127c3edc5d810c38d6793042fb81d9f48a59fca"}, + {file = "pytest-8.0.1.tar.gz", hash = "sha256:267f6563751877d772019b13aacbe4e860d73fe8f651f28112e9ac37de7513ae"}, ] [package.dependencies] @@ -1220,13 +1220,13 @@ testing = ["flaky (>=3.4.0)", "freezegun (>=0.3.11)", "pathlib2 (>=2.3.3)", "psu [[package]] name = "tox" -version = "4.12.1" +version = "4.13.0" description = "tox is a generic virtualenv management and test command line tool" optional = false python-versions = ">=3.8" files = [ - {file = "tox-4.12.1-py3-none-any.whl", hash = "sha256:c07ea797880a44f3c4f200ad88ad92b446b83079d4ccef89585df64cc574375c"}, - {file = "tox-4.12.1.tar.gz", hash = "sha256:61aafbeff1bd8a5af84e54ef6e8402f53c6a6066d0782336171ddfbf5362122e"}, + {file = "tox-4.13.0-py3-none-any.whl", hash = "sha256:1143c7e2489c68026a55d3d4ae84c02c449f073b28e62f80e3e440a3b72a4afa"}, + {file = "tox-4.13.0.tar.gz", hash = "sha256:dd789a554c16c4b532924ba393c92fc8991323c4b3d466712bfecc8c9b9f24f7"}, ] [package.dependencies] @@ -1405,4 +1405,4 @@ testing = ["big-O", "jaraco.functools", "jaraco.itertools", "more-itertools", "p [metadata] lock-version = "2.0" python-versions = "^3.7" -content-hash = "910d6fe7bf0668879447dda5c6f98241d7facc12f25b2c97ea5e7b22117ba7da" +content-hash = "b78e75f3de0aa66a09e5f2d319fc43cc3201402707385827a1ddee81c22941ad" diff --git a/pyproject.toml b/pyproject.toml index e606e1dc..2e407b6e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [tool.poetry] name = "graphql-core" -version = "3.3.0a3" +version = "3.3.0a4" description = """\ GraphQL-core is a Python port of GraphQL.js,\ the JavaScript reference implementation for GraphQL.""" @@ -63,7 +63,7 @@ pytest-cov = "^4.1" pytest-describe = "^2.2" pytest-timeout = "^2.2" tox = [ - { version = "^4.12", python = ">=3.8" }, + { version = "^4.13", python = ">=3.8" }, { version = "^3.28", python = "<3.8" } ] @@ -277,7 +277,7 @@ module = [ disallow_untyped_defs = false [tool.pytest.ini_options] -minversion = "7.3" +minversion = "7.4" # Only run benchmarks as tests. # To actually run the benchmarks, use --benchmark-enable on the command line. # To run the slow tests (fuzzing), add --run-slow on the command line. diff --git a/tests/execution/test_executor.py b/tests/execution/test_executor.py index b70ed483..1cbb9f0b 100644 --- a/tests/execution/test_executor.py +++ b/tests/execution/test_executor.py @@ -624,6 +624,7 @@ class Data: result = execute_sync(schema, document, Data()) assert result == ({"a": "b"}, None) + @pytest.mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning") def uses_the_only_operation_if_no_operation_name_is_provided(): schema = GraphQLSchema( GraphQLObjectType("Type", {"a": GraphQLField(GraphQLString)}) diff --git a/tests/execution/test_stream.py b/tests/execution/test_stream.py index ccfd1f93..348a70ec 100644 --- a/tests/execution/test_stream.py +++ b/tests/execution/test_stream.py @@ -1408,6 +1408,7 @@ async def friend_list(_info): ] @pytest.mark.asyncio() + @pytest.mark.filterwarnings("ignore:.* was never awaited:RuntimeWarning") async def filters_stream_payloads_that_are_nulled_in_a_deferred_payload(): document = parse( """ diff --git a/tests/execution/test_variables.py b/tests/execution/test_variables.py index 7a9ebb82..277efc0b 100644 --- a/tests/execution/test_variables.py +++ b/tests/execution/test_variables.py @@ -733,7 +733,9 @@ def reports_error_for_array_passed_into_string_input(): ], ) - assert result.errors[0].original_error + errors = result.errors + assert errors + assert errors[0].original_error def reports_error_for_non_provided_variables_for_non_nullable_inputs(): # Note: this test would typically fail validation before