Skip to content
Open
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
70 changes: 70 additions & 0 deletions .claude/skills/scalar-api-python-sdk/SKILL.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
---
name: scalar-api-python-sdk
description: "Python SDK for Scalar API. Use when writing Python code that calls Scalar API with the scalar-sdk package: installing it, constructing and authenticating the client, and calling API operations."
---

# Scalar API Python SDK

Generated Python client for Scalar API, published as `scalar-sdk`. Use the generated client instead of hand-writing HTTP requests.

## Install

```sh
pip install scalar-sdk
```

## Client setup and authentication

```python
import os

from scalar_sdk import Scalar

client = Scalar(
bearer_auth=os.environ.get("BEARER_AUTH"),
)
```

Provide credentials using the options below. Environment variables are read automatically when the target runtime supports them:

- `bearer_auth` (env: `BEARER_AUTH`) — Credential for the BearerAuth scheme.

## Calling operations

```python
import os

from scalar_sdk import Scalar

client = Scalar(
bearer_auth=os.environ.get("BEARER_AUTH"),
)

registry = client.registry.list_all_api_documents()
print(registry)
```

Method names, parameter shapes, and response types are generated from the API description — do not guess them. Look up the exact call signature in [api.md](../../../api.md) before writing a call.

## Error handling

Non-success responses throw generated API errors. Error objects expose status, headers, response body, and request metadata where the target runtime supports it.

```python
from scalar_sdk import APIStatusError

try:
registry = client.registry.list_all_api_documents()
except APIStatusError as err:
print(err.status_code, err.message)
raise
```

## Requirements

- Python 3.8 or newer

## Reference files

- [README.md](../../../README.md) — full feature tour: client options, request options, retries and timeouts, logging.
- [api.md](../../../api.md) — complete catalogue of every operation with request and response types.
32 changes: 27 additions & 5 deletions .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@ jobs:
runs-on: ubuntu-latest
outputs:
release_created: ${{ steps.release.outputs.release_created }}
# Consumed by the publish job's dispatch: without this mapping the dispatch ref would
# be empty, and `gh workflow run --ref ""` silently falls back to the default branch
# instead of the released tag.
tag_name: ${{ steps.release.outputs.tag_name }}
steps:
- uses: googleapis/release-please-action@45996ed1f6d02564a971a2fa1b5860e934307cf7 # v5.0.0
id: release
Expand Down Expand Up @@ -54,9 +58,27 @@ jobs:
publish:
needs: release-please
if: ${{ !cancelled() && needs.release-please.outputs.release_created == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
packages: write
uses: ./.github/workflows/sdk-release.yml
secrets: inherit
actions: write
steps:
- name: Publish via the release workflow at the released tag
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ needs.release-please.outputs.tag_name }}
# Dispatch, then watch the run to completion: the dispatch API does not return the run
# it created, so the newest workflow_dispatch run on the tag is polled into view (the
# tag is unique per release, so it can only be this dispatch or an identical manual
# re-publish) and a failed or missing run fails this job loudly.
run: |
gh workflow run sdk-release.yml --repo "${GITHUB_REPOSITORY}" --ref "${TAG}"
for _ in $(seq 1 12); do
sleep 5
run_id="$(gh run list --repo "${GITHUB_REPOSITORY}" --workflow sdk-release.yml --event workflow_dispatch --branch "${TAG}" --json databaseId --jq '.[0].databaseId // empty')"
[ -n "${run_id}" ] && break
done
if [ -z "${run_id}" ]; then
echo "::error::sdk-release.yml was dispatched for ${TAG} but no run appeared."
exit 1
fi
gh run watch "${run_id}" --repo "${GITHUB_REPOSITORY}" --exit-status
7 changes: 4 additions & 3 deletions .github/workflows/sdk-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,11 @@ name: Python SDK Release
on:
release:
types: [published]
# Dispatched by release-please.yml at the released tag (the trigger a default-GITHUB_TOKEN
# release can still reach), and available for manual re-publishes. A dispatched run is
# top-level, keeping the OIDC trusted-publisher claims on this file; never add a
# workflow_call trigger here — registries reject publishes from called (reusable) workflows.
workflow_dispatch:
# Called by release-please.yml at the released commit; the trigger the default
# GITHUB_TOKEN can actually reach (token-created releases never fire `release`).
workflow_call:

permissions:
contents: read
Expand Down
2 changes: 1 addition & 1 deletion .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
{
".": "0.2.0"
".": "0.3.0"
}
Loading
Loading