skillfed

ariadne-codegen

Generate fully typed GraphQL client from schema, queries and mutations!

ariadne-codegen v0.18.0 1.7M downloads/30d#3,633 on PyPI407
Permissive license BSD-3-Clause Active released

What it is and what it does

Ariadne Code Generator is a command-line tool that reads a GraphQL schema and operation definitions (queries, mutations, subscriptions) and outputs a complete, type-safe Python package. It generates pydantic models for all schema types, inputs, and enums, plus a fully async client class with each operation available as a typed method. You configure it via pyproject.toml, point it at your schema (local file or remote introspection endpoint) and your operations, and it produces a ready-to-import package.

The generated code is fully typed, so your IDE and type checker can catch errors before runtime. It supports both async and sync clients, optional OpenTelemetry tracing, and a custom operation builder for constructing complex queries programmatically. The tool integrates with ruff for code formatting and can be extended via plugins. It's aimed at Python developers building GraphQL-based applications who want to eliminate boilerplate and gain type safety without manual model definition.

Use it for:

  • Generate a typed Python client for a public GraphQL API to avoid manual model writing.
  • Automate client code generation in a CI/CD pipeline whenever your GraphQL schema changes.
  • Build a service that consumes a GraphQL backend with full type checking and IDE autocomplete.
  • Create subscription-based real-time clients by generating async methods with websocket support.
  • Use the custom operation builder to construct complex, nested GraphQL queries in pure Python.

Worth the install?

AI-flagged interpretation of the facts on this page — verify before relying

Generates fully typed, asynchronous Python GraphQL clients from a schema and query definitions, producing pydantic models and an async client class.

Yes. The package is actively maintained, has no known vulnerabilities, installs with low friction, and solves a real problem—eliminating manual GraphQL client boilerplate while ensuring type safety. It's well-suited for any Python project consuming GraphQL APIs. The permissive BSD-3-Clause license poses no obstacle. Consider it if you want to avoid hand-writing pydantic models and client methods for GraphQL operations.

Install

ariadne-codegen on PyPI

pip

pip install ariadne-codegen

uv

uv add ariadne-codegen

poetry

poetry add ariadne-codegen

Installing ariadne-codegen

Before you install

Installs cleanly with low friction; depends on common, well-maintained packages (click, graphql-core, httpx, pydantic, ruff, toml). Actively maintained with recent commits and no known vulnerabilities.

License in practice

BSD-3-Clause is permissive; you can use this package in commercial and proprietary projects with minimal restrictions, provided you include the license notice.

Quickstart

pip install ariadne-codegen

# Add to pyproject.toml:
[tool.ariadne-codegen]
schema_path = "schema.graphql"
queries_path = "queries.graphql"

# Run:
ariadne-codegen

Requires Python 3.10 or later; for subscription support, install the optional websockets dependency via pip install ariadne-codegen[subscriptions].

Verify before relying

  • Whether the generated client works seamlessly with all GraphQL server implementations.
  • Performance characteristics and overhead of the generated async client under load.
  • Compatibility and stability of the plugin system for custom code generation.
  • How the custom operation builder integrates with the generated code in practice.

Package facts

License BSD-3-Clause (permissive)
Python support supports the current Python release (>=3.10)
Install friction low — pure-Python wheel
Runtime dependencies 6 — click, graphql-core, httpx, pydantic, ruff, toml
Maintenance actively maintained — 154 days since the last release
Last repo commit
First released
Downloads 1,706,340/month — #3,633 on PyPI (30-day window, as of 2026-08-14)
Known vulnerabilities none known (OSV.dev, checked 2026-08-14)

Evidence: ariadne_codegen-0.18.0-py3-none-any.whl

Development Status :: 4 - BetaIntended Audience :: DevelopersLicense :: OSI Approved :: BSD LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.13Programming Language :: Python :: 3.14Topic :: Software Development :: Libraries :: Python Modules

Tags

graphql client code generatorpython graphql codegentyped graphql clientasync graphql pythongraphql schema to pythonpydantic graphql modelsgraphql query client generator
graphqlcode-generationasync-client

More Python Modules packages