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-py

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-py[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-py 0.11.1

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-py 0.11.1
File Interpreter ABI Platform Actions
anybox_py-0.11.1-py3-none-win_amd64.whl Python 3 none Windows x86-64 Details for anybox_py-0.11.1-py3-none-win_amd64.whl
anybox_py-0.11.1-py3-none-manylinux_2_28_x86_64.whl Python 3 none Linux glibc 2.28+ x86-64 Details for anybox_py-0.11.1-py3-none-manylinux_2_28_x86_64.whl

Total release size: 2.9 MB

Release files / anybox_py-0.11.1-py3-none-win_amd64.whl

Download URL anybox_py-0.11.1-py3-none-win_amd64.whl
Size 888.7 kB
Tags Python 3 Windows x86-64
SHA-256 checksum
How to use checksums
c439a44dd7e4cd7b728c48d018e91d32a2bf658eaad04ff857a098c3d6c96581
BLAKE2b-256 checksum
How to use checksums
0444cc969379447242740d204c9de920e1257eaa983517f57eaeb2c3be1afdbe
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Release files / anybox_py-0.11.1-py3-none-manylinux_2_28_x86_64.whl

Download URL anybox_py-0.11.1-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
b9b95957ff261651afa6db0a1367f8f20aa6f04d3959f67155ee68fd1db27c03
BLAKE2b-256 checksum
How to use checksums
255548084523fd62a857037ac40005618318217f759a3476ca5c37245f45fe8b
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.16

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 Nov 14, 2026.

Transparency log

Security for anybox-py 0.11.1

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

Both files in this release have been uploaded with provenance metadata.

Select from 2 files

Attestation for anybox_py-0.11.1-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 Nov 14, 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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Release history Release notifications | RSS feed

This release

0.11.1 This release

2 release files Full provenance

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