Python
Python plugin. Generate Python types (pydantic `BaseModel`s, `TypedDict`s and enums) from your GraphQL schema.
- Package
- @graphql-codegen/python
- Version
- 0.0.2
- Weekly downloads
- 687
- License
- MIT
- Updated
- Oct 29, 2026
Installation
npm i -D @graphql-codegen/python
yarn add -D @graphql-codegen/python
pnpm add -D @graphql-codegen/python
bun add -D @graphql-codegen/python
This plugin generates Python types based on your GraphQLSchema:
- object & interface types become pydantic
BaseModelclasses (snake_case attributes; keys that differ from the GraphQL name are pinned withField(alias=...)) - input types become
TypedDict - enums become
class X(str, Enum) - scalars map to native Python types (
ID/String→str,Int→int,Float→float,Boolean→bool, custom scalars →Any)
Given a schema:
The plugin generates:
It is the base-types counterpart to python-operations,
analogous to how typescript underpins typescript-operations.