Skip to main content

anybox

one API for the most popular passthrough boxes, from Python. it's the anybox Rust library through its C ABI, so it does exactly what the Rust one does, and the README there has which boxes it supports and how each one behaves

pip install anybox-rs

it's still import anybox in your code. the wheel has the library inside, so you don't need Rust. it's Windows and Linux on x64 and Python 3.11 or newer for now, if you need something else open an issue. on Linux your user has to be allowed to open serial ports, the dialout group on most distros (uucp on Arch)

import anybox

with anybox.connect() as device:
    print(device.snapshot().info)
    device.move_by(100, 0)
    device.click(anybox.Button.LEFT)
    device.tap_key(anybox.Key.A)

anybox.connect() takes the first box it finds, anybox.Connect(port="COM18").open() or anybox.Connect(family=anybox.Family.MEDIUS).open() the one you want, and anybox.scan() gives every port with what's on it, which is what a box picker wants. anybox.candidates() is the cheap one to call every second. leave the with or call close() so anybox lets go of what you held and unlocks what you locked

if a box can't do something you get an anybox.UnsupportedError saying why, and device.snapshot().capabilities[anybox.Action.KEY_TAP] tells you before you try. every error is an anybox.Error with the library's own text, and it has the Rust error's fields too, like error.port, error.action or the boxes a NoBoxCanError found and what each one couldn't do

what happens on the box comes in as events:

import anybox

with anybox.connect() as device:
    for event in device.events(anybox.EventKinds.BUTTONS):
        match event:
            case anybox.ButtonEvent(button=anybox.Button.SIDE1, pressed=True):
                print("side button down")
            case anybox.Disconnected():
                print("the box is gone, anybox keeps looking for it")
            case anybox.Reconnected():
                print("it's back")

events.recv(timeout) gives you one at a time instead, None when nothing came in time. iterating ends once the device is closed and everything queued was read, and a receiver keeps its device open while you have it, unlike in Rust, since the garbage collector would close it under you otherwise. just so you know, a receiver of keys sees every key typed on the keyboard behind the box, passwords included

durations like a click's hold are seconds, and an event's stamp is nanoseconds since the device was opened. at.arrived_ns and at.received_ns are on the clock time.perf_counter_ns() reads, so you can line them up with your own timing and with other boxes. a number that doesn't fit what the box takes (a move of 40000 for example) is a ValueError and never gets cut short on its way

what only one box can do stays reachable through that box's own API. on a Medius, device.medius() gives you the medius package's own device for clips, transforms, rendering and the rest, and None on every other box. it needs the extra:

pip install anybox-rs[medius]
import anybox
from medius import RenderMode

with anybox.connect() as device:
    if (medius := device.medius()) is not None:
        medius.set_render(RenderMode.DESPIKED, False)

it shares anybox's connection, so import anybox BEFORE medius, otherwise medius loads its own library and can't use it. anybox doesn't know about anything you press or lock through it

license

MPL-2.0, the wheel has the license, the notice and the licenses of everything built into the library. made by ethereal

Metadata

Release files for anybox-rs 0.10.0

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

Built distributions (wheels)

Table of built distributions (wheels) for anybox-rs 0.10.0
File Interpreter ABI Platform
anybox_rs-0.10.0-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details
anybox_rs-0.10.0-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details

Total release size: 2.8 MB

Release files / anybox_rs-0.10.0-py3-none-win_amd64.whl

Download URL anybox_rs-0.10.0-py3-none-win_amd64.whl
Size 817.6 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
bcc6ff881229a4012fb365933cf7155074c3a36e4f0b992a37dda76fd66dd8ce
BLAKE2b-256 checksum
How to use checksums
84c68bf7e2ce4936d7bbca82674464e3889427f57af7792a0d49640a28dd4afd
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 Oct 17, 2026.

Transparency log

Release files / anybox_rs-0.10.0-py3-none-manylinux_2_28_x86_64.whl

Download URL anybox_rs-0.10.0-py3-none-manylinux_2_28_x86_64.whl
Size 2.0 MB
Tags Linux glibc 2.28+ x86-64 Python 3
SHA-256 checksum
How to use checksums
4619b25f8d643f2b899c6adeb89b5a421ad7fae176083721b137ee51f7e694f1
BLAKE2b-256 checksum
How to use checksums
bdee3e047d572394dbbc3115bd7cf7004b6b819432d75e176153bf1c04237037
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 Oct 17, 2026.

Transparency log

Security for anybox-rs 0.10.0

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.

Full provenance

All 2 files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anybox_rs-0.10.0-py3-none-win_amd64.whl

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 Oct 17, 2026.

Transparency log

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

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