Skip to main content

machineplay

Upload a UCI chess engine as a Docker image and watch it play, live, on machineplay.org.

This package is the client side of that, in two roles:

  • the CLI (machineplay login / upload / whoami / logout) — builds the Dockerfile in the current directory, smoke-tests that it speaks UCI, pushes it to the machineplay registry and registers the new version.
  • the runner (machineplay runner) — a daemon that connects to the backend over a WebSocket, pulls engine images and plays games with fastchess, streaming every move back as it happens. Each game runs its two engines in sandboxed containers (no network, dropped capabilities, capped memory) pinned to one core.

Every external command either role runs is echoed first, so you can see exactly what touched your machine:

> docker build --platform linux/amd64 -t machineplay-local:latest .
> docker push registry.machineplay.org/alice/myengine:2026-08-08-12-30

Install

uv tool install machineplay     # or: pipx install machineplay

Needs Python 3.12+ and Docker. The runner additionally needs fastchess on PATH (or FASTCHESS_PATH pointing at it).

Upload an engine

Your engine is a Docker image whose entrypoint speaks UCI on stdin/stdout — start from python-chess-starter if you want a working example.

machineplay login          # opens machineplay.org/cli, paste the token
cd myengine                # the directory with your Dockerfile
machineplay upload

upload asks for an engine name and a version. The name groups versions — uploading under the same name again adds a version to the same engine, so keep it stable and don't bake a release number into it. Names are lowercase URL slugs: your engine ends up at machineplay.org/<you>/<engine>.

Runners are linux/amd64, so that is what upload builds and what it checks the finished image against — you don't have to do anything special on an Apple Silicon Mac beyond letting docker emulate, which makes the build and the UCI check slower. A FROM --platform=… line in your Dockerfile overrides this and is rejected: the image would upload fine and then fail to start on a runner.

Run a runner

A runner offers your machine's cores to play games on. It needs an API token, either from machineplay login or in MP_TOKEN:

machineplay runner

It reports its hardware on connect, plays up to MAX_GAMES games concurrently (default: one per core), and reconnects on its own if the backend restarts. Its identity persists in ~/.config/machineplay/runner.json, so restarts show up as the same runner rather than a new one.

Files this writes

Path What
~/.config/machineplay/credentials.json API token from login (mode 0600)
~/.config/machineplay/runner.json this runner's stable id
~/.docker/config.json registry credentials, via docker login

machineplay logout removes all three (the last one via docker logout).

Configuration

Everything is overridable from the environment; the defaults point at production.

Variable Default What
MP_TOKEN — API token for the runner (overrides saved credentials)
RUNNER_ID persisted pin the runner's id explicitly
BACKEND_URL wss://api.machineplay.org/ws runner WebSocket endpoint
MAX_GAMES CPU count concurrent games (each pinned to its own core)
MACHINEPLAY_API_URL https://api.machineplay.org REST API for the CLI
MACHINEPLAY_WEB_URL https://machineplay.org website login opens
MACHINEPLAY_REGISTRY registry.machineplay.org image registry
MACHINEPLAY_PLATFORM linux/amd64 platform upload builds engines for
MACHINEPLAY_UCI_TIMEOUT 30s, 120s emulated seconds upload waits for uci
FASTCHESS_PATH fastchess fastchess binary
ENGINE_MEMORY / ENGINE_CPUS 512m / 1 per-engine container limits
PULL_TIMEOUT 600 seconds before a stuck docker pull gives up
NO_COLOR — set to disable coloured output

License

This project is licensed under the GNU Affero General Public License, version 3 or (at your option) any later version (AGPL-3.0-or-later). See LICENSE for the full text.

Metadata

Release files for machineplay 0.2.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for machineplay 0.2.0
File Size Uploaded
machineplay-0.2.0.tar.gz 54.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for machineplay 0.2.0
File Interpreter ABI Platform
machineplay-0.2.0-py3-none-any.whl Python 3 none any Details

Total release size: 96.4 kB

Release files / machineplay-0.2.0.tar.gz

Download URL machineplay-0.2.0.tar.gz
Size 54.8 kB
Tags Source
SHA-256 checksum
How to use checksums
238a756248b5a692fd7271777b1f72e950e4709d5d5de22a141f53ae7c2b6db1
BLAKE2b-256 checksum
How to use checksums
9ea90a310ce3e0fc5eef8558d7beb671a93b115cb2c876a5934167869f37b548
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release files / machineplay-0.2.0-py3-none-any.whl

Download URL machineplay-0.2.0-py3-none-any.whl
Size 41.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
256b9bb6da551e7b0620d7666af180b7d73a20a361a70f4e9416e1a61e8dff02
BLAKE2b-256 checksum
How to use checksums
637ad4f9d7189d2ea2fa5afd9d1a9d5bbb7509256559319d29eac9bc794345ea
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Aug 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.2.0 This release

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page