graphql-query
Complete Domain Specific Language (DSL) for GraphQL query in Python.
Decision gist · record as of 2026-08-14
Yes, if you need to generate GraphQL queries programmatically and want type-safe, reusable query construction. The low install friction, permissive MIT license, and support for modern Python versions make it straightforward to adopt. The dormant maintenance status is a minor concern—no active vulnerabilities and the last commit is recent—but verify compatibility with your pydantic and jinja2 versions before relying on it for production systems.AI-flagged interpretation of the facts on this page — verify before relying
Before you install
- Low friction install with only jinja2 and pydantic as runtime dependencies.
- Maintenance is dormant—last commit was 2024-11-26 and no releases in the past 744 days—but the repository remains active and unarchived.
License · maintenance · safety
permissive license (permissive) — MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
last release 2024-07-31 (744 days) · last repo commit 2024-11-26 · 70 stars
0 known vulnerabilities (OSV.dev, 2026-08-14) · 277,642 downloads/mo, #8,144 on PyPI
Alternatives
Verify before relying
pip install graphql-query
from graphql_query import Operation, Query
hero = Query(name="hero", fields=["name"])
operation = Operation(type="query", queries=[hero])
print(operation.render())- Whether the dormant maintenance status (no releases in 744 days) affects compatibility with recent GraphQL schema changes or breaking updates in jinja2/pydantic.
- Real-world performance or scalability limits when generating very large or deeply nested GraphQL queries.
- Whether generated queries are validated against a GraphQL schema or only syntactically correct.
What it is and what it does
graphql-query is a Python DSL for constructing GraphQL query strings from Python code. Instead of writing raw GraphQL strings, you build queries using Python classes like Query, Field, Argument, Variable, Fragment, and Directive, then call render() to produce the final GraphQL string. It depends on jinja2 for templating and pydantic for data validation, and supports modern Python versions from 3.8 onward.
The package is designed for scenarios where you want to programmatically assemble queries, reuse common arguments and variables across multiple queries, or generate query classes from pydantic models. It handles simple field selection, complex arguments with variables, inline fragments, and directives like @include and @skip.
Use it for
- Build GraphQL queries dynamically in client applications without concatenating strings or managing raw query text.
- Share and reuse common Arguments, Variables, and Fragments across multiple queries in a codebase.
- Generate GraphQL query classes from existing pydantic data models to keep query structure in sync with your Python types.
- Construct queries with conditional fields and directives (e.g., @include, @skip) based on runtime logic.
- Test GraphQL APIs by programmatically generating test queries with varying arguments and field selections.
Worth the install?
AI-flagged interpretation of the facts on this page. Verify before relying on it.
Yes, if you need to generate GraphQL queries programmatically and want type-safe, reusable query construction.
The low install friction, permissive MIT license, and support for modern Python versions make it straightforward to adopt. The dormant maintenance status is a minor concern—no active vulnerabilities and the last commit is recent—but verify compatibility with your pydantic and jinja2 versions before relying on it for production systems.
Install
graphql-query on PyPI
Before you install
Low friction install with only jinja2 and pydantic as runtime dependencies. Maintenance is dormant—last commit was 2024-11-26 and no releases in the past 744 days—but the repository remains active and unarchived.
License in practice
MIT license (permissive) means you can use, modify, and distribute this package freely in commercial and private projects with minimal restrictions.
Quickstart
pip install graphql-query
from graphql_query import Operation, Query
hero = Query(name="hero", fields=["name"])
operation = Operation(type="query", queries=[hero])
print(operation.render())
Verify before relying
- Whether the dormant maintenance status (no releases in 744 days) affects compatibility with recent GraphQL schema changes or breaking updates in jinja2/pydantic.
- Real-world performance or scalability limits when generating very large or deeply nested GraphQL queries.
- Whether generated queries are validated against a GraphQL schema or only syntactically correct.
Package facts
| License | permissive license permissive |
| Python support | Supports the current Python release >=3.8 |
| Install friction | Low. Pure-Python wheel |
| Runtime dependencies | 2 packagesjinja2pydantic |
| Maintenance | Dormant 744 days since the last release |
| Last repo commit | |
| First released | |
| Downloads | 277,642 / month, #8,144 on PyPI 30-day window, as of 2026-08-14 |
| Known vulnerabilities | None known OSV.dev, checked 2026-08-14 |
| Classifiers | Development Status :: 5 - Production/StableEnvironment :: MacOS XFramework :: PydanticFramework :: Pydantic :: 2License :: OSI Approved :: MIT LicenseOperating System :: OS IndependentProgramming Language :: PythonProgramming Language :: Python :: 3Programming Language :: Python :: 3 :: OnlyProgramming Language :: Python :: 3.10Programming Language :: Python :: 3.11Programming Language :: Python :: 3.12Programming Language :: Python :: 3.8Programming Language :: Python :: 3.9Topic :: Software Development :: LibrariesTopic :: Software Development :: Libraries :: Python Modules |
Evidence: graphql_query-1.4.0-py3-none-any.whl
Tags
Let your AI agent find packages like this
Example. Real query, live index.
You found this page by searching. An agent finds it by wishing: SkillFed indexes 14,416 PyPI packages by what they can do, searchable in plain language.
wish › “generate graphql queries programmatically”
- graphql-queryBuilds GraphQL query strings programmatically in Python using a…
- sgqlcsgqlc is a Python client library for querying GraphQL APIs using…
- hypothesis-graphqlGenerates arbitrary GraphQL queries matching your schema to use as…
Give your agent the search over MCP, or paste the wish link into any chat.
More Libraries packages
urllib3 is an HTTP client library that provides thread-safe connection pooling, SSL/TLS verification, multipart file uploads, request retries, compression support, and proxy handling for Python applications.
Requests is a Python HTTP library that simplifies sending HTTP/1.1 requests with automatic handling of headers, authentication, cookies, and response parsing.
Pluggy provides a plugin system that lets you define hook specifications and register implementations to be called in sequence, enabling extensible Python applications without tight coupling.
Install it if you're building an extensible application or framework.
Provides parsing, arithmetic, and recurrence rule computation for dates and times, with timezone support and iCalendar RFC compliance.
Install it if you need to parse flexible date strings, compute relative dates, handle timezones, or work with recurrence rules—it's the de facto choice for these tasks.
Six provides utility functions to write Python code that runs on both Python 2.7 and Python 3.3+, smoothing over language differences between the two versions.
pytest is a testing framework that lets you write test functions using plain assert statements and automatically discovers and runs them, with detailed failure reporting.
See also ariadne-codegen · sgqlc · hypothesis-graphql · gql · datamodel-code-generator · gw-dsl-parser · graphene-pydantic · python-graphql-client · enigma-api-client · yaql