This section details the available configuration options for the Python SDK. All configuration is managed in the gen.yaml file under the python section.
The name of the module to import from. Allows using a different name for imports than the package name. For example, pip install {packageName} and in code from {moduleName} import SDK. PEP 420 implicit namespace packages are supported with period (.) characters — e.g. example_cloud.api_client generates the SDK in example_cloud/api_client/ with no __init__.py in the parent. Custom code regions will be removed by updating moduleName.
Default Value
Same as packageName
authors
Required
true
Description
Authors of the published package.
Default Value
["Speakeasy"]
description
Required
false
Description
A short description of the project.
Default Value
"Python Client SDK Generated by Speakeasy."
homepage
Required
false
Description
The URL for the homepage of the project.
Default Value
null
documentationUrl
Required
false
Description
The URL for the project documentation.
Default Value
null
license
Required
false
Description
The SPDX license identifier or license text for the project.
The name of the module to import from. Allows using a different name for imports than the package name. For example, pip install {packageName} and in code from {moduleName} import SDK. PEP 420 implicit namespace packages are supported with period (.) characters — e.g. example_cloud.api_client generates the SDK in example_cloud/api_client/ with no __init__.py in the parent. Custom code regions will be removed by updating moduleName.
authors
true
["Speakeasy"]
Authors of the published package.
description
false
"Python Client SDK Generated by Speakeasy."
A short description of the project.
homepage
false
null
The URL for the homepage of the project.
documentationUrl
false
null
The URL for the project documentation.
license
false
Apache-2.0 (new) / empty (legacy)
The SPDX license identifier or license text for the project.
The package manager to use for dependency management and packaging. Options: uv (recommended) or poetry.
Default Value
uv (new) / poetry (legacy)
additionalDependencies
Required
false
Description
Specify additional dependencies to include in the generated pyproject.toml file.
Default Value
{main: {}, dev: {}}
optionalDependencies
Required
false
Description
Define optional dependency groups (PyPI extras) in the generated pyproject.toml file. Each key becomes an extra that installs the listed packages on demand.
Default Value
{}
compileCommands
Required
false
Description
A list of commands to use for compiling the SDK, replacing the default compile pipeline. Must be an array of arrays where each inner array has the command as the first element and the rest are arguments.
Default Value
N/A
pytestFilterWarnings
Required
false
Description
When the array contains any strings, sets the global pytest filterwarnings value (filters to control Python warnings, e.g. ignoring or raising as errors). See Python warning filters.
Default Value
[]
pytestTimeout
Required
false
Description
When greater than 0, installs pytest-timeout and sets the global timeout (in seconds) before individual tests are timed out.
Default Value
0
Name
Required
Default Value
Description
packageManager
false
uv (new) / poetry (legacy)
The package manager to use for dependency management and packaging. Options: uv (recommended) or poetry.
additionalDependencies
false
{main: {}, dev: {}}
Specify additional dependencies to include in the generated pyproject.toml file.
optionalDependencies
false
{}
Define optional dependency groups (PyPI extras) in the generated pyproject.toml file. Each key becomes an extra that installs the listed packages on demand.
compileCommands
false
N/A
A list of commands to use for compiling the SDK, replacing the default compile pipeline. Must be an array of arrays where each inner array has the command as the first element and the rest are arguments.
pytestFilterWarnings
false
[]
When the array contains any strings, sets the global pytest filterwarnings value (filters to control Python warnings, e.g. ignoring or raising as errors). See Python warning filters.
pytestTimeout
false
0
When greater than 0, installs pytest-timeout and sets the global timeout (in seconds) before individual tests are timed out.
Default compilation pipeline
When compileCommands is not set, the default pipeline runs based on the package manager (uv or poetry) and includes bytecode compilation (compileall), linting (pylint -j=0), and type checking (mypy and pyright in parallel). To reduce pylint parallelism and avoid OOM errors in CI, use compileCommands with -j=1.
Use optionalDependencies to declare optional dependency groups, known as extras, in the generated pyproject.toml file. Extras let end users install packages that the SDK needs only for specific functionality, keeping the default installation lightweight.
Each top-level key under optionalDependencies is the name of an extra. Each extra holds a map of package names to PEP 508 version specifiers:
python:
optionalDependencies:
http2:
h2: ">=4.0.0"
cli:
click: ">=8.1.0"
rich: ">=13.0.0"
This configuration generates the following [project.optional-dependencies] table:
[project.optional-dependencies]
cli = [
"click >=8.1.0",
"rich >=13.0.0",
]
http2 = [
"h2 >=4.0.0",
]
End users then install an extra by name:
Terminal window
pipinstallmy-package[http2]
Extras and their packages are sorted alphabetically in the output. An extra with no packages renders as an empty list, such as http2 = []. Both the uv and poetry package managers support optionalDependencies.
Optional vs. additional dependencies
Use additionalDependencies for packages the SDK always needs, since they are installed with the base package. Use optionalDependencies for packages the SDK needs only for specific features, since they are installed only when an end user requests the matching extra.
The maximum number of parameters a method can have before the resulting SDK endpoint is no longer "flattened" and an input object is generated instead. 0 means input objects are always used.
Default Value
999 (new) / 4 (legacy)
flattenRequests
Required
false
Description
Turn request parameters and body fields into a flat list of method arguments. Takes precedence over maxMethodParams. If there is no request body, maxMethodParams is respected.
Default Value
true (new SDKs)
flatteningOrder
Required
false
Description
When flattening parameters and body fields, determines the ordering of generated method arguments. Options: parameters-first or body-first.
Default Value
parameters-first
methodArguments
Required
false
Description
If infer-optional-args, when all parameters and the request body are optional, the argument to the function will be optional. Alternative: require-security-and-request.
The maximum number of parameters a method can have before the resulting SDK endpoint is no longer "flattened" and an input object is generated instead. 0 means input objects are always used.
flattenRequests
false
true (new SDKs)
Turn request parameters and body fields into a flat list of method arguments. Takes precedence over maxMethodParams. If there is no request body, maxMethodParams is respected.
flatteningOrder
false
parameters-first
When flattening parameters and body fields, determines the ordering of generated method arguments. Options: parameters-first or body-first.
methodArguments
false
infer-optional-args
If infer-optional-args, when all parameters and the request body are optional, the argument to the function will be optional. Alternative: require-security-and-request.
Whether to generate sync and/or async methods. both generates one constructor with _async-suffixed methods. split generates FooSDK and AsyncFooSDK with no method-name suffixes.
Default Value
both
useAsyncHooks
Required
false
Description
Enable async hooks infrastructure for async SDK methods. SDK maintainers must explicitly register async hooks in asyncregistration.py. Adapters wrap sync hooks, but native async implementations are recommended.
Default Value
false
sseFlatResponse
Required
false
Description
Whether to flatten SSE (Server-Sent Events) responses by extracting the data field from wrapper models, providing direct access to event data instead of the wrapper object.
Default Value
false
Name
Required
Default Value
Description
asyncMode
false
both
Whether to generate sync and/or async methods. both generates one constructor with _async-suffixed methods. split generates FooSDK and AsyncFooSDK with no method-name suffixes.
useAsyncHooks
false
false
Enable async hooks infrastructure for async SDK methods. SDK maintainers must explicitly register async hooks in asyncregistration.py. Adapters wrap sync hooks, but native async implementations are recommended.
sseFlatResponse
false
false
Whether to flatten SSE (Server-Sent Events) responses by extracting the data field from wrapper models, providing direct access to event data instead of the wrapper object.
The asyncMode setting provides two patterns for handling async operations:
Method-based (both, default): Every operation has two methods — a synchronous version and an asynchronous version with an _async suffix.
sdk = MyAPI(api_key="...")
# Synchronous operations
result = sdk.list_users()
# Asynchronous operations
result =await sdk.list_users_async()
Constructor-based (split): Separate constructors for synchronous and asynchronous clients. All method names are identical between sync and async versions.
# Synchronous client
sync_sdk = MyAPI(api_key="...")
result = sync_sdk.list_users()
# Asynchronous client
async_sdk = AsyncMyAPI(api_key="...")
result =await async_sdk.list_users()
The constructor-based pattern eliminates method name duplication and provides clearer IDE suggestions.
Breaking change
Switching to asyncMode: split is a breaking change. Existing SDK consumers will need to update their code to use the new constructor pattern.
Determines the format to express enums in Python. Options: union or enum.
Default Value
union (new) / enum (legacy)
forwardCompatibleEnumsByDefault
Required
false
Description
When true, any enum used in a response is automatically open/forward-compatible — unknown values are tolerated. Single-value enums are not auto-opened. Individual enums can be controlled with x-speakeasy-unknown-values: allow/disallow.
Default Value
true (new SDKs)
forwardCompatibleUnionsByDefault
Required
false
Description
Controls forward compatibility for discriminated unions in responses. tagged-only makes discriminated unions open to unknown discriminator values. false disables. Individual unions can be controlled with x-speakeasy-unknown-values: allow/disallow.
Default Value
tagged-only (new) / false (legacy)
inferUnionDiscriminators
Required
false
Description
Infer union discriminators for oneOfs missing explicit OpenAPI discriminator mapping.
Default Value
true
preApplyUnionDiscriminators
Required
false
Description
When true, discriminator values are applied as const fields onto union member types when those types are consistently used with the same discriminator value. Simplifies type structure and enables Annotated[Union[...], Field(discriminator='...')] syntax.
Default Value
true (new SDKs)
Name
Required
Default Value
Description
enumFormat
false
union (new) / enum (legacy)
Determines the format to express enums in Python. Options: union or enum.
forwardCompatibleEnumsByDefault
false
true (new SDKs)
When true, any enum used in a response is automatically open/forward-compatible — unknown values are tolerated. Single-value enums are not auto-opened. Individual enums can be controlled with x-speakeasy-unknown-values: allow/disallow.
forwardCompatibleUnionsByDefault
false
tagged-only (new) / false (legacy)
Controls forward compatibility for discriminated unions in responses. tagged-only makes discriminated unions open to unknown discriminator values. false disables. Individual unions can be controlled with x-speakeasy-unknown-values: allow/disallow.
inferUnionDiscriminators
false
true
Infer union discriminators for oneOfs missing explicit OpenAPI discriminator mapping.
preApplyUnionDiscriminators
false
true (new SDKs)
When true, discriminator values are applied as const fields onto union member types when those types are consistently used with the same discriminator value. Simplifies type structure and enables Annotated[Union[...], Field(discriminator='...')] syntax.
Fixes to apply to the generated SDK. Generally true for new SDKs but may be false for backward compatibility with existing SDKs.
python:
fixes:
responseRequiredSep2024: true
asyncPaginationSep2025: true
conflictResistantModelImportsFeb2026: true
Name
responseRequiredSep2024
Required
false
Description
Enables fixes introduced in September 2024 for response required field handling. For existing SDKs, setting to true is recommended but may be a breaking change.
Default Value
true (new SDKs)
asyncPaginationSep2025
Required
false
Description
Disabling not recommended. Enables changes introduced in September 2025 to fix async pagination methods to return async next() functions instead of synchronous ones, preventing blocking fetches after the initial API call. For existing SDKs, setting to true is recommended but will be a breaking change.
Default Value
true (new SDKs)
conflictResistantModelImportsFeb2026
Required
false
Description
Enables conflict-resistant model imports introduced in February 2026. For existing SDKs, setting to true is recommended but may be a breaking change.
Default Value
true (new SDKs)
Name
Required
Default Value
Description
responseRequiredSep2024
false
true (new SDKs)
Enables fixes introduced in September 2024 for response required field handling. For existing SDKs, setting to true is recommended but may be a breaking change.
asyncPaginationSep2025
false
true (new SDKs)
Disabling not recommended. Enables changes introduced in September 2025 to fix async pagination methods to return async next() functions instead of synchronous ones, preventing blocking fetches after the initial API call. For existing SDKs, setting to true is recommended but will be a breaking change.
conflictResistantModelImportsFeb2026
false
true (new SDKs)
Enables conflict-resistant model imports introduced in February 2026. For existing SDKs, setting to true is recommended but may be a breaking change.