Skip to content

Commit ec1c05d

Browse files
committed
Update to 1.0.0 with Speakeasy
1 parent f4b065d commit ec1c05d

852 files changed

Lines changed: 55474 additions & 16308 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.devcontainer/README.md

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
2+
> **Remember to shutdown a GitHub Codespace when it is not in use!**
3+
4+
# Dev Containers Quick Start
5+
6+
The default location for usage snippets is the `samples` directory.
7+
8+
## Running a Usage Sample
9+
10+
A sample usage example has been provided in a `root.py` file. As you work with the SDK, it's expected that you will modify these samples to fit your needs. To execute this particular snippet, use the command below.
11+
12+
```
13+
python root.py
14+
```
15+
16+
## Generating Additional Usage Samples
17+
18+
The speakeasy CLI allows you to generate more usage snippets. Here's how:
19+
20+
- To generate a sample for a specific operation by providing an operation ID, use:
21+
22+
```
23+
speakeasy generate usage -s ./test-overlay.yaml -l python -i {INPUT_OPERATION_ID} -o ./samples
24+
```
25+
26+
- To generate samples for an entire namespace (like a tag or group name), use:
27+
28+
```
29+
speakeasy generate usage -s ./test-overlay.yaml -l python -n {INPUT_TAG_NAME} -o ./samples
30+
```

.devcontainer/devcontainer.json

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
2+
// README at: https://github.com/devcontainers/images/tree/main/src/python
3+
{
4+
"name": "Python",
5+
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
6+
// Features to add to the dev container. More info: https://containers.dev/features.
7+
// "features": {},
8+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
9+
// "forwardPorts": [],
10+
// Use 'postCreateCommand' to run commands after the container is created.
11+
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
12+
"customizations": {
13+
"vscode": {
14+
"extensions": [
15+
"ms-python.python",
16+
"ms-python.vscode-pylance",
17+
"github.vscode-pull-request-github"
18+
],
19+
"settings": {
20+
"files.eol": "\n",
21+
"editor.formatOnSave": true,
22+
"python.formatting.provider": "black",
23+
"python.linting.enabled": true,
24+
"python.linting.pylintEnabled": true,
25+
"python.linting.flake8Enabled": true,
26+
"python.linting.banditEnabled": true,
27+
"python.testing.pytestEnabled": true
28+
}
29+
},
30+
"codespaces": {
31+
"openFiles": [
32+
".devcontainer/README.md"
33+
]
34+
}
35+
}
36+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
37+
// "remoteUser": "root"
38+
}

.devcontainer/setup.sh

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/bash
2+
3+
# Install the speakeasy CLI
4+
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
5+
6+
# Setup samples directory
7+
rmdir samples || true
8+
mkdir samples
9+
10+
python -m pip install --upgrade pip
11+
pip install -e .
12+
13+
# Generate starter usage sample with speakeasy
14+
speakeasy generate usage -s ./test-overlay.yaml -l python -o samples/root.py

.gitattributes

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# This allows generated code to be indexed correctly
2+
*.py linguist-generated=false

.github/workflows/generate-sdk.yml

