> 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.

# Set up local SDK previews

> Learn how to set up local SDK previews with Fern's --preview flag. Test generated SDK code locally before publishing to iterate quickly.

Once you configure your SDK, you can use the `--preview` flag to test generated
SDK code locally before publishing. This allows quick iteration on your SDK
as you develop:

```bash
# Preview all SDKs
fern generate --preview

# Preview SDK for a specific language
fern generate --group <language>-sdk --preview

```

`--preview` generates your SDK code into a local `.preview/` folder within your
`fern` folder. No changes are published to package managers or GitHub.

> **Tip**
>
> `--preview` preserves any custom code you added to your SDK.

## Example usage

Here's an example of how you can preview a Python SDK.

### Generator configuration

**`sdk-config.yml`**

```yaml title="sdk-config.yml"
schemaVersion: sdk-config/v1
source:
  specs:
    - id: imdb
      type: openapi
      path: ./openapi/openapi.yml
targets:
  - language: python
    package:
      packageName: imdb
    generation:
      naming:
        clientName: imdb
    output:
      delivery: github
      github:
        repository: imdb/imdb-python
      publish:
        registry: pypi
        username: __token__
        password: ${PYPI_TOKEN}
```

### Invoke the Fern CLI

```shell
fern generate --target python --preview
```

### Preview your SDK

The resulting folder structure will look like this: