Install & Compatibility
Where this runs
tested against v3.3.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
muslpy 3.10–3.95 runs
installs and imports cleanly · install 0.0s · import 0.538s · 23.4MB
glibcpy 3.10–3.95 runs
installs and imports cleanly · install 2.2s · import 0.496s · 24MB
22MB installed
● package 22MB
Code
Verified usage
Verified import paths — ran on the pinned version, not inferred.
build_schema
✓ from graphene_federation import build_schema
extends
✓ from graphene_federation import extends
key
✓ from graphene_federation import key
external
✓ from graphene_federation import external
provides
✓ from graphene_federation import provides
requires
✓ from graphene_federation import requires
authenticated
✓ from graphene_federation import authenticated
requiresScopes
✓ from graphene_federation import requiresScopes
policy
✓ from graphene_federation import policy
shareable
✓ from graphene_federation import shareable
inaccessible
✓ from graphene_federation import inaccessible
tag
✓ from graphene_federation import tag
override
✓ from graphene_federation import override
composeDirective
✓ from graphene_federation import composeDirective
link__Purpose
✓ from graphene_federation import link__Purpose
Used in Federation v2 directive composition.
external
✓ from graphene_federation import external
cost
✓ from graphene_federation import cost
New in v3.3.0
listSize
✓ from graphene_federation import listSize
New in v3.3.0
context
✓ from graphene_federation import context
New in v3.3.0
fromContext
✓ from graphene_federation import fromContext
New in v3.3.0
enable_federation_2
✓
✗ from graphene_federation import enable_federation_2
Deprecated in v3.2.0. Use federation_version parameter instead.
Basic graphene federation schema using @extends and @key.
import graphene
from graphene_federation import build_schema, key, extends
@key('id')
@extends
class Product(graphene.ObjectType):
id = graphene.ID(required=True)
name = graphene.String()
class Query(graphene.ObjectType):
product = graphene.Field(Product, id=graphene.ID(required=True))
def resolve_product(self, info, id):
return Product(id=id)
schema = build_schema(query=Query)
print(schema)
Errors
Common errors & fixes
ImportError: cannot import name 'enable_federation_2' from 'graphene_federation'
enable_federation_2 was removed in v3.2.0.
fixUse federation_version parameter: schema = build_schema(query=Query, federation_version=2)
NameError: name 'extend' is not defined
The @extend decorator was removed in v3.2.0.
fixReplace @extend with @extends and ensure @key is present.
TypeError: build_schema() got an unexpected keyword argument 'federation_2'
Old code still using enable_federation_2 pattern but upgrade to v3.2.0 removed it.
fixUse build_schema(query=Query, federation_version=2) instead.
AttributeError: module 'graphene_federation' has no attribute 'cost'
Using older version (<3.3.0) of graphene-federation that does not include 'cost' directive.
fixUpgrade to v3.3.0: pip install --upgrade graphene-federation
Upgrade
Version history
3.3.0latest on PyPI · released Oct 9, 2025
Audit
Dependencies
graphenerequiredPeer dependency; federation is an extension of graphene.
graphql-corerequiredRequired for GraphQL type system.