Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
30 changes: 30 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

> **Remember to shutdown a GitHub Codespace when it is not in use!**

# Dev Containers Quick Start

The default location for usage snippets is the `samples` directory.

## Running a Usage Sample

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.

```
python root.py
```

## Generating Additional Usage Samples

The speakeasy CLI allows you to generate more usage snippets. Here's how:

- To generate a sample for a specific operation by providing an operation ID, use:

```
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -i {INPUT_OPERATION_ID} -o ./samples
```

- To generate samples for an entire namespace (like a tag or group name), use:

```
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -n {INPUT_TAG_NAME} -o ./samples
```
40 changes: 40 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/images/tree/main/src/python
{
"name": "Python",
"image": "mcr.microsoft.com/devcontainers/python:1-3.11-bullseye",
// Features to add to the dev container. More info: https://containers.dev/features.
"features": {
"ghcr.io/astral-sh/devcontainer-features/uv:latest": {}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
"postCreateCommand": "sudo chmod +x ./.devcontainer/setup.sh && ./.devcontainer/setup.sh",
"customizations": {
"vscode": {
"extensions": [
"ms-python.python",
"ms-python.vscode-pylance",
"github.vscode-pull-request-github"
],
"settings": {
"files.eol": "\n",
"editor.formatOnSave": true,
"python.formatting.provider": "black",
"python.linting.enabled": true,
"python.linting.pylintEnabled": true,
"python.linting.flake8Enabled": true,
"python.linting.banditEnabled": true,
"python.testing.pytestEnabled": true
}
},
"codespaces": {
"openFiles": [
".devcontainer/README.md"
]
}
}
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
14 changes: 14 additions & 0 deletions .devcontainer/setup.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
#!/bin/bash

# Install the speakeasy CLI
curl -fsSL https://raw.githubusercontent.com/speakeasy-api/speakeasy/main/install.sh | sh

# Setup samples directory
rmdir samples || true
mkdir samples


uv sync --dev

# Generate starter usage sample with speakeasy
speakeasy generate usage -s .speakeasy/out.openapi.yaml -l python -o samples/root.py
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# This allows generated code to be indexed correctly
*.py linguist-generated=false
30 changes: 30 additions & 0 deletions .github/workflows/sdk_generation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Generate
permissions:
checks: write
contents: write
pull-requests: write
statuses: write
id-token: write
"on":
workflow_dispatch:
inputs:
force:
description: Force generation of SDKs
type: boolean
default: false
set_version:
description: optionally set a specific SDK version
type: string
schedule:
- cron: 0 0 * * *
jobs:
generate:
uses: speakeasy-api/sdk-generation-action/.github/workflows/workflow-executor.yaml@v15
with:
force: ${{ github.event.inputs.force }}
mode: pr
set_version: ${{ github.event.inputs.set_version }}
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
23 changes: 23 additions & 0 deletions .github/workflows/sdk_publish.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Publish
permissions:
checks: write
contents: write
pull-requests: write
statuses: write
id-token: write
"on":
push:
branches:
- main
paths:
- .speakeasy/gen.lock
workflow_dispatch: {}
jobs:
publish:
uses: speakeasy-api/sdk-generation-action/.github/workflows/sdk-publish.yaml@v15
with:
target: data-api
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
pypi_token: ${{ secrets.PYPI_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
19 changes: 19 additions & 0 deletions .github/workflows/tagging.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
gitname: Speakeasy Tagging
permissions:
checks: write
contents: write
pull-requests: write
statuses: write
"on":
push:
branches:
- main
workflow_dispatch: {}
jobs:
tag:
uses: speakeasy-api/sdk-generation-action/.github/workflows/tag.yaml@v15
with:
registry_tags: main
secrets:
github_access_token: ${{ secrets.GITHUB_TOKEN }}
speakeasy_api_key: ${{ secrets.SPEAKEASY_API_KEY }}
32 changes: 32 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Python
.venv/
venv/
src/*.egg-info/
**/__pycache__/
.pytest_cache/
.python-version
pyrightconfig.json
*.pyc
*.pyo
*.pyd
__pycache__/
*.so
*.egg
*.egg-info/
dist/
build/
# Environment
.env
.env.local
.env.example
# IDE
.DS_Store
.vscode/
.idea/
# Speakeasy
**/.speakeasy/temp/
**/.speakeasy/logs/
.speakeasy/reports
# Testing examples (don't commit)
load_env.sh
restructure.sh
Loading