Metadata-Version: 2.4
Name: metaengine-graphql-httpx
Version: 1.0.0
Summary: Generate idiomatic Python (Pydantic v2 + httpx) clients and models from GraphQL schemas. Self-contained — no .NET install required.
Author: José A. Saldaña Pérez
License: MIT
Project-URL: Homepage, https://metaengine.eu
Project-URL: Repository, https://github.com/meta-engine/graphql-httpx
Project-URL: Issues, https://github.com/meta-engine/graphql-httpx/issues
Project-URL: Changelog, https://github.com/meta-engine/graphql-httpx/blob/main/CHANGELOG.md
Keywords: graphql,codegen,code-generator,graphql-codegen,graphql-client,pydantic,httpx,client,api,metaengine
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Topic :: Software Development :: Code Generators
Requires-Python: >=3.8
Description-Content-Type: text/markdown
License-File: LICENSE
Dynamic: license-file

# metaengine-graphql-httpx

Generate idiomatic **Python** clients and models from a **GraphQL** schema (SDL) —
Pydantic v2 models and an async `httpx` client, with bearer/basic auth, retries,
timeouts, error handling, custom headers, fragments, `@oneOf` inputs, and optional docstrings.

Powered by [MetaEngine](https://metaengine.eu). The wheel is **self-contained**: it bundles
a platform-native runner, so **no .NET installation is required**.

## Install

```bash
pip install metaengine-graphql-httpx
```

## Usage

```bash
metaengine-graphql-httpx <input> <output> [options]
```

| Argument / Option | Description |
|---|---|
| `input` | GraphQL schema file path (SDL) or inline SDL content |
| `output` | Output directory for generated Python files |
| `--fragments` | Emit reusable named fragments for object-type selections |
| `--one-of-inputs` | Generate idiomatic `@oneOf` input types (tagged-union inputs) |
| `--custom-scalar <Scalar>=<target>` | Map a GraphQL custom scalar to a Python type (repeatable). Targets: `str`, `int`, `float`, `bool`, `datetime`, `Any` |
| `--bearer-auth <ENV>` | Bearer token from env var (e.g. `API_TOKEN`) |
| `--basic-auth <USER_ENV>=<PASS_ENV>` | Basic auth from env vars |
| `--retries <n>` | Enable retries with exponential backoff; value sets max attempts |
| `--timeout <s>` | Request timeout in seconds for all operations |
| `--error-handling` | Smart error handling based on HTTP status semantics |
| `--custom-header <Header>=<ENV>` | Static header from env var (repeatable) |
| `--base-url-env <ENV>` | Environment variable name for base URL (default: `API_BASE_URL`) |
| `--sync-methods` | Generate synchronous service methods alongside the async client |
| `--middleware` | Generate httpx transport middleware infrastructure |
| `--documentation` | Generate docstring comments from SDL descriptions |
| `--camel-case-aliases` | Generate camelCase field aliases for Pydantic models |
| `--options-threshold <n>` | Parameter count at which a method switches to an options object (default: `4`) |
| `--service-suffix <name>` | Service naming suffix (default: `Service`) |
| `--verbose` | Enable verbose logging |

### Example

```bash
metaengine-graphql-httpx ./schema.graphql ./generated --fragments --documentation --retries 3
```

## Supported platforms

Pre-built wheels are published for Linux (x86_64, aarch64), macOS (Apple Silicon + Intel),
and Windows (x64).

## License

MIT
