Skip to main content

CLI and Python client for SWECC BenchAnything / Mesocosm (mesocosm + bench commands).

Project description

swecc-mesocosm

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

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

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 loginmesocosm 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)

pip install -e ./packages/swecc-mesocosm

Configure

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

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())

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

swecc_mesocosm-0.2.12-py3-none-any.whl (78.2 kB view details)

Uploaded Python 3

File details

Details for the file swecc_mesocosm-0.2.12-py3-none-any.whl.

File metadata

File hashes

Hashes for swecc_mesocosm-0.2.12-py3-none-any.whl
Algorithm Hash digest
SHA256 e26e9692db3fd078fdcd64efaf2df5732f7640059c406fb99540f72277d4bb89
MD5 0e85d0388820f9b4fea4d8a727a500fc
BLAKE2b-256 2880e3f40d914c23378e2a26a030402f8ca2e5eaf7d47d5519aa27126ec4b16d

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page