Skip to content

Commit d53dc52

Browse files
committed
add python quickstart
1 parent fdb4fe6 commit d53dc52

File tree

1 file changed

+78
-1
lines changed

1 file changed

+78
-1
lines changed

fern/products/sdks/overview/python/quickstart.mdx

Lines changed: 78 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,4 +3,81 @@ title: Python Quickstart
33
description: Get started quickly with the Fern Python SDK.
44
---
55

6-
Generate a Python SDK by following the instructions on this page.
6+
<Markdown src="/products/sdks/snippets/demo-warning.mdx"/>
7+
8+
Generate a Python SDK by following the instructions on this page.
9+
10+
<Steps>
11+
<Markdown src="/products/sdks/snippets/install-cli.mdx"/>
12+
13+
### Initialize the Fern Folder
14+
15+
You can use either the OpenAPI definition, AsyncAPI definition, or Fern Definition to generate your SDK.
16+
17+
<AccordionGroup>
18+
<Accordion title="Option 1: OpenAPI">
19+
<Markdown src="/products/sdks/snippets/option-1-openapi.mdx"/>
20+
</Accordion>
21+
22+
<Accordion title="Option 2: AsyncAPI">
23+
<Markdown src="/products/sdks/snippets/option-2-asyncapi.mdx"/>
24+
</Accordion>
25+
26+
<Accordion title="Option 3: Fern Definition">
27+
<Markdown src="/products/sdks/snippets/option-3-fern-def.mdx"/>
28+
29+
1. Add the config option `outputSourceFiles: true` to `generators.yml`. This ensures your SDK contains `.py` files instead of compiled output.
30+
31+
```yaml {11-12}
32+
# yaml-language-server: $schema=https://schema.buildwithfern.dev/generators-yml.json
33+
default-group: local
34+
groups:
35+
local:
36+
generators:
37+
- name: fernapi/fern-typescript-node-sdk
38+
output:
39+
location: local-file-system
40+
path: ../sdks/typescript
41+
version: <Markdown src="/snippets/version-number.mdx"/>
42+
config:
43+
outputSourceFiles: true
44+
```
45+
</Accordion>
46+
</AccordionGroup>
47+
48+
<Markdown src="/products/sdks/snippets/pass-fern-check.mdx"/>
49+
50+
### Add the SDK generator
51+
52+
Add the Python SDK generator:
53+
54+
```bash
55+
fern add fern-python-sdk --group sdk
56+
```
57+
58+
This command adds the following to `generators.yml`:
59+
60+
```yaml
61+
sdk:
62+
generators:
63+
- name: fernapi/fern-python-sdk
64+
version: <Markdown src="/snippets/version-number.mdx"/>
65+
output:
66+
location: local-file-system
67+
path: ../sdks/python
68+
```
69+
<Markdown src="/products/sdks/snippets/generate-sdk.mdx"/>
70+
71+
```bash
72+
fern/ # created in step 1
73+
sdks/ # created by fern generate --group sdk
74+
├─ python
75+
├─ __init__.py
76+
├─ client.py
77+
├─ core/
78+
└─ imdb/ # or the name of your API
79+
└─ errors/
80+
└─ types/
81+
```
82+
83+
</Steps>

0 commit comments

Comments
 (0)