{"id":23813,"library":"graphene-federation","title":"Graphene Federation","description":"Federation implementation for Graphene. Adds support for Apollo Federation (v1 and v2) to GraphQL schemas built with graphene. Current version 3.3.0 supports Federation v2.11 directives. Active development.","status":"active","version":"3.3.0","language":"python","source_language":"en","source_url":"https://github.com/graphql-python/graphene-federation","tags":["graphene","graphql","federation","apollo","schema"],"install":[{"cmd":"pip install graphene-federation","lang":"bash","label":"Install from PyPI"}],"dependencies":[{"reason":"Peer dependency; federation is an extension of graphene.","package":"graphene","optional":false},{"reason":"Required for GraphQL type system.","package":"graphql-core","optional":false}],"imports":[{"note":"","wrong":"","symbol":"build_schema","correct":"from graphene_federation import build_schema"},{"note":"","wrong":"","symbol":"extends","correct":"from graphene_federation import extends"},{"note":"","wrong":"","symbol":"key","correct":"from graphene_federation import key"},{"note":"","wrong":"","symbol":"external","correct":"from graphene_federation import external"},{"note":"","wrong":"","symbol":"provides","correct":"from graphene_federation import provides"},{"note":"","wrong":"","symbol":"requires","correct":"from graphene_federation import requires"},{"note":"","wrong":"","symbol":"authenticated","correct":"from graphene_federation import authenticated"},{"note":"","wrong":"","symbol":"requiresScopes","correct":"from graphene_federation import requiresScopes"},{"note":"","wrong":"","symbol":"policy","correct":"from graphene_federation import policy"},{"note":"","wrong":"","symbol":"shareable","correct":"from graphene_federation import shareable"},{"note":"","wrong":"","symbol":"inaccessible","correct":"from graphene_federation import inaccessible"},{"note":"","wrong":"","symbol":"tag","correct":"from graphene_federation import tag"},{"note":"","wrong":"","symbol":"override","correct":"from graphene_federation import override"},{"note":"","wrong":"","symbol":"composeDirective","correct":"from graphene_federation import composeDirective"},{"note":"Used in Federation v2 directive composition.","wrong":"","symbol":"link__Purpose","correct":"from graphene_federation import link__Purpose"},{"note":"","wrong":"","symbol":"external","correct":"from graphene_federation import external"},{"note":"New in v3.3.0","wrong":"","symbol":"cost","correct":"from graphene_federation import cost"},{"note":"New in v3.3.0","wrong":"","symbol":"listSize","correct":"from graphene_federation import listSize"},{"note":"New in v3.3.0","wrong":"","symbol":"context","correct":"from graphene_federation import context"},{"note":"New in v3.3.0","wrong":"","symbol":"fromContext","correct":"from graphene_federation import fromContext"},{"note":"Deprecated in v3.2.0. Use federation_version parameter instead.","wrong":"from graphene_federation import enable_federation_2","symbol":"enable_federation_2","correct":""}],"quickstart":{"code":"import graphene\nfrom graphene_federation import build_schema, key, extends\n\n@key('id')\n@extends\nclass Product(graphene.ObjectType):\n    id = graphene.ID(required=True)\n    name = graphene.String()\n\nclass Query(graphene.ObjectType):\n    product = graphene.Field(Product, id=graphene.ID(required=True))\n\n    def resolve_product(self, info, id):\n        return Product(id=id)\n\nschema = build_schema(query=Query)\nprint(schema)\n","lang":"python","description":"Basic graphene federation schema using @extends and @key."},"warnings":[{"fix":"Replace @extend decorator with @extends (and @key if not already present).","message":"In v3.2.0, the @extend directive was removed. Replace with @extends + @key for V1, or just @key for V2.","severity":"breaking","affected_versions":">=3.2.0"},{"fix":"Remove enable_federation_2() call and pass federation_version=2 to build_schema().","message":"enable_federation_2() function is deprecated. Use federation_version parameter in build_schema() instead.","severity":"deprecated","affected_versions":">=3.2.0"},{"fix":"Add @key to all entity types using '@key('id')' or other field combinations.","message":"Federation v2 requires all types to have @key directive. Missing @key on an entity type leads to runtime errors in Apollo Gateway.","severity":"gotcha","affected_versions":">=3.1.0"},{"fix":"Define resolvers returning identical values for @shareable fields or avoid marking them as shareable if they differ.","message":"When using Federation v2 with @shareable, ensure that fields marked @shareable are resolved consistently across subgraphs or expect composition errors.","severity":"gotcha","affected_versions":">=3.1.0"}],"env_vars":null,"last_verified":"2026-05-01T00:00:00.000Z","next_check":"2026-07-30T00:00:00.000Z","problems":[{"fix":"Use federation_version parameter: schema = build_schema(query=Query, federation_version=2)","cause":"enable_federation_2 was removed in v3.2.0.","error":"ImportError: cannot import name 'enable_federation_2' from 'graphene_federation'"},{"fix":"Replace @extend with @extends and ensure @key is present.","cause":"The @extend decorator was removed in v3.2.0.","error":"NameError: name 'extend' is not defined"},{"fix":"Use build_schema(query=Query, federation_version=2) instead.","cause":"Old code still using enable_federation_2 pattern but upgrade to v3.2.0 removed it.","error":"TypeError: build_schema() got an unexpected keyword argument 'federation_2'"},{"fix":"Upgrade to v3.3.0: pip install --upgrade graphene-federation","cause":"Using older version (<3.3.0) of graphene-federation that does not include 'cost' directive.","error":"AttributeError: module 'graphene_federation' has no attribute 'cost'"}],"ecosystem":"pypi","meta_description":null,"install_score":null,"install_tag":null,"quickstart_score":null,"quickstart_tag":null}