A small, typed controller for Android devices over ADB. One async API, one sync facade, explicit capabilities, and typed errors.
Status: v0.1, pre-release. The plain ADB backend ships on all platforms, alongside Google Play Games on PC (Windows) and BlueStacks Air (macOS Apple Silicon). MEmu, BlueStacks 5, and AVD are future, unverified work.
Not on PyPI yet. Install from git:
pip install "emuctl @ git+https://github.com/pyclashbot/emuctl"or with uv:
uv add "emuctl @ git+https://github.com/pyclashbot/emuctl"Python 3.12+.
import emuctl
with emuctl.connect_sync("adb:127.0.0.1:5555") as emu:
emu.configure({"display.width": 419, "display.height": 633, "display.dpi": 160})
emu.start_app("com.example.app")
png = emu.screenshot()
emu.click(120, 300)Async works the same way:
import asyncio
import emuctl
async def main() -> None:
emu = await emuctl.connect("adb:127.0.0.1:5555")
try:
await emu.configure({"display.width": 419, "display.height": 633})
finally:
await emu.close()
asyncio.run(main())connect() and connect_sync() take a canonical backend:key target or an
emuctl.InstanceRef. See what exists first:
report = asyncio.run(emuctl.discover())
emu = emuctl.connect_sync("adb:emulator-5554")- ADB transport (
adb:<serial>) on every platform: device discovery, screenshots, taps, swipes, keys, text, app start and APK install. - Google Play Games on PC (
google-play:<serial>, Windows): discovery, screenshots, input, app launch and install checks, and displayCONFIGUREagainst the bundled ADB. Boot and APK install stay gated: the launcher owns lifecycle and the vendor adapter has no install path. - BlueStacks Air (
bluestacks-air:<instance>, macOS Apple Silicon): discovery throughbluestacks.conf,start/stop/restart, screenshots, input, apps, APK install, andCONFIGURE(renderer, geometry, fps, CPU/RAM, vsync/high-FPS) through the conf store. - Display
CONFIGURE: set width, height, and DPI through the public surface, with the previousDisplayStatereturned for an explicit restore. - Capability probes (
features,has_feature) so unsupported operations fail withFeatureNotSupportedError, not a vendor surprise. - Typed errors, one deadline per call, and a required
close()exit path. There is noatexithook; keepclose()(or the context manager) on every exit.
The behavioral contract is CONTRACT.md. The short version: selection is static and refusal-before-import; adapters stay behind one port; the sync facade owns a portal thread and must be closed.
MIT. See LICENSE.