Lines changed: 148 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,148 @@
1+
name: Generate SDK
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
create_pr:
7+
description: 'Create PR if changes are detected'
8+
type: boolean
9+
default: true
10+
target_branch:
11+
description: 'Target branch for PR (default: main)'
12+
type: string
13+
default: 'main'
14+
schedule:
15+
# Run weekly on Mondays at 9 AM UTC
16+
- cron: '0 9 * * 1'
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
22+
jobs:
23+
generate:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout repository
27+
uses: actions/checkout@v4
28+
with:
29+
token: ${{ secrets.GITHUB_TOKEN }}
30+
31+
- name: Setup Python
32+
uses: actions/setup-python@v4
33+
with:
34+
python-version: '3.9'
35+
36+
- name: Install UV
37+
uses: astral-sh/setup-uv@v3
38+
39+
- name: Install Python dependencies
40+
run: |
41+
uv sync --dev
42+
43+
- name: Install Speakeasy CLI
44+
run: |
45+
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh
46+
echo "$HOME/.speakeasy/bin" >> $GITHUB_PATH
47+
48+
- name: Verify Speakeasy installation
49+
run: speakeasy --version
50+
51+
- name: Generate SDK
52+
env:
53+
SPEAKEASY_API_KEY: ${{ secrets.SPEAKEASY_API_KEY }}
54+
run: |
55+
# Run the full generation process
56+
make generate
57+
58+
- name: Check for changes
59+
id: changes
60+
run: |
61+
if [ -n "$(git status --porcelain)" ]; then
62+
echo "changes=true" >> $GITHUB_OUTPUT
63+
echo "Changes detected:"
64+
git status --porcelain
65+
else
66+
echo "changes=false" >> $GITHUB_OUTPUT
67+
echo "No changes detected"
68+
fi
69+
70+
- name: Create Pull Request
71+
if: steps.changes.outputs.changes == 'true' && (github.event.inputs.create_pr == 'true' || github.event_name == 'schedule')
72+
env:
73+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
run: |
75+
# Configure git
76+
git config --global user.name "opper-bot"
77+
git config --global user.email "bot@opper.ai"
78+
79+
# Create a new branch with timestamp
80+
BRANCH_NAME="sdk-update-$(date +%Y%m%d-%H%M%S)"
81+
git checkout -b "$BRANCH_NAME"
82+
83+
# Stage and commit changes
84+
git add .
85+
git commit -m "chore: update SDK via automated generation
86+
87+
- Run speakeasy generation
88+
- Apply parameter name fixes
89+
- Apply schema conversion patches
90+
91+
Generated on: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
92+
93+
🤖 This PR was created automatically by the SDK generation workflow."
94+
95+
# Push the branch
96+
git push origin "$BRANCH_NAME"
97+
98+
# Create PR
99+
TARGET_BRANCH="${{ github.event.inputs.target_branch || 'main' }}"
100+
gh pr create \
101+
--title "🔄 Automated SDK Update - $(date +%Y-%m-%d)" \
102+
--body "$(cat <<'EOF'
103+
## 🤖 Automated SDK Generation
104+
105+
This PR contains updates from the latest SDK generation run.
106+
107+
### Changes Made
108+
- ✅ Speakeasy SDK generation
109+
- ✅ Parameter name fixes (input_ → input)
110+
- ✅ Schema conversion patches applied
111+
112+
### Generated Files
113+
The following files were automatically generated/updated:
114+
- `src/opperai/`
115+
- `docs/`
116+
- `README.md`
117+
- `USAGE.md`
118+
119+
### Review Checklist
120+
- [ ] Generated code looks correct
121+
- [ ] Examples still work
122+
- [ ] No breaking changes in public API
123+
- [ ] Version bump needed? (if so, update pyproject.toml)
124+
125+
---
126+
127+
Generated on: $(date -u +"%Y-%m-%d %H:%M:%S UTC")
128+
129+
🤖 Created by automated workflow
130+
EOF
131+
)" \
132+
--base "$TARGET_BRANCH" \
133+
--head "$BRANCH_NAME" \
134+
--label "automated" \
135+
--label "sdk-update"
136+
137+
- name: Summary
138+
run: |
139+
if [ "${{ steps.changes.outputs.changes }}" == "true" ]; then
140+
echo "✅ SDK generation completed with changes"
141+
if [ "${{ github.event.inputs.create_pr }}" == "true" ] || [ "${{ github.event_name }}" == "schedule" ]; then
142+
echo "📝 Pull request created"
143+
else
144+
echo "⚠️ Changes detected but PR creation skipped"
145+
fi
146+
else
147+
echo "✅ SDK generation completed - no changes needed"
148+
fi

.github/workflows/index.yml

Lines changed: 0 additions & 29 deletions
This file was deleted.

0 commit comments

Comments
 (0)