{"id":506,"library":"graphql-core","title":"GraphQL-core","description":"GraphQL-core 3 is a Python port of GraphQL.js, the JavaScript reference implementation for GraphQL, a query language for APIs created by Facebook. It provides a faithful and up-to-date implementation of the GraphQL specification for current Python versions, including schema definition, parsing, validation, and execution. The library maintains an active release cadence, issuing stable patch releases alongside ongoing alpha development for future major versions.","status":"active","version":"3.2.8","language":"python","source_language":"en","source_url":"https://github.com/graphql-python/graphql-core","tags":["GraphQL","parser","schema","execution","type system","specification"],"install":[{"cmd":"pip install graphql-core","lang":"bash","label":"Install stable version"}],"dependencies":[{"reason":"Requires Python 3.7+ for v3.2.x. Future v3.3.x will require Python 3.10+.","package":"python","optional":false}],"imports":[{"symbol":"GraphQLSchema","correct":"from graphql import GraphQLSchema"},{"symbol":"GraphQLObjectType","correct":"from graphql import GraphQLObjectType"},{"symbol":"GraphQLField","correct":"from graphql import GraphQLField"},{"symbol":"GraphQLString","correct":"from graphql import GraphQLString"},{"note":"The `graphql_sync` function from the top-level `graphql` package is the recommended entry point for synchronous execution, replacing older `execute` patterns from `graphql.execution.execute`.","wrong":"from graphql.execution.execute import execute","symbol":"graphql_sync","correct":"from graphql import graphql_sync"}],"quickstart":{"code":"from graphql import (\n    GraphQLSchema,\n    GraphQLObjectType,\n    GraphQLField,\n    GraphQLString,\n    graphql_sync\n)\n\n# 1. Define your GraphQL schema\nschema = GraphQLSchema(\n    query=GraphQLObjectType(\n        name='RootQueryType',\n        fields={\n            'hello': GraphQLField(\n                GraphQLString,\n                resolve=lambda obj, info: 'world'\n            )\n        }\n    )\n)\n\n# 2. Define a GraphQL query\nsource = '{ hello }'\n\n# 3. Execute the query synchronously\nresult = graphql_sync(schema, source)\n\n# 4. Print the result\nprint(result.data['hello']) # Expected: world\n","lang":"python","description":"This quickstart demonstrates how to define a simple GraphQL schema with a 'hello' field that resolves to 'world', and then execute a query against it using `graphql_sync`."},"warnings":[{"fix":"Ensure your project runs on Python 3.10+ before upgrading to `graphql-core` v3.3.x.","message":"The upcoming v3.3.x series (currently in alpha) will drop support for Python 3.7, 3.8, and 3.9. It will require Python 3.10 or newer.","severity":"breaking","affected_versions":">=3.3.0a1"},{"fix":"Update any code that relies on mutating AST collection fields as lists to treat them as immutable tuples. Access elements by index, but avoid in-place modifications.","message":"In v3.3.0a12, AST collection fields have been changed from mutable lists to immutable tuples for better type safety and immutability.","severity":"breaking","affected_versions":">=3.3.0a12"},{"fix":"Migrate any code using `introspection.TypeResolvers` to `introspection.TypeFields` (or its equivalent in the v3.3.x branch) to ensure future compatibility.","message":"The alias `introspection.TypeResolvers` was backported to v3.2.8 for backward compatibility. It's likely to be removed or significantly changed in v3.3.x, which would break direct usage.","severity":"breaking","affected_versions":">=3.3.0a1 (future stable)"},{"fix":"Pin your `graphql-core` dependency using a compatible release operator like `~=3.2.0` (for 3.2.x releases) to avoid unexpected breaking changes on minor version upgrades.","message":"GraphQL-core does not follow SemVer directly. Changes in the major version of `GraphQL.js` are reflected in the *minor* version of `graphql-core`. This means minor version bumps (`3.x.0` to `3.y.0`) can introduce breaking API changes.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Be mindful of resolver signature expectations when porting examples or logic from JavaScript-based GraphQL implementations. The Python resolver typically takes `obj, info, **kwargs` where `kwargs` are the GraphQL arguments.","message":"Resolver function signatures in `graphql-core` differ from `GraphQL.js`. In Python, arguments are passed as individual keyword arguments, whereas in `GraphQL.js`, they are often passed as a single arguments object.","severity":"gotcha","affected_versions":"All versions"},{"fix":"Always wrap field definitions with `GraphQLField()` and argument definitions with `GraphQLArgument()` when constructing schemas in Python code.","message":"When defining schemas programmatically, GraphQL fields and arguments must be explicitly passed as `GraphQLField` and `GraphQLArgument` objects, respectively.","severity":"gotcha","affected_versions":"All versions"}],"env_vars":null,"last_verified":"2026-05-12T14:28:39.361Z","next_check":"2026-06-26T00:00:00.000Z","problems":[{"fix":"pip install graphql-core","cause":"The 'graphql-core' package is not installed in your Python environment or is not accessible in the current path.","error":"ModuleNotFoundError: No module named 'graphql-core'"},{"fix":"Ensure your GraphQL schema defines the 'username' field on the 'User' type, or modify your query to request an existing field from the 'User' type.","cause":"The GraphQL query is attempting to request a field (e.g., 'username') that is not defined in the schema for the specified type (e.g., 'User').","error":"Cannot query field \"username\" on type \"User\""},{"fix":"Ensure that your resolver functions explicitly return the correct data type or a callable, and handle cases where data might legitimately be `None` by defining the field as nullable in your schema if appropriate.","cause":"A GraphQL resolver for a field is returning `None` when the execution engine expects a callable function, a value that can be directly resolved, or an iterable, leading to an attempt to call `None`.","error":"TypeError: 'NoneType' object is not callable"},{"fix":"Provide a value that matches the expected type defined in your GraphQL schema for the argument or variable (e.g., pass an actual integer for an `Int` type).","cause":"An input argument or variable in a GraphQL query or mutation is receiving a value of a different type than what the schema expects (e.g., a string 'abc' instead of an integer).","error":"Expected type Int, found \"abc\""}],"ecosystem":"pypi","meta_description":null,"install_score":100,"install_tag":"verified","quickstart_score":80,"quickstart_tag":"verified","pypi_latest":null,"install_checks":{"last_tested":"2026-05-12","tag":"verified","tag_description":"installs cleanly on critical runtimes, fast import, recently tested","results":[{"runtime":"python:3.10-alpine","python_version":"3.10","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.2,"mem_mb":6.3,"disk_size":"19.7M"},{"runtime":"python:3.10-slim","python_version":"3.10","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.13,"mem_mb":6.3,"disk_size":"20M"},{"runtime":"python:3.11-alpine","python_version":"3.11","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.32,"mem_mb":7.7,"disk_size":"21.9M"},{"runtime":"python:3.11-slim","python_version":"3.11","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.26,"mem_mb":7.7,"disk_size":"22M"},{"runtime":"python:3.12-alpine","python_version":"3.12","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.5,"mem_mb":8.4,"disk_size":"13.7M"},{"runtime":"python:3.12-slim","python_version":"3.12","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.47,"mem_mb":8.4,"disk_size":"14M"},{"runtime":"python:3.13-alpine","python_version":"3.13","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.5,"mem_mb":8.9,"disk_size":"13.3M"},{"runtime":"python:3.13-slim","python_version":"3.13","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.47,"mem_mb":8.9,"disk_size":"14M"},{"runtime":"python:3.9-alpine","python_version":"3.9","os_libc":"alpine (musl)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.18,"mem_mb":6.2,"disk_size":"19.5M"},{"runtime":"python:3.9-slim","python_version":"3.9","os_libc":"slim (glibc)","variant":"default","exit_code":0,"wheel_type":null,"failure_reason":null,"install_time_s":null,"import_time_s":0.17,"mem_mb":6.2,"disk_size":"20M"}]},"quickstart_checks":{"last_tested":"2026-04-23","tag":"verified","tag_description":"quickstart runs on critical runtimes, recently tested","results":[{"runtime":"python:3.10-alpine","exit_code":0},{"runtime":"python:3.10-slim","exit_code":0},{"runtime":"python:3.11-alpine","exit_code":0},{"runtime":"python:3.11-slim","exit_code":0},{"runtime":"python:3.12-alpine","exit_code":0},{"runtime":"python:3.12-slim","exit_code":0},{"runtime":"python:3.13-alpine","exit_code":0},{"runtime":"python:3.13-slim","exit_code":0},{"runtime":"python:3.9-alpine","exit_code":0},{"runtime":"python:3.9-slim","exit_code":0}]}}