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, a schema-copy mode, and deprecation warnings for deprecated parts of your schema.
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
Release files for ariadne-codegen 0.19.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| ariadne_codegen-0.19.0.tar.gz | 80.7 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| ariadne_codegen-0.19.0-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 200.7 kB
Release files / ariadne_codegen-0.19.0.tar.gz
| Download URL | ariadne_codegen-0.19.0.tar.gz |
|---|---|
| Size | 80.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
517024e02b5bb92eb0d136fe4902b593a5ca45b8ba38a2c683e2462902494714
|
|
BLAKE2b-256 checksum How to use checksums |
f9efb45d3c461fed17e26b1841f5b41a15445f7cb8da528ced7d49249d2373e1
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency logRelease files / ariadne_codegen-0.19.0-py3-none-any.whl
| Download URL | ariadne_codegen-0.19.0-py3-none-any.whl |
|---|---|
| Size | 120.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
2a657f4f88f8c94615258d12baa97db92f502f29857fbf795d8e9219e26f830f
|
|
BLAKE2b-256 checksum How to use checksums |
39859afd9a5d4f49259276a653bacf11157d31f70f1db2dfe1fca6b3e76ccd09
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
Yes |
| Uploaded via |
twine/7.0.0 CPython/3.13.14
|
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
PyPI Publish Attestation
PyPI verified that this artifact, at this checksum, originated from the publisher listed below.
Signed by GitHub Actions, verified by PyPI on Aug 28, 2026.
Transparency log