Python configuration
Configure the Python SDK in the generation block of its target in sdk-config.yml:
The target’s generation block also accepts the shared generation options, such as naming, wireTests, and customCode. Shared options set in the top-level generation block apply to every target, and a target’s generation block overrides them. For generators.yml options, see the Legacy Python configuration.
Python options
pythonVersion
The Python version targeted by the generated project.
pydanticVersion
The Pydantic dependency version requirement.
pydantic
Pydantic model-generation behavior.
<ParamField path=“pydantic.versionCompatibility” type=""v1” | “v2” | “both” | “v1-on-v2"" required= toc=> The Pydantic major versions supported by generated models. </ParamField>
pydantic.frozen
Whether generated Pydantic models are immutable.
pydantic.requireOptionalFields
Whether Optional fields remain required unless they declare a default.
<ParamField path=“pydantic.unionNaming” type=""v0” | “v1"" required= toc=> The naming strategy for generated union types. </ParamField>
pydantic.useFieldAliases
Whether Pydantic field aliases preserve wire names.
client
Python client file naming.
client.fileName
The source file name for the Python client.
client.exportedFileName
The file name used when exporting the Python client.
followRedirectsByDefault
Whether generated HTTP clients follow redirects by default.
defaultBytesStreamChunkSize
The default byte-stream iterator chunk size.
recursionLimit
The Python recursion limit installed when the generated package is imported.
extras
Published Python extras and their dependency names.
alwaysInitializeOptionals
Whether optional model fields are initialized even when omitted.
useTypedDictRequests
Whether request bodies are generated as TypedDict types.
additionalInitExports
Additional names re-exported from the package initializer.