This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
# Install dependencies
poetry install
# Run all tests
poetry run pytest
# Run a single test file
poetry run pytest tests/test_language_detector.py
# Run a single test function
poetry run pytest tests/test_yepcode_run.py::test_run_python_code
# Run with coverage
poetry run pytest --cov=yepcode_run
# Build the package
poetry buildTests require a YEPCODE_API_TOKEN environment variable. Set it in .env or export it before running tests. Most tests are integration tests that hit the live YepCode cloud API.
The SDK is a thin Python client for executing code in YepCode's serverless runtime.
Layers:
- Public API —
YepCodeRun,YepCodeEnv,YepCodeStorage(inyepcode_run/) - Execution engine —
yepcode_run/run/execution.pyhandles polling loop, status transitions (CREATED → RUNNING → FINISHED/ERROR), and event callbacks (onLog,onFinish,onError) - API Manager —
yepcode_run/api/api_manager.pysingleton keyed by config hash; merges env vars + constructor params - HTTP client —
yepcode_run/api/yepcode_api.pyhandles auth (API token or JWT with auto-refresh), all REST calls
Key design decisions:
YepCodeRunhashes submitted code (SHA256) to reuse existing cloud processes rather than creating new ones each runYepCodeApiManageruses a singleton per config hash, so multipleYepCodeRuninstances with the same credentials share one API client- Language detection (
yepcode_run/utils/language_detector.py) uses a score-based heuristic on stripped code (comments removed) whenlanguageis not specified
Config priority: constructor params > environment variables > .env file. Key env vars: YEPCODE_API_TOKEN, YEPCODE_API_HOST (defaults to https://cloud.yepcode.io), YEPCODE_TIMEOUT (ms, default 60000).
The live spec is always available at https://cloud.yepcode.io/api/rest/public/api-docs. Fetch it with WebFetch to audit which endpoints are missing from yepcode_run/api/yepcode_api.py before adding new ones. New endpoints are deployed to that URL before this SDK is updated.