Skip to content

sdan/vmux-examples

Repository files navigation

vmux examples

Example scripts for vmux. Run Python in the cloud.

Setup

uv tool install vmux-cli
vmux login

Examples

Hello World

vmux run python hello.py

A 5-second sanity check that prints the working directory, lists files, and counts to 5. Good for verifying your setup works.

Long-running Jobs

vmux run -d python epoch_counter.py

The -d flag works like Docker - it detaches from the container and lets the job run in the background. You can close your laptop and the job keeps running.

vmux ps                    # like docker ps
vmux logs -f <job_id>      # like docker logs -f
vmux attach <job_id>       # like docker attach, but it's tmux (may take a few seconds to load)
vmux stop <job_id>         # like docker stop

Web Servers

vmux run -p 8000 python burrow.py
vmux run -dp 8000 python burrow.py  # detached + port

The -p flag exposes a port and gives you a preview URL like https://<job_id>.purr.ge. WebSockets are proxied automatically.

Burrow is a production-style FastAPI demo that shows WebSocket broadcasting, Server-Sent Events, a real-time metrics dashboard, and graceful shutdown handling.

Collaborative Terminal

vmux run -p 8000 python collab-terminal/server.py

A shared bash session where multiple users connect to the same PTY via WebSocket. Anyone with the preview URL can join and type commands.

Network Probe

vmux run python netprobe.py

A network analytics tool that measures latency, jitter, and packet loss to Cloudflare, Google, and AWS endpoints. It runs periodic speed tests and displays results in a live dashboard.

ML Training

vmux run python train_arithmetic.py

Teaches a 1B-parameter LLM to add numbers using reinforcement learning. You can watch the reward climb from ~0.66 to 1.0 as the model learns.

vmux run -d python train_llama.py

Fine-tunes Llama-3.1-8B on instruction-following. This is a longer job so you'll want to run it detached.

Both examples require a Tinker API key:

vmux secret set TINKER_API_KEY

CLI Reference

vmux run python train.py          # like uv run, but in the cloud
vmux run -d python train.py       # detached, like docker -d
vmux run -p 8000 python server.py # expose port, get preview URL
vmux run -dp 8000 python server.py # detached + port

vmux ps                           # list running containers
vmux logs -f <id>                 # follow logs
vmux attach <id>                  # back in your tmux session
vmux stop <id>                    # stop container

More

See vmux.sdan.io for documentation.

About

Example scripts for vmux - run any command in the cloud

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages