You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* An initialized `fern` folder. See [Set up the `fern`
18
+
folder](/sdks/overview/quickstart).
19
+
* A GitHub repository for your Python SDK. See [Project structure](/sdks/overview/project-structure).
20
+
* A Python generator group in `generators.yml`. See [Python
21
+
Quickstart](quickstart#add-the-sdk-generator).
22
+
23
+
</Info>
24
+
25
+
## Configure SDK package settings
26
+
27
+
You'll need to update your `generators.yml` file to configure the package name, output location, and client naming for PyPi publishing. Your `generators.yml`[should live in your source repository](/sdks/overview/project-structure) (or on your local machine), not the repository that contains your Python SDK code.
17
28
18
29
<Steps>
19
30
20
31
<Steptitle="Configure `output` location">
21
32
22
-
Next, change the output location in `generators.yml`from `local-file-system` (the default) to `pypi` to indicate that Fern should publish your package directly to the PyPI registry:
33
+
In the `group` for your Python SDK, change the output location in from `local-file-system` (the default) to `pypi` to indicate that Fern should publish your package directly to the PyPi registry:
23
34
24
-
```yaml title="Python" {6-7}
35
+
```yaml title="generators.yml" {6-7}
25
36
groups:
26
37
python-sdk:
27
38
generators:
@@ -35,10 +46,10 @@ you'll have a versioned package published on PyPI.
35
46
36
47
<Steptitle="Add a unique package name">
37
48
38
-
Your package name must be unique in the PyPI repository, otherwise publishing your SDK to PyPI will fail. Update your package name if you haven't done so already:
49
+
Your package name must be unique in the PyPI repository, otherwise publishing your SDK to PyPI will fail.
39
50
40
51
41
-
```yaml title="Python" {8}
52
+
```yaml title="generators.yml" {8}
42
53
groups:
43
54
python-sdk:
44
55
generators:
@@ -56,7 +67,7 @@ groups:
56
67
The `client-class-name` option controls the name of the generated client. This is the name customers use to import your SDK (`import { your-client-name } from 'your-package-name';`).
57
68
58
69
59
-
```yaml title="Python" {9-10}
70
+
```yaml title="generators.yml" {9-10}
60
71
groups:
61
72
python-sdk:
62
73
generators:
@@ -70,30 +81,9 @@ groups:
70
81
```
71
82
72
83
</Step>
73
-
74
-
<Step title="Add repository location">
75
-
76
-
Add the path to your GitHub repository to `generators.yml`:
At this point, you're ready to generate a release for your SDK.
133
-
<AccordionGroup>
134
-
<Accordion title="Release via a GitHub workflow (recommended)">
135
-
136
-
Set up a release workflow via [GitHub Actions](https://docs.github.com/en/actions/get-started/quickstart) so you can trigger new SDK releases directly from your source repository.
120
+
## Configure PyPi publication
137
121
138
122
<Steps>
139
-
<Step title="Set up authentication">
140
-
141
-
Open your Fern repository in GitHub. Click on the **Settings** tab in your repository. Then, under the **Security** section, open **Secrets and variables** > **Actions**.
branch: your-branch-name # Required for mode: push
183
+
```
184
+
185
+
</Step>
186
+
</Steps>
187
+
188
+
## Publish your SDK
193
189
194
-
Set up a CI workflow that you can manually trigger from the GitHub UI. In your repository, navigate to **Actions**. Select **New workflow**, then **Set up workflow yourself**. Add a workflow that's similar to this:
190
+
Decide how you want to publish your SDK to PyPi. You can use GitHub workflows for automated releases or publish directly via the CLI.
191
+
192
+
<AccordionGroup>
193
+
<Accordion title="Release via a GitHub workflow (recommended)">
194
+
195
+
Set up a release workflow via [GitHub Actions](https://docs.github.com/en/actions/get-started/quickstart) so you can trigger new SDK releases directly from your source repository.
196
+
197
+
<Steps>
198
+
199
+
<Step title="Set up authentication">
200
+
201
+
Open your Fern repository in GitHub. Click on the **Settings** tab in your repository. Then, under the **Security** section, open **Secrets and variables** > **Actions**.
1. Add your Fern token. If you don't already have one, generate one by
227
+
running `fern token`. By default, the `fern_token` is generated for the
228
+
organization listed in `fern.config.json`.
229
+
1. Click **Add secret**.
230
+
231
+
</Step>
232
+
233
+
<Step title="Set up a new workflow">
234
+
235
+
Set up a CI workflow that you can manually trigger from the GitHub UI. In your repository, navigate to **Actions**. Select **New workflow**, then **Set up workflow yourself**. Add a workflow that's similar to this:
Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**.
230
-
231
-
This regenerates your SDK, tags the new release with the version number you specified, and initiates a Fern-generated publishing workflow in your Python SDK repository that publishes your release to PyPi.
270
+
Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**. This regenerates your SDK.
Add `token: ${PYPI_TOKEN}` to `generators.yml` to tell Fern to use the `PYPI_TOKEN` environment variable for authentication when publishing to the PyPI registry.
branch: your-branch-name # Required for mode: push
211
207
```
212
-
You can also configure other settings, like the reviewers or license. Refer to the [full `github` (`generators.yml`) reference](/sdks/reference/generators-yml#github) for more information.
213
208
214
209
</Step>
215
210
</Steps>
@@ -304,6 +299,8 @@ Set up a release workflow via [GitHub Actions](https://docs.github.com/en/action
Optionally set the mode to control how Fern handles SDK publishing:
2
+
3
+
-`mode: release` (default): Fern generates code, commits to main, and tags a release automatically
4
+
-`mode: pull-request`: Fern generates code and creates a PR for you to review before release
5
+
-`mode: push`: Fern generates code and pushes to a branch you specify for you to review before release
6
+
7
+
You can also configure other settings, like the reviewers or license. Refer to the [full `github` (`generators.yml`) reference](/sdks/reference/generators-yml#github) for more information.
Copy file name to clipboardExpand all lines: fern/products/sdks/snippets/release-sdk.mdx
+1-3Lines changed: 1 addition & 3 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,6 +2,4 @@ The rest of the release process depends on your chosen mode:
2
2
3
3
-**Release mode (default):** If you didn't specify a `mode` or set `mode: release`, no further action is required. Fern automatically tags the new release with your specified version number and initiates the npm publishing workflow in your SDK repository.
4
4
5
-
-**Pull request or push mode:** If you set `mode: pull-request` or `mode: push`, Fern creates a pull request or pushes to a branch respectively. Review and merge the PR (`pull-request`) or branch (`push`), then [tag a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) to initiate the npm publishing workflow in your SDK repository.
6
-
7
-
Once the workflow completes, you can view your new release by logging into npm and navigating to **Packages**.
5
+
-**Pull request or push mode:** If you set `mode: pull-request` or `mode: push`, Fern creates a pull request or pushes to a branch respectively. Review and merge the PR (`pull-request`) or branch (`push`), then [tag a new release](https://docs.github.com/en/repositories/releasing-projects-on-github/managing-releases-in-a-repository) to initiate the npm publishing workflow in your SDK repository.
0 commit comments