Metadata-Version: 2.4
Name: swecc-mesocosm
Version: 0.2.13
Summary: CLI and Python client for SWECC BenchAnything / Mesocosm (mesocosm + bench commands).
Project-URL: Homepage, https://github.com/swecc-uw/swecc-core
Project-URL: Repository, https://github.com/swecc-uw/swecc-core
Project-URL: Issues, https://github.com/swecc-uw/swecc-core/issues
Author-email: SWECC Labs <swecc@uw.edu>
License: MIT License
        
        Copyright (c) 2026 SWECC Labs
        
        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: bench,benchmark,evaluation,llm,mesocosm,swecc
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
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 :: Testing
Requires-Python: >=3.11
Requires-Dist: aiofiles>=24.0
Requires-Dist: django<5.0,>=4.2
Requires-Dist: fastapi>=0.115
Requires-Dist: httpx>=0.27
Requires-Dist: litellm>=1.50
Requires-Dist: psycopg[binary]>=3.1
Requires-Dist: pydantic-settings>=2.5
Requires-Dist: pydantic>=2.9
Requires-Dist: python-jose[cryptography]>=3.3
Requires-Dist: requests>=2.31
Requires-Dist: rich>=13.7
Requires-Dist: structlog>=24.0
Requires-Dist: typer>=0.12
Requires-Dist: uvicorn[standard]>=0.30
Requires-Dist: websockets>=13.0
Provides-Extra: dev
Requires-Dist: black; extra == 'dev'
Requires-Dist: build; extra == 'dev'
Requires-Dist: mypy; extra == 'dev'
Requires-Dist: pre-commit; extra == 'dev'
Requires-Dist: pytest; extra == 'dev'
Requires-Dist: pytest-asyncio; extra == 'dev'
Requires-Dist: ruff; extra == 'dev'
Requires-Dist: twine; extra == 'dev'
Provides-Extra: lint
Requires-Dist: black; extra == 'lint'
Requires-Dist: mypy; extra == 'lint'
Requires-Dist: ruff; extra == 'lint'
Provides-Extra: test
Requires-Dist: pytest; extra == 'test'
Requires-Dist: pytest-asyncio; extra == 'test'
Description-Content-Type: text/markdown

# swecc-mesocosm

CLI and Python client for SWECC's BenchAnything / Mesocosm platform.

```bash
pip install swecc-mesocosm
mesocosm --help
```

**One package, one command (`mesocosm`).** There is no separate `bench` binary or `swecc-bench` on PyPI.

## Env author quick start

```bash
pip install swecc-mesocosm   # once — covers CLI, bench_common, adapter HTTP stack
mkdir my-env && cd my-env
mesocosm init

ollama pull llama3.2
python adapter.py          # terminal 1
mesocosm run local         # terminal 2 — Ollama + benchanything.json, no submit
```

`requirements.txt` from `mesocosm init` is for **optional env libraries** (e.g. numpy), installed on the platform at submit time — not for installing the CLI.

When ready for the platform: `mesocosm auth login` → `mesocosm env submit` (creates the domain from `benchanything.json` in your repo) → `mesocosm run create` with the returned `domain_id`. See `LOCAL_DEV.md` in your repo after `mesocosm init`.

## Command overview

| Area | Examples |
|------|----------|
| **Local env / Ollama** | `mesocosm init`, `mesocosm run local` |
| **Auth & teams** | `mesocosm auth login`, `mesocosm team create` |
| **Submit repo** | `mesocosm env submit --github-url …` |
| **Platform runs** | `mesocosm run create`, `mesocosm run export RUN_ID` |
| **Connectivity** | `mesocosm doctor`, `mesocosm doctor --local` |
| **Pre-submit check** | `mesocosm validate domain.json` |
| **Bench-api eval** | `mesocosm eval test`, `mesocosm run get` |

Legacy repos with `domain.py` + `DOMAIN_CONFIG` (not created by `mesocosm init`) can still use `mesocosm register path/to/domain.py`.

See `PACKAGING.md` in this directory for how `bench_common` is bundled and how `mesocosm run` routes local vs platform subcommands.

## Install (dev)

```bash
pip install -e ./packages/swecc-mesocosm
```

## Configure

```bash
mesocosm doctor                    # checks https://api.swecc.org/bench (default)
mesocosm doctor --local            # checks adapter :8765 + local bench-api :8010
export MESOCOSM_LOCAL=1            # same local profile for all commands
```

Remote defaults: `https://api.swecc.org/bench` and `https://api.swecc.org` for auth. Local: see `infra/mesocosm.env.example`.

**Non-interactive auth:** `mesocosm auth login` always prompts for username and password. In CI or scripts, use `export SWECC_BENCH_TOKEN=…` (member JWT) or `mesocosm auth guest` instead.

## Python client

```python
import asyncio
from swecc_mesocosm import BenchClient

async def main():
    c = BenchClient(base_url="http://127.0.0.1:8010")
    try:
        domain = await c.get_domain("my-bench-id")
        print(domain["status"])
    finally:
        await c.aclose()

asyncio.run(main())
```
