This release is a pre-release and may not be stable for production use.
Ariadne Code Generator
Python code generator that turns a GraphQL schema and your operations into a fully typed, async (or sync) Python client built on Pydantic. You write your queries, mutations and subscriptions in GraphQL, and ariadne-codegen generates a typed Python method for each one, returning Pydantic models - so you get autocompletion and static type checking instead of hand-writing query strings and parsing raw JSON.
📖 Documentation · Step-by-step example · Configuration reference
Features
- Fully typed models - Pydantic models for schema types, inputs, enums, fragments, and every operation's result.
- Typed client methods - each query, mutation, and subscription becomes a method with typed arguments and a typed return value.
- Async or sync - generate an async client (default) or a synchronous one.
- Subscriptions - real-time updates over WebSockets (
graphql-transport-ws). - File uploads - multipart requests via the GraphQL multipart request spec.
- Custom scalars - map GraphQL scalars to your own Python types with
serialize/parsehooks. - Extensible output - inject mixins into generated models, copy in your own files, or swap the base client (custom auth, or to drop the
httpx/websocketsdeps). - Flexible schema sources - a local file, installed Python packages, or remote introspection.
- Plugin system - customize generation through hooks, plus ready-made plugins (shorter results, extracted operation strings, forward refs, …).
- More - programmatic query building, OpenTelemetry tracing, multiple clients per project, and a schema-copy mode.
Installation
Requires Python 3.10 or newer.
pip install ariadne-codegen
Add subscription (WebSocket) support with:
pip install ariadne-codegen[subscriptions]
Quickstart
Generate a typed client from three files.
1. Describe your schema in schema.graphql:
type Query {
hello(name: String!): String!
}
2. Write the operations you need in queries.graphql:
query Greet($name: String!) {
hello(name: $name)
}
3. Point ariadne-codegen at them in pyproject.toml:
[tool.ariadne-codegen]
schema_path = "schema.graphql"
queries_path = "queries.graphql"
Then generate the client:
ariadne-codegen
This creates a graphql_client package. Use it:
import asyncio
from graphql_client import Client
async def main():
async with Client(url="https://example.com/graphql") as client:
result = await client.greet(name="World")
print(result.hello)
asyncio.run(main())
greet is a typed method generated from your Greet operation, and result is a
validated Pydantic model. See the step-by-step example
for a walk-through of everything that gets generated.
Contributing
Contributions are welcome! See CONTRIBUTING.md for how to report bugs, work on issues, and open pull requests.
Also make sure you follow @AriadneGraphQL on Twitter for latest updates, news and random musings!
Crafted with ❤️ by Mirumee Labs ariadne@mirumee.com
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ariadne_codegen-0.19a2.tar.gz.
File metadata
- Download URL: ariadne_codegen-0.19a2.tar.gz
- Upload date:
- Size: 77.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
aa1c198339f3a80c3311d560e2109b02c3381286cbf918aad770de64ebc75ad8
|
|
| MD5 |
a9e891759aa35decac29996afe479425
|
|
| BLAKE2b-256 |
de3ddeb2e9c5728aee52bcc751bc52c4e065c100551f03bd12d0767ba57f5991
|
Provenance
The following attestation bundles were made for ariadne_codegen-0.19a2.tar.gz:
Publisher:
publish.yml on mirumee/ariadne-codegen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ariadne_codegen-0.19a2.tar.gz -
Subject digest:
aa1c198339f3a80c3311d560e2109b02c3381286cbf918aad770de64ebc75ad8 - Sigstore transparency entry: 2257367733
- Sigstore integration time:
-
Permalink:
mirumee/ariadne-codegen@47abc5390e95630021dc510987781418591299c8 -
Branch / Tag:
refs/tags/0.19.a2 - Owner: https://github.com/mirumee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@47abc5390e95630021dc510987781418591299c8 -
Trigger Event:
release
-
Statement type:
File details
Details for the file ariadne_codegen-0.19a2-py3-none-any.whl.
File metadata
- Download URL: ariadne_codegen-0.19a2-py3-none-any.whl
- Upload date:
- Size: 116.0 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.14
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f4f88aac359c39f3ec870e45e19ea857866fba10378182061d83e4c0fff77424
|
|
| MD5 |
a19aec11676ce0e58be12a23cf5fb851
|
|
| BLAKE2b-256 |
8c06a9a800b77740b9856cafda9fd75d2abf44e1e6a22e62fc45e62d26db1575
|
Provenance
The following attestation bundles were made for ariadne_codegen-0.19a2-py3-none-any.whl:
Publisher:
publish.yml on mirumee/ariadne-codegen
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
ariadne_codegen-0.19a2-py3-none-any.whl -
Subject digest:
f4f88aac359c39f3ec870e45e19ea857866fba10378182061d83e4c0fff77424 - Sigstore transparency entry: 2257367738
- Sigstore integration time:
-
Permalink:
mirumee/ariadne-codegen@47abc5390e95630021dc510987781418591299c8 -
Branch / Tag:
refs/tags/0.19.a2 - Owner: https://github.com/mirumee
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@47abc5390e95630021dc510987781418591299c8 -
Trigger Event:
release
-
Statement type: