> This page is for SDKs, version Current (default).
> For other versions, use one of these documentation indexes:
> - Current (default): https://buildwithfern.com/learn/sdks/current/llms.txt
> - Legacy: https://buildwithfern.com/learn/sdks/legacy/llms.txt

> For clean Markdown content of this page, append .md to this URL. For the complete documentation index, see https://buildwithfern.com/learn/llms.txt.

# Python configuration

> Configuration options for the Python target in sdk-config.yml.

Configure the Python SDK in the `generation` block of its target in `sdk-config.yml`:

**`sdk-config.yml`**

```yaml {3-8} title="sdk-config.yml"
targets:
  - language: python
    generation:
      naming:
        clientName: YourClientName
      followRedirectsByDefault: true
      alwaysInitializeOptionals: true
      useTypedDictRequests: true
```

The target's `generation` block also accepts the [shared generation options](/learn/sdks/reference/sdk-config#generation), 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](/learn/sdks/legacy/generators/python/configuration).

## Python options

**`pythonVersion`** `string`

The Python version targeted by the generated project.

---

**`pydanticVersion`** `string`

The Pydantic dependency version requirement.

---

**`pydantic`** `object`

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`** `boolean`

Whether generated Pydantic models are immutable.

---

**`pydantic.requireOptionalFields`** `boolean`

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`** `boolean`

Whether Pydantic field aliases preserve wire names.

---

**`client`** `object`

Python client file naming.

---

**`client.fileName`** `string`

The source file name for the Python client.

---

**`client.exportedFileName`** `string`

The file name used when exporting the Python client.

---

**`followRedirectsByDefault`** `boolean`

Whether generated HTTP clients follow redirects by default.

---

**`defaultBytesStreamChunkSize`** `number`

The default byte-stream iterator chunk size.

---

**`recursionLimit`** `number`

The Python recursion limit installed when the generated package is imported.

---

**`extras`** `object`

Published Python extras and their dependency names.

---

**`alwaysInitializeOptionals`** `boolean`

Whether optional model fields are initialized even when omitted.

---

**`useTypedDictRequests`** `boolean`

Whether request bodies are generated as TypedDict types.

---

**`additionalInitExports`** `list of object`

Additional names re-exported from the package initializer.

---