metaengine-protobuf-httpx
Protobuf 3 → an async Python httpx client and Pydantic v2 message models over gRPC-Connect on HTTP, with HTTP-status error handling, optional docstrings, and dependency-free @dataclass models. Delivered as a pip-installable CLI — no .NET required.
Pick your registry
The same generator, published to every ecosystem we support. Install however your project expects.
Drive it from the CLI or programmatically
PyPI ships a zero-config CLI. NuGet ships the same generator as a C# fluent API — same options, same output.
After install, point the CLI at your schema. It writes the generated tree to your chosen output directory.
metaengine-protobuf-httpx <input> <output> [options]Generates an async httpx gRPC-Connect client and Pydantic v2 message models from Protobuf 3 .proto files. The wheel bundles a platform-native runner, so no .NET install is required.
metaengine-protobuf-httpx ./service.proto ./generatedmetaengine-protobuf-httpx ./service.proto ./generated --documentationmetaengine-protobuf-httpx ./service.proto ./generated --dataclass --verboseEvery knob, documented
Every option is available on the C# fluent API as a method, and most are also exposed as CLI flags. Cross-cutting auth, headers, retries and timeouts apply across frameworks.
Python Client Options
6WithDocumentation()Generate docstring comments on models and service methodsWithSyncMethods()Generate synchronous methods (httpx.Client) instead of async (httpx.AsyncClient)WithMiddleware()Emit request / response middleware hooks in the generated clientWithCamelCaseAliases()Field(alias=...) camelCase aliases on models (always-on for protobuf — proto3 JSON wire format is lowerCamelCase)WithMethodNames(Func)Custom method naming ruleWithOptionsObjectThreshold(int)Parameter count before an options object is used (default: 4)
Auth · Headers · Resilience
13WithErrorHandling()Smart error handling based on HTTP status semantics (Connect maps gRPC errors onto HTTP status codes)WithErrorHandling(errors => errors...)Per-status routing on the Connect transport: ReturnNullFor(404, 403) · ReturnErrorFor(400, 422) · ThrowFor(401, 500)WithBearerAuth()Bearer token from env var (default API_TOKEN) — adds Authorization headerWithBearerAuth(string)Bearer token from a specific env var nameWithBearerAuth(string, string)Bearer token with custom header name (e.g. X-Api-Key)WithBasicAuth(string, string)HTTP Basic auth from username + password env varsWithCustomHeader(string, string)Static header from env var. Repeatable (e.g. X-Tenant-ID ← TENANT_ID)WithBaseUrlEnvVar(string)Environment variable name for the base URL (default: API_BASE_URL)WithTimeout(double)Request timeout in seconds for all operationsWithTimeout(double?, double?, double?, double?)Granular httpx timeout: connect · read · write · poolWithRetries()Retries with exponential backoff (default status 429, 503)WithRetries(int)Retries with custom max attemptsWithRetries(int, double, double, int[])Retries with max attempts, base delay, max delay, and custom status codes
Protobuf Options
3WithDataclass()Emit @dataclass(slots=True) models instead of Pydantic v2 BaseModel — zero runtime deps, stdlib dataclasses onlyWithTypeFilter(Func)Filter extracted proto types before registration — only types returning true are generatedWithTypeMapping(string, Type)Override the Python mapping for a protobuf well-known type by fully-qualified name (e.g. google.protobuf.Timestamp → str)
Naming Transformations
3Types(Func)Transform type namesPaths(Func)Transform output pathsFileNames(Func)Transform file names
File Management
5CleanDestination()Clean output directory before generationAlwaysOverwrite()Always overwrite existing filesOnlyWhenModelChanged()Update only when model changesOnlyWhenNew()Write only new files, preserve existingCleanDirectories(...)Clean specific subdirectories
Diagnostics
1EnableVerboseLogging()Enable detailed logging