diff --git a/examples/sdks/generators.yml b/examples/sdks/generators.yml
index cbe6301d4..cc82a861e 100644
--- a/examples/sdks/generators.yml
+++ b/examples/sdks/generators.yml
@@ -22,6 +22,8 @@ groups:
namespaceExport: YourClientName
github:
repository: your-company/ts-sdk
+ mode: push
+ branch: your-branch-name
# This group configures a Python SDK for PyPi publishing
python-sdk:
generators:
@@ -35,4 +37,5 @@ groups:
client_class_name: MyClientNameDevin
github:
repository: devalog/company-python-test
+ mode: pull-request
# generator groups for other SDKs go here
diff --git a/fern/products/sdks/overview/python/publishing-to-pypi.mdx b/fern/products/sdks/overview/python/publishing-to-pypi.mdx
index 3f3b05028..6ccb9f1c0 100644
--- a/fern/products/sdks/overview/python/publishing-to-pypi.mdx
+++ b/fern/products/sdks/overview/python/publishing-to-pypi.mdx
@@ -11,17 +11,28 @@ you'll have a versioned package published on PyPI.
-
+
+ This page assumes that you have:
-## Configure `generators.yml`
+ * An initialized `fern` folder. See [Set up the `fern`
+ folder](/sdks/overview/quickstart).
+ * A GitHub repository for your Python SDK. See [Project structure](/sdks/overview/project-structure).
+ * A Python generator group in `generators.yml`. See [Python
+ Quickstart](quickstart#add-the-sdk-generator).
+
+
+
+## Configure SDK package settings
+
+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.
- 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:
+ 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:
- ```yaml title="Python" {6-7}
+ ```yaml title="generators.yml" {6-7}
groups:
python-sdk:
generators:
@@ -35,10 +46,10 @@ you'll have a versioned package published on PyPI.
- 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:
+ Your package name must be unique in the PyPI repository, otherwise publishing your SDK to PyPI will fail.
-```yaml title="Python" {8}
+```yaml title="generators.yml" {8}
groups:
python-sdk:
generators:
@@ -56,7 +67,7 @@ groups:
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';`).
-```yaml title="Python" {9-10}
+```yaml title="generators.yml" {9-10}
groups:
python-sdk:
generators:
@@ -70,30 +81,9 @@ groups:
```
-
-
-
- Add the path to your GitHub repository to `generators.yml`:
-
-```yaml title="Python" {11-12}
-groups:
- python-sdk:
- generators:
- - name: fernapi/fern-python-sdk
- version:
- output:
- location: pypi
- package-name: your-package-name
- config:
- client_class_name: YourClientName
- github:
- repository: your-org/company-python
-```
-
-
-## Set up PyPi publishing authentication
+## Generate a PyPi token
@@ -127,53 +117,34 @@ groups:
-## Release your SDK to PyPI
-
- At this point, you're ready to generate a release for your SDK.
-
-
-
-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.
+## Configure PyPi publication
-
-
- Open your Fern repository in GitHub. Click on the **Settings** tab in your repository. Then, under the **Security** section, open **Secrets and variables** > **Actions**.
-
-
-
-
+
- You can also use the url `https://github.com//settings/secrets/actions`.
-
-
-
-
- 1. Select **New repository secret**.
- 1. Name your secret `PYPI_TOKEN`.
- 1. Add the corresponding token you generated above.
- 1. Click **Add secret**.
-
-
-
-
+Add the path to your GitHub repository to `generators.yml`:
-
-
-
- 1. Select **New repository secret**.
- 1. Name your secret `FERN_TOKEN`.
- 1. Add your Fern token. If you don't already have one, generate one by
- running `fern token`. By default, the `fern_token` is generated for the
- organization listed in `fern.config.json`.
- 1. Click **Add secret**.
-
-
-
+```yaml title="generators.yml" {11-12}
+groups:
+ python-sdk:
+ generators:
+ - name: fernapi/fern-python-sdk
+ version:
+ output:
+ location: pypi
+ package-name: your-package-name
+ config:
+ client_class_name: YourClientName
+ github:
+ repository: your-org/company-python
+```
+
+
+
- Add `token: ${PYPI_TOKEN}` to `generators.yml`.
+Add `token: ${PYPI_TOKEN}` to `generators.yml`.
- ```yaml {9} title="generators.yml"
+```yaml {9} title="generators.yml"
groups:
python-sdk:
generators:
@@ -187,11 +158,81 @@ groups:
client_class_name: YourClientName
github:
repository: your-org/company-python
- ```
-
-
+```
+
+
+
+
+
+```yaml title="generators.yml" {14}
+groups:
+ python-sdk:
+ generators:
+ - name: fernapi/fern-python-sdk
+ version:
+ output:
+ location: npm
+ package-name: name-of-your-package
+ token: ${PYPI_TOKEN}
+ config:
+ namespaceExport: YourClientName
+ github:
+ repository: your-org/your-repository
+ mode: push
+ branch: your-branch-name # Required for mode: push
+```
+
+
+
+
+## Publish your SDK
- 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:
+Decide how you want to publish your SDK to PyPi. You can use GitHub workflows for automated releases or publish directly via the CLI.
+
+
+
+
+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.
+
+
+
+
+
+Open your Fern repository in GitHub. Click on the **Settings** tab in your repository. Then, under the **Security** section, open **Secrets and variables** > **Actions**.
+
+
+
+
+
+You can also use the url `https://github.com//settings/secrets/actions`.
+
+
+
+
+1. Select **New repository secret**.
+1. Name your secret `PYPI_TOKEN`.
+1. Add the corresponding token you generated above.
+1. Click **Add secret**.
+
+
+
+
+
+
+
+
+1. Select **New repository secret**.
+1. Name your secret `FERN_TOKEN`.
+1. Add your Fern token. If you don't already have one, generate one by
+ running `fern token`. By default, the `fern_token` is generated for the
+ organization listed in `fern.config.json`.
+1. Click **Add secret**.
+
+
+
+
+
+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:
```yaml title=".github/workflows/publish.yml" maxLines=0
name: Publish Python SDK
@@ -222,19 +263,19 @@ groups:
fern generate --group python-sdk --version ${{ inputs.version }} --log-level debug
```
-
+
-
+
- Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**.
-
- 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.
+ Navigate to the **Actions** tab, select the workflow you just created, specify a version number, and click **Run workflow**. This regenerates your SDK.
- Once your workflow completes, log back into PyPi and navigate to **Packages** to see your new release.
+
+
+ Once the workflow completes, you can view your new release by logging into PyPi and navigating to **Your projects**.
@@ -242,27 +283,6 @@ groups:
-
-
-
- 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.
-
- ```yaml title="Python" {9}
- groups:
- python-sdk:
- generators:
- - name: fernapi/fern-python-sdk
- version:
- output:
- location: pypi
- package-name: your-package-name
- token: ${PYPI_TOKEN}
- config:
- client_class_name: YourClientName
- github:
- repository: your-org/company-python
- ```
-
@@ -274,16 +294,16 @@ groups:
-
+
- Regenerate your SDK and publish it on PyPI:
+ Regenerate your SDK, specifying the version:
```bash
fern generate --group python-sdk --version
```
- Local machine output will verify that the release is pushed to your
- repository and tagged with the version you specified. Log back into PyPI and
- navigate to **Your projects** to see your new release.
+
+
+ Once the workflow completes, you can view your new release by logging into PyPi and navigating to **Your projects**.
diff --git a/fern/products/sdks/overview/typescript/publishing-to-npm.mdx b/fern/products/sdks/overview/typescript/publishing-to-npm.mdx
index 010be1e37..99ab3ed02 100644
--- a/fern/products/sdks/overview/typescript/publishing-to-npm.mdx
+++ b/fern/products/sdks/overview/typescript/publishing-to-npm.mdx
@@ -186,11 +186,7 @@ groups:
-Optionally set the mode to control how Fern handles SDK publishing:
-
-- `mode: release` (default): Fern generates code, commits to main, and tags a release automatically
-- `mode: pull-request`: Fern generates code and creates a PR for you to review before release
-- `mode: push`: Fern generates code and pushes to a branch you specify for you to review before release
+
```yaml title="generators.yml" {14}
groups:
@@ -209,7 +205,6 @@ groups:
mode: push
branch: your-branch-name # Required for mode: push
```
-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.
@@ -304,6 +299,8 @@ Set up a release workflow via [GitHub Actions](https://docs.github.com/en/action
+
+ Once the workflow completes, you can view your new release by logging into npm and navigating to **Packages**.
@@ -332,6 +329,9 @@ fern generate --group ts-sdk --version
```
+
+Once the workflow completes, you can view your new release by logging into npm and navigating to **Packages**.
+
diff --git a/fern/products/sdks/snippets/github-publishing-mode.mdx b/fern/products/sdks/snippets/github-publishing-mode.mdx
new file mode 100644
index 000000000..fcc863acb
--- /dev/null
+++ b/fern/products/sdks/snippets/github-publishing-mode.mdx
@@ -0,0 +1,7 @@
+Optionally set the mode to control how Fern handles SDK publishing:
+
+- `mode: release` (default): Fern generates code, commits to main, and tags a release automatically
+- `mode: pull-request`: Fern generates code and creates a PR for you to review before release
+- `mode: push`: Fern generates code and pushes to a branch you specify for you to review before release
+
+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.
\ No newline at end of file
diff --git a/fern/products/sdks/snippets/release-sdk.mdx b/fern/products/sdks/snippets/release-sdk.mdx
index 3f046ad61..db9e693af 100644
--- a/fern/products/sdks/snippets/release-sdk.mdx
+++ b/fern/products/sdks/snippets/release-sdk.mdx
@@ -2,6 +2,4 @@ The rest of the release process depends on your chosen mode:
- **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.
-- **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.
-
-Once the workflow completes, you can view your new release by logging into npm and navigating to **Packages**.
\ No newline at end of file
+- **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.
\ No newline at end of file