mirror of
https://github.com/aljazceru/opencode.git
synced 2026-02-03 15:15:08 +01:00
big format
This commit is contained in:
@@ -3,10 +3,12 @@
|
||||
The SDK is generated from the Opencode server's OpenAPI 3.1 spec.
|
||||
|
||||
Two source modes are supported:
|
||||
|
||||
- CLI (default): runs `bun dev generate` to emit the OpenAPI JSON
|
||||
- Server: fetches `http://localhost:4096/doc` from a running server
|
||||
|
||||
Generator command
|
||||
|
||||
```bash
|
||||
# From repo root
|
||||
uv run --project packages/sdk/python python packages/sdk/python/scripts/generate.py --source cli
|
||||
@@ -15,5 +17,6 @@ uv run --project packages/sdk/python python packages/sdk/python/scripts/generate
|
||||
```
|
||||
|
||||
Post-generation
|
||||
|
||||
- The generator injects `extras.py` (OpenCodeClient) and patches `__init__.py` to export it
|
||||
- Code is formatted with `ruff` (imports) and `black`
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
The official Python client for the Opencode API, generated from the OpenAPI spec and extended with ergonomic helpers.
|
||||
|
||||
Highlights
|
||||
|
||||
- Provider-agnostic client generated from OpenAPI 3.1
|
||||
- Thin convenience wrapper (OpenCodeClient) for common tasks
|
||||
- Sync and async SSE streaming for live event feeds
|
||||
|
||||
@@ -1,26 +1,31 @@
|
||||
# Installation
|
||||
|
||||
Requirements
|
||||
|
||||
- Python 3.8+
|
||||
- uv (recommended) -> https://docs.astral.sh/uv/
|
||||
|
||||
Install uv
|
||||
|
||||
```bash
|
||||
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||
```
|
||||
|
||||
Project setup
|
||||
|
||||
```bash
|
||||
# From repo root or this directory
|
||||
uv sync --dev --project packages/sdk/python
|
||||
```
|
||||
|
||||
Using pip (alternative)
|
||||
|
||||
```bash
|
||||
pip install opencode-ai
|
||||
```
|
||||
|
||||
Preview docs locally
|
||||
|
||||
```bash
|
||||
# From repo root
|
||||
uv run --project packages/sdk/python mkdocs serve -f packages/sdk/python/mkdocs.yml
|
||||
|
||||
@@ -3,6 +3,7 @@
|
||||
Automated publishing runs on GitHub Releases.
|
||||
|
||||
Workflow
|
||||
|
||||
- Create a new Release (the tag value becomes the package version)
|
||||
- The `publish-python-sdk` workflow will:
|
||||
- Generate the SDK from OpenAPI (CLI path)
|
||||
@@ -10,9 +11,11 @@ Workflow
|
||||
- Build wheel/sdist and upload to PyPI
|
||||
|
||||
Prerequisites
|
||||
|
||||
- Repository secret: `PYPI_API_TOKEN`
|
||||
|
||||
Manual publish
|
||||
|
||||
```bash
|
||||
# TestPyPI
|
||||
REPOSITORY=testpypi PYPI_TOKEN=$TEST_PYPI_API_TOKEN \
|
||||
|
||||
@@ -11,5 +11,6 @@ uv run --project packages/sdk/python pytest -q
|
||||
```
|
||||
|
||||
Notes
|
||||
|
||||
- Integration test starts a headless opencode server via Bun in a subprocess
|
||||
- SSE behavior is validated using real streaming from the server
|
||||
|
||||
Reference in New Issue
Block a user