diff --git a/.release-please-manifest.json b/.release-please-manifest.json index 6b7b74c..cce9240 100644 --- a/.release-please-manifest.json +++ b/.release-please-manifest.json @@ -1,3 +1,3 @@ { - ".": "0.3.0" + ".": "0.3.1" } \ No newline at end of file diff --git a/CHANGELOG.md b/CHANGELOG.md index b3df9a5..6dc892d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,13 @@ # Changelog +## 0.3.1 (2026-01-07) + +Full Changelog: [v0.3.0...v0.3.1](https://github.com/warpdotdev/warp-sdk-python/compare/v0.3.0...v0.3.1) + +### Documentation + +* **dev:** Add WARP.md file ([7f1b835](https://github.com/warpdotdev/warp-sdk-python/commit/7f1b835240574dc517d424dca84251f86c4b1276)) + ## 0.3.0 (2026-01-05) Full Changelog: [v0.2.1...v0.3.0](https://github.com/warpdotdev/warp-sdk-python/compare/v0.2.1...v0.3.0) diff --git a/WARP.md b/WARP.md new file mode 100644 index 0000000..1cf8a11 --- /dev/null +++ b/WARP.md @@ -0,0 +1,119 @@ +# WARP.md + +This file provides guidance to WARP (warp.dev) when working with code in this repository. + +## Repository Overview + +This is the official Python SDK for the Warp API, providing convenient access to the Warp API REST API. The SDK is **generated code** created using [Stainless](https://www.stainless.com/) from an OpenAPI specification. Most files are auto-generated, with exceptions for `src/warp_agent_sdk/lib/` and `examples/` directories which are manually maintained. + +## Development Commands + +### Setup +```bash +# Bootstrap the development environment (installs uv, Python, and dependencies) +./scripts/bootstrap +``` + +### Testing +```bash +# Run full test suite (tests with both Pydantic v1 and v2, multiple Python versions) +./scripts/test + +# Run specific tests +uv run pytest tests/test_client.py + +# Tests require a mock Prism server running on port 4010 +# The test script will automatically start one if not running +# To manually start: ./scripts/mock --daemon +``` + +### Linting and Type Checking +```bash +# Run all linters (ruff, pyright, mypy) +./scripts/lint + +# Run with auto-fix +./scripts/lint --fix + +# Format code +./scripts/format +``` + +### Building +```bash +# Build distribution packages (.tar.gz and .whl) +uv build +``` + +## Code Architecture + +### Generated vs Manual Code + +**Generated code** (DO NOT manually edit - changes will be overwritten): +- `src/warp_agent_sdk/_client.py` - Main client classes (WarpAPI, AsyncWarpAPI) +- `src/warp_agent_sdk/resources/` - API resource classes +- `src/warp_agent_sdk/types/` - Type definitions and models +- Most utility files in `src/warp_agent_sdk/_utils/` + +**Manual code** (safe to edit): +- `src/warp_agent_sdk/lib/` - Custom library code +- `examples/` - Example scripts +- `tests/` - Test files + +### Core Components + +**Client Architecture**: +- `WarpAPI` (sync) and `AsyncWarpAPI` (async) are the main entry points +- Both inherit from `SyncAPIClient` and `AsyncAPIClient` base classes +- Support for both `httpx` (default) and `aiohttp` (optional) HTTP backends +- API key authentication via `Authorization: Bearer` header +- Default base URL: `https://app.warp.dev/api/v1` + +**Resource Structure**: +- Resources are organized hierarchically (e.g., `client.agent.tasks.retrieve()`) +- Each resource has sync/async variants and raw/streaming response wrappers +- Main resource: `AgentResource` with `run()` method and nested `TasksResource` + +**Type System**: +- Uses Pydantic models for request/response validation +- TypedDict for nested parameters +- Custom types: `NotGiven`, `Omit` for optional parameters +- Supports both Pydantic v1 and v2 + +## Environment Variables + +- `WARP_API_KEY` - API key for authentication (required) +- `WARP_API_BASE_URL` - Override default base URL +- `WARP_API_LOG` - Enable logging (`info` or `debug`) +- `TEST_API_BASE_URL` - Use custom API endpoint for tests + +## Testing Conventions + +- Tests use `pytest` with `pytest-asyncio` for async tests +- Both sync and async variants must be tested +- Tests run against a mock Prism server based on OpenAPI spec +- Tests run with both Pydantic v1 and v2 on Python 3.9 and 3.14+ +- Use `respx` for mocking HTTP requests in tests + +## Development Workflow + +1. **Making changes**: + - Only edit files in `lib/` and `examples/` directories + - Other changes should be made to the OpenAPI spec and regenerated + +2. **Adding examples**: + - Create executable Python scripts in `examples/` + - Use shebang: `#!/usr/bin/env -S uv run python` + - Make executable: `chmod +x examples/.py` + +3. **Code quality**: + - Run `./scripts/format` before committing + - Ensure `./scripts/lint` passes + - Run `./scripts/test` to verify changes + +## Package Management + +- Uses [uv](https://docs.astral.sh/uv/) for fast, reliable dependency management +- `pyproject.toml` defines project metadata and dependencies +- `uv.lock` pins exact versions for reproducibility +- `requirements-dev.lock` exported for pip compatibility diff --git a/pyproject.toml b/pyproject.toml index f514cde..b55e866 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,6 +1,6 @@ [project] name = "warp-agent-sdk" -version = "0.3.0" +version = "0.3.1" description = "The official Python library for the warp-api API" dynamic = ["readme"] license = "Apache-2.0" diff --git a/src/warp_agent_sdk/_version.py b/src/warp_agent_sdk/_version.py index 3f8939a..d37705e 100644 --- a/src/warp_agent_sdk/_version.py +++ b/src/warp_agent_sdk/_version.py @@ -1,4 +1,4 @@ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. __title__ = "warp_agent_sdk" -__version__ = "0.3.0" # x-release-please-version +__version__ = "0.3.1" # x-release-please-version