For AI agents: a documentation index is available at the root level at /llms.txt and /llms-full.txt. Append /llms.txt to any URL for a page-level index, or .md for the markdown version of any page.
Slack communityLog inBook a demo
  • Overview
    • Introduction
    • Quickstart
    • Capabilities
    • Customer Showcase
  • Generators
      • Quickstart
      • Configuration
      • Changelog
      • Publishing to PyPI
      • Adding custom code
    • MCP Server
  • Deep Dives
    • Customize Method Names
    • Setup local SDK previews
    • Configure Global Headers
    • Configure Auto-Pagination
    • Configure Idempotency
    • Filter Your Endpoints (Audiences)
  • Reference
    • generators.yml
LogoLogo
Slack communityLog inBook a demo
GeneratorsPython

Python Quickstart

Was this page helpful?
Previous

Python Configuration

Next
Built with

Generate a Python SDK by following the instructions on this page.

This guide assumes that you already have an initialized fern folder on your local machine. See Set up the fern folder for more details.
1

Pass fern check

Run fern check to ensure that your API definition is valid. If there are any errors, fix them before proceeding.

If you’re using an OpenAPI Specification, check out all of our supported extensions.

2

Add the SDK generator

Add the Python SDK generator:

$fern add fern-python-sdk --group python-sdk

python-sdk is the name of the generators.yml group that configures your Python SDK’s output location and other metadata. You can customize this group name to differentiate between multiple SDKs across different languages (e.g., ruby-sdk, etc) in your organization.

This command adds the following to generators.yml:

1 python-sdk:
2 generators:
3 - name: fernapi/fern-python-sdk
4 version: 4.23.2
5 output:
6 location: local-file-system
7 path: ../sdks/python
3

Generate the SDK

Generate the SDK:

$fern generate --group python-sdk

This creates a sdks folder in your current directory. The resulting folder structure looks like this:

$fern/ # created by fern init
$sdks/ # created by fern generate --group python-sdk
$├─ python
$ ├─ __init__.py
$ ├─ client.py
$ ├─ core/
$ └─ imdb/ # or the name of your API
$ ├─ errors/
$ └─ types/
Some files, including pyproject.toml and README.md, are only generated on paid plans. To get the fully generated SDK, schedule a demo or email us.