Metadata-Version: 2.4
Name: archastro-sdk
Version: 0.1.1
Summary: Python SDK for the ArchAstro Platform API
Project-URL: Homepage, https://github.com/ArchAstro/archastro-python
Project-URL: Repository, https://github.com/ArchAstro/archastro-python
Project-URL: Issues, https://github.com/ArchAstro/archastro-python/issues
Author-email: ArchAstro <support@archastro.ai>
License: MIT License
        
        Copyright (c) 2026 ArchAstro Inc.
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: api,archastro,phoenix-channels,sdk
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: Operating System :: OS Independent
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Classifier: Typing :: Typed
Requires-Python: >=3.11
Requires-Dist: httpx>=0.27
Requires-Dist: pydantic>=2.0
Requires-Dist: websockets>=13.0
Provides-Extra: dev
Requires-Dist: hatchling>=1.27; extra == 'dev'
Requires-Dist: pytest-asyncio>=0.24; extra == 'dev'
Requires-Dist: pytest>=8.0; extra == 'dev'
Requires-Dist: ruff>=0.11; extra == 'dev'
Description-Content-Type: text/markdown

# archastro-python

Python SDK for the ArchAstro Platform API.

```bash
uv add archastro-sdk      # or: pip install archastro-sdk
```

```python
from archastro import ArchAstro

client = ArchAstro(api_key="pk_...")
teams = client.v1.teams.list()
```

## Packages

All public code lives under the single top-level `archastro` package:

- **`archastro.platform`** — typed REST + channel SDK generated from
  the canonical OpenAPI spec at
  [`ArchAstro/archastro-openapi`](https://github.com/ArchAstro/archastro-openapi).
  Pydantic models, async channel classes, auth helpers.
- **`archastro.phx_channel`** — the hand-written Phoenix Channels
  client the generated channel classes run on top of. WebSocket
  transport, join / reply / push / leave, heartbeat, reconnect, and a
  `HarnessServiceClient` for driving the
  [`@archastro/channel-harness`](https://www.npmjs.com/package/@archastro/channel-harness)
  service from Python tests.

## Development

This repo contains:

- Python SDK (`src/archastro/`) installed via `uv`
- JS tooling (`package.json`) — the channel-harness subprocess that
  powers the channel contract tests, plus the Prism mock server that
  backs the REST contract tests. Installed via `npm ci`.

### Setup

```bash
npm ci --ignore-scripts  # channel-harness + prism (for contract tests)
uv sync --locked --all-extras
```

### Running tests

```bash
# Unit tests only (no external services needed)
uv run pytest tests/test_http_client.py src/archastro/phx_channel/tests/test_unit.py

# REST contract tests (spawns Prism mock server)
uv run pytest tests/contract

# REST + channel contract tests (also spawns channel-harness subprocess)
ARCHASTRO_RUN_CHANNEL_CONTRACT_TESTS=1 uv run pytest tests/contract
```

### Regenerating the SDK

The typed SDK — `src/archastro/platform/` and `tests/contract/` — is
regenerated from the canonical OpenAPI spec by
[`@archastro/sdk-generator`](https://www.npmjs.com/package/@archastro/sdk-generator).
Don't hand-edit files with the `auto-generated by @archastro/sdk-generator`
header; they'll be overwritten.

```bash
./scripts/regenerate_sdk.sh
```

The script fetches the spec from `ArchAstro/archastro-openapi@main` and
runs the generator locked in `package-lock.json`. Knobs:

- `ARCHASTRO_OPENAPI_REF=some-branch ./scripts/regenerate_sdk.sh` — pull
  the spec from a non-default ref (useful when a spec change is on a
  branch awaiting merge).

After regenerating, review the diff, run the full test suite, and commit.

## Release

```bash
# bump version in pyproject.toml, then:
uv sync --locked --all-extras
uv build --no-build-isolation
uv publish
```
