Metadata-Version: 2.5
Name: vibeinfra-sdk
Version: 0.1.0
Summary: Official Python SDK for the VibeInfra API - browse the SRE incident catalog, read live sandbox capacity and track learner progress.
Project-URL: Homepage, https://vibeinfra.id
Project-URL: Documentation, https://vibeinfra.id/docs/api/
Project-URL: Developer Portal, https://vibeinfra.id/developers/
Project-URL: OpenAPI Description, https://vibeinfra.id/openapi.json
Project-URL: Source, https://github.com/ridwansswnto/vibeinfraid
Project-URL: Issues, https://github.com/ridwansswnto/vibeinfraid/issues
Author-email: VibeInfra <hello@vibeinfra.id>
License: MIT
License-File: LICENSE
Keywords: api-client,devops,incident-response,infrastructure,kubernetes,observability,sdk,sre,vibeinfra
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: Intended Audience :: System Administrators
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3 :: Only
Classifier: Topic :: Education
Classifier: Topic :: System :: Systems Administration
Classifier: Typing :: Typed
Requires-Python: >=3.9
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == 'dev'
Description-Content-Type: text/markdown

# vibeinfra

Official Python client for the [VibeInfra](https://vibeinfra.id) API.

VibeInfra is a learn-by-doing infrastructure engineering platform: engineers troubleshoot
realistic production incidents — Linux kernel, Docker, Kubernetes, Nginx, PostgreSQL, Kafka,
AWS — inside live disposable multi-container sandboxes with automated grading.

The entire catalog surface is **unauthenticated**, so reading it needs no credentials.

## Install

```bash
pip install vibeinfra
```

Requires Python 3.9+. Standard library only — no transitive dependencies.

## Quick start

```python
from vibeinfra import VibeInfra

vibe = VibeInfra()

# Every incident and course in the catalog.
for course in vibe.list_courses():
    print(course["id"], course["title"])

# One blueprint, including objectives and tech stack.
incident = vibe.get_course("incident-22-k8s-crashloop")

# Find something to work on.
kafka = vibe.search_courses(query="kafka", difficulty="Expert")

# Is the platform busy right now?
print(vibe.get_capacity()["queue_length"])
```

## Authenticated calls

Learner-scoped endpoints take the session JWT minted by the GitHub/Google OAuth callback:

```python
import os

vibe = VibeInfra(token=os.environ["VIBEINFRA_TOKEN"])
vibe.list_completions()
```

## Constructor arguments

| Argument   | Default                    | Purpose                                       |
| ---------- | -------------------------- | --------------------------------------------- |
| `base_url` | `https://api.vibeinfra.id` | Point at a local backend during development.   |
| `token`    | `None`                     | Session JWT, sent as `Authorization: Bearer`.  |
| `timeout`  | `15.0`                     | Per-request timeout, in seconds.               |
| `opener`   | default urllib opener      | Injected transport, for tests and proxies.     |

## Errors

- `VibeInfraApiError` — the server answered with a non-2xx status. Carries `status`, `url`,
  the decoded `body`, and the `is_unauthorized` / `is_rate_limited` properties.
- `VibeInfraNetworkError` — the request never reached the server, or the timeout fired. The
  original failure is on `__cause__`.

Both subclass `VibeInfraError`, so `except VibeInfraError` catches everything this client raises.

## Methods

**Catalog** — `list_courses`, `get_course`, `search_courses`, `get_glossary`, `list_credit_packs`
**Platform** — `get_health`, `get_capacity`, `get_public_settings`, `get_public_telemetry`, `get_leaderboard`
**Labs & account** — `start_lab`, `get_session`, `get_profile`, `list_completions`

`search_courses` filters client-side: the API has no search endpoint because the catalog is
small enough to fetch whole.

## Related

- API reference — <https://vibeinfra.id/docs/api/>
- OpenAPI description — <https://vibeinfra.id/openapi.json>
- MCP server (`@vibeinfra/mcp-server`) — <https://vibeinfra.id/docs/mcp/>
- Developer portal — <https://vibeinfra.id/developers/>

## Development

```bash
pip install -e ".[dev]"
pytest
```

## License

MIT
