diff --git a/.env.example b/.env.example index 6c6d28e..9af10f7 100644 --- a/.env.example +++ b/.env.example @@ -13,7 +13,7 @@ DEAPI_API_KEY=sk-dp-- # Set to 0 to stop the SDK filling unset parameters from the model card defaults # DEAPI_FILL_MODEL_DEFAULTS=1 -# Real-time status over WebSocket (pip install "deapi-sdk[ws] @ git+https://github.com/deapi-ai/deapi-python-sdk.git") +# Real-time status over WebSocket (pip install "deapi-sdk[ws]") # All optional: anything unset is fetched from the API (GET /websocket) when the connection opens. # The "Client ID" shown in your dashboard; pass client_id= explicitly when serving many users # DEAPI_CLIENT_ID=your-client-id diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..6b02155 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,56 @@ +name: Release + +# Publishing a GitHub Release (tag vX.Y.Z) builds the package and uploads it to PyPI. +# Uploads use PyPI trusted publishing (OIDC): no API token is stored in the repository. +on: + release: + types: [published] + +permissions: + contents: read + +jobs: + build: + name: build distributions + runs-on: ubuntu-24.04 + steps: + - uses: actions/checkout@v7 + with: + persist-credentials: false + - uses: actions/setup-python@v7 + with: + python-version: "3.11" + - name: Check that the tag matches the package version + env: + TAG: ${{ github.event.release.tag_name }} + run: | + version=$(python -c "import tomllib; print(tomllib.load(open('pyproject.toml', 'rb'))['project']['version'])") + if [ "$TAG" != "v$version" ]; then + echo "Release tag $TAG does not match pyproject version v$version" >&2 + exit 1 + fi + - name: Build + run: | + python -m pip install build twine + python -m build + python -m twine check --strict dist/* + - uses: actions/upload-artifact@v4 + with: + name: dist + path: dist/ + + publish: + name: publish to PyPI + needs: build + runs-on: ubuntu-24.04 + environment: + name: pypi + url: https://pypi.org/project/deapi-sdk/ + permissions: + id-token: write # trusted publishing + steps: + - uses: actions/download-artifact@v4 + with: + name: dist + path: dist/ + - uses: pypa/gh-action-pypi-publish@release/v1 diff --git a/CHANGELOG.md b/CHANGELOG.md index 8b96f0d..8f04be5 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -3,6 +3,18 @@ All notable changes to this project are documented in this file. Versions follow [Semantic Versioning](https://semver.org/) (pre-1.0: minor versions may contain breaking changes). +## [0.6.1] - 2026-11-19 + +### Added + +- Published on PyPI: `pip install deapi-sdk` (`pip install "deapi-sdk[ws]"` for real-time status). + Releases are uploaded by GitHub Actions when a GitHub Release is published. + +### Changed + +- README links are absolute, so they also work on the PyPI project page. +- The product name is spelled deAPI throughout the docs and docstrings. + ## [0.6.0] - 2026-11-19 ### Added diff --git a/README.md b/README.md index bb538de..4371f99 100644 --- a/README.md +++ b/README.md @@ -29,20 +29,19 @@ Generate images, videos, audio, transcriptions, embeddings, and more — all thr ## Installation -The SDK is **not on PyPI yet**. Install it straight from GitHub: - ```bash -pip install git+https://github.com/deapi-ai/deapi-python-sdk.git -# or pin a branch, tag or commit: -pip install git+https://github.com/deapi-ai/deapi-python-sdk.git@main +pip install deapi-sdk ``` Real-time job updates over WebSocket need the optional `ws` extra (installs `websockets`): ```bash -pip install "deapi-sdk[ws] @ git+https://github.com/deapi-ai/deapi-python-sdk.git" +pip install "deapi-sdk[ws]" ``` +The latest unreleased code can be installed straight from GitHub: +`pip install git+https://github.com/deapi-ai/deapi-python-sdk.git@main`. + > `pip install deapi` installs an **unrelated** package. Do not use it. For development (`pytest` runs from the repo root): @@ -432,7 +431,7 @@ async with AsyncDeapiClient() as client: discovery call raises the usual API exception (for example `AuthenticationError`); an unusable response raises `RealtimeError`. -See [`examples/realtime_status.py`](examples/realtime_status.py). +See [`examples/realtime_status.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/realtime_status.py). ## Error Handling @@ -580,23 +579,23 @@ async def handle_webhook(request: Request): ## API Reference -See [docs/api-reference.md](docs/api-reference.md) for method signatures, parameters and return +See [docs/api-reference.md](https://github.com/deapi-ai/deapi-python-sdk/blob/main/docs/api-reference.md) for method signatures, parameters and return types, and [docs.deapi.ai](https://docs.deapi.ai) for the HTTP API. ## Examples -The [`examples/`](examples/) directory contains runnable scripts: +The [`examples/`](https://github.com/deapi-ai/deapi-python-sdk/tree/main/examples) directory contains runnable scripts: | File | Description | |------|-------------| -| [`basic_image.py`](examples/basic_image.py) | Image generation, transformation, upscale | -| [`async_batch.py`](examples/async_batch.py) | Concurrent async job submission | -| [`transcription.py`](examples/transcription.py) | Transcription with JSON and plain-text transcripts | -| [`tts_and_audio.py`](examples/tts_and_audio.py) | Text-to-speech and music generation | -| [`video_generation.py`](examples/video_generation.py) | Text-to-video and image-to-video | -| [`realtime_status.py`](examples/realtime_status.py) | Live job progress over WebSocket | -| [`webhook_server.py`](examples/webhook_server.py) | Flask webhook receiver with signature verification | -| [`error_handling.py`](examples/error_handling.py) | Error handling patterns and best practices | +| [`basic_image.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/basic_image.py) | Image generation, transformation, upscale | +| [`async_batch.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/async_batch.py) | Concurrent async job submission | +| [`transcription.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/transcription.py) | Transcription with JSON and plain-text transcripts | +| [`tts_and_audio.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/tts_and_audio.py) | Text-to-speech and music generation | +| [`video_generation.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/video_generation.py) | Text-to-video and image-to-video | +| [`realtime_status.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/realtime_status.py) | Live job progress over WebSocket | +| [`webhook_server.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/webhook_server.py) | Flask webhook receiver with signature verification | +| [`error_handling.py`](https://github.com/deapi-ai/deapi-python-sdk/blob/main/examples/error_handling.py) | Error handling patterns and best practices | ## Requirements @@ -607,4 +606,4 @@ The [`examples/`](examples/) directory contains runnable scripts: ## License -MIT — see [LICENSE](LICENSE) for details. +MIT — see [LICENSE](https://github.com/deapi-ai/deapi-python-sdk/blob/main/LICENSE) for details. diff --git a/docs/api-reference.md b/docs/api-reference.md index 3148692..dbc6ced 100644 --- a/docs/api-reference.md +++ b/docs/api-reference.md @@ -3,8 +3,7 @@ Reference for the classes, methods and types in the `deapi_sdk` package. It describes deAPI API **v2**, the only version supported since 0.4.0 (see [Upgrading to 0.5.0](../README.md#upgrading-to-050) and [Upgrading to 0.4.0](../README.md#upgrading-to-040) for the breaking changes). The HTTP API itself is documented at . -Install: `pip install git+https://github.com/deapi-ai/deapi-python-sdk.git` (not on PyPI yet; -`pip install deapi` is an unrelated package). +Install: `pip install deapi-sdk` (`pip install deapi` is an unrelated package). ## Table of Contents @@ -563,7 +562,7 @@ has the same interface with `async` methods. ## Realtime (WebSocket) Live job status over one WebSocket connection. Needs the optional extra: -`pip install "deapi-sdk[ws] @ git+https://github.com/deapi-ai/deapi-python-sdk.git"` (installs +`pip install "deapi-sdk[ws]"` (installs `websockets` 17.x). Without it, connecting raises `ImportError`. ### `client.realtime()` diff --git a/examples/realtime_status.py b/examples/realtime_status.py index c4622c0..6169b67 100644 --- a/examples/realtime_status.py +++ b/examples/realtime_status.py @@ -4,7 +4,7 @@ With --watch it just prints every status event on your channel (all of your jobs). Requires the optional extra: - pip install "deapi-sdk[ws] @ git+https://github.com/deapi-ai/deapi-python-sdk.git" + pip install "deapi-sdk[ws]" Usage: export DEAPI_API_KEY="sk-dp--" diff --git a/pyproject.toml b/pyproject.toml index cf0891b..40c1519 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ build-backend = "hatchling.build" [project] name = "deapi-sdk" -version = "0.6.0" +version = "0.6.1" description = "Official Python SDK for deAPI — distributed AI inference platform" readme = "README.md" license = "MIT" @@ -14,7 +14,7 @@ authors = [ ] keywords = ["deapi", "ai", "inference", "sdk", "stable-diffusion", "whisper", "tts"] classifiers = [ - "Development Status :: 3 - Alpha", + "Development Status :: 4 - Beta", "Intended Audience :: Developers", "License :: OSI Approved :: MIT License", "Programming Language :: Python :: 3", @@ -49,6 +49,9 @@ Documentation = "https://docs.deapi.ai/other/sdks-and-integrations" Repository = "https://github.com/deapi-ai/deapi-python-sdk" Changelog = "https://github.com/deapi-ai/deapi-python-sdk/blob/main/CHANGELOG.md" +[tool.hatch.build.targets.sdist] +include = ["src", "tests", "docs", "examples", "README.md", "CHANGELOG.md", "LICENSE", "pyproject.toml"] + [tool.hatch.build.targets.wheel] packages = ["src/deapi_sdk"] diff --git a/src/deapi_sdk/_version.py b/src/deapi_sdk/_version.py index 34157b2..9e3ae3d 100644 --- a/src/deapi_sdk/_version.py +++ b/src/deapi_sdk/_version.py @@ -1,3 +1,3 @@ from __future__ import annotations -__version__ = "0.6.0" +__version__ = "0.6.1"