Skip to content

Commit 0633f89

Browse files
committed
Add Python SDK generation
1 parent 95db3fb commit 0633f89

4 files changed

Lines changed: 38 additions & 10 deletions

File tree

.github/actions/setup-stlc/action.yml

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,23 @@ runs:
2525
with:
2626
version: "10.30.1"
2727

28+
- name: Install Rye
29+
# The Python SDK's scripts/bootstrap runs `rye sync`.
30+
shell: bash
31+
env:
32+
RYE_VERSION: "0.44.0"
33+
RYE_SHA256: "e55e8b844c44820b540c3df46c8d4a3cee43a42ce5302e92bcd99b21d194a9bc"
34+
run: |
35+
rye_archive="$RUNNER_TEMP/rye-x86_64-linux.gz"
36+
curl --fail --silent --show-error --location \
37+
"https://github.com/astral-sh/rye/releases/download/${RYE_VERSION}/rye-x86_64-linux.gz" \
38+
--output "$rye_archive"
39+
echo "$RYE_SHA256 $rye_archive" | sha256sum --check
40+
mkdir -p "$HOME/.rye/shims"
41+
gzip --decompress --stdout "$rye_archive" > "$HOME/.rye/shims/rye"
42+
chmod +x "$HOME/.rye/shims/rye"
43+
echo "$HOME/.rye/shims" >> "$GITHUB_PATH"
44+
2845
- name: Install stlc and target generators
2946
shell: bash
3047
env:
@@ -39,5 +56,6 @@ runs:
3956
npm install -g \
4057
"git+https://x-access-token:${STLC_READ_TOKEN}@github.com/stainless/stlc.git#cfc85d2651330f7ba6a94dbe8e3c92ab64124f38" \
4158
"git+https://x-access-token:${STLC_READ_TOKEN}@github.com/stainless/stlc-typescript.git#cd63c03a3381e7fbf05e1de78fb3e38a1fd1aaee" \
59+
"git+https://x-access-token:${STLC_READ_TOKEN}@github.com/stainless/stlc-python.git#d67054a81ed5b5b863a2bbc321a23e9b66a8832d" \
4260
"git+https://x-access-token:${STLC_READ_TOKEN}@github.com/stainless/stlc-go.git#9473a876905d28ab87c5a7bce69199a9389a2094"
4361
stlc version

.github/workflows/stlc-generate.yml

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# Generates the TypeScript and Go SDKs with the self-hosted stlc CLI,
1+
# Generates the Python, TypeScript, and Go SDKs with the self-hosted stlc CLI,
22
# replacing the hosted-Stainless pipeline that stainless-sdks.yml used to drive.
33
#
44
# On pull_request: builds every target, pushes a stlc/preview/pr-N branch to each
@@ -60,8 +60,8 @@ env:
6060
# An integration-test dispatch pushes this branch instead of the preview
6161
# branch or main.
6262
INTEGRATION_BRANCH: stlc/integration-test/run-${{ github.run_id }}
63-
SDK_REPOS: hypeman-go-staging hypeman-ts-staging
64-
SDK_TARGETS: go,typescript
63+
SDK_REPOS: hypeman-go-staging hypeman-python-staging hypeman-ts-staging
64+
SDK_TARGETS: go,python,typescript
6565

6666
jobs:
6767
guard:
@@ -170,7 +170,7 @@ jobs:
170170
app-id: ${{ secrets.ADMIN_APP_ID }}
171171
private-key: ${{ secrets.ADMIN_APP_PRIVATE_KEY }}
172172
owner: ${{ github.repository_owner }}
173-
repositories: hypeman-go,hypeman-ts,hypeman-go-staging,hypeman-ts-staging
173+
repositories: hypeman-go,hypeman-python,hypeman-ts,hypeman-go-staging,hypeman-python-staging,hypeman-ts-staging
174174
permission-contents: write
175175
permission-workflows: write
176176
permission-pull-requests: write
@@ -420,7 +420,7 @@ jobs:
420420
app-id: ${{ secrets.ADMIN_APP_ID }}
421421
private-key: ${{ secrets.ADMIN_APP_PRIVATE_KEY }}
422422
owner: ${{ github.repository_owner }}
423-
repositories: hypeman-go-staging,hypeman-ts-staging
423+
repositories: hypeman-go-staging,hypeman-python-staging,hypeman-ts-staging
424424
permission-contents: write
425425

426426
- name: Delete the preview branches

docs/runbooks/sdk-generation-stlc.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
# SDK generation with stlc
22

3-
Hypeman's Go and TypeScript SDKs are generated by
3+
Hypeman's Go, Python, and TypeScript SDKs are generated by
44
`.github/workflows/stlc-generate.yml` from `openapi.yaml` and `stainless.yaml`.
55

66
## Flow
77

8-
1. A config-repo PR generates `stlc/preview/pr-<number>` branches in the two
8+
1. A config-repo PR generates `stlc/preview/pr-<number>` branches in the three
99
internal SDK staging repositories and posts one build-manifest comment.
1010
2. Merging the config PR validates the integrated SDKs and pushes staging
1111
`main` only after bootstrap, lint, tests, and clean-worktree checks pass.
@@ -36,8 +36,8 @@ gh workflow run stlc-generate.yml --ref <branch> -f integration_test=true
3636
```
3737

3838
The run creates a unique `stlc/integration-test/run-<run-id>` branch and draft
39-
PR in both staging repos. Never merge these PRs; close them and delete their
40-
branches after review.
39+
PR in all three staging repos. Never merge these PRs; close them and delete
40+
their branches after review.
4141

4242
## Custom code and recovery
4343

@@ -71,4 +71,4 @@ rerun full SDK validation.
7171

7272
Remove hosted-only secrets and uninstall the Stainless GitHub App only after a
7373
complete preview → staging → promotion → release-please → publish → back-sync
74-
round trip succeeds for both SDKs.
74+
round trip succeeds for all three SDKs.

stainless.yaml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,16 @@ targets:
2929
prerelease: false
3030
options:
3131
enable_v2: true
32+
python:
33+
package_name: hypeman
34+
production_repo: kernel/hypeman-python
35+
staging_repo: kernel/hypeman-python-staging
36+
publish:
37+
pypi: true
38+
release:
39+
branch: main
40+
prerelease: false
41+
project_name: hypeman
3242
typescript:
3343
edition: typescript.2025-10-10
3444
package_name: "@onkernel/hypeman"

0 commit comments

Comments
 (0)