droidlink
Android device control and test automation in Python — the client library of the DeviceKit platform. Connect to phones over USB or WiFi, drive the UI, run shell commands, manage files and apps, read metrics and notifications, and plug straight into pytest for device testing in CI.
Devices run the lightweight DeviceKit agent app (an HTTP server on the phone); droidlink talks to it directly — over USB via ADB port forwarding, or over WiFi with UDP auto-discovery. No backend server required.
Install
pip install droidlink
Quick Start
import droidlink
# Connect via USB (auto-detect)
d = droidlink.connect()
# Connect to a specific device
d = droidlink.connect("EMULATOR5554")
# Connect via WiFi (no ADB needed)
d = droidlink.connect_wifi("192.168.1.5")
# Device info
print(d.info) # model, SDK, screen size
print(d.battery) # level, charging, temperature
# UI Automation
d(text="Login").click()
d(resourceId="com.app:id/input").set_text("hello")
d(className="android.widget.EditText", instance=2).clear_text()
d(scrollable=True).scroll.to(text="Bottom Item")
if d(text="Error").exists(timeout=3):
print("Error dialog appeared")
# Screenshots
d.screenshot("screen.png")
# Shell commands
result = d.shell("whoami")
print(result.output)
# File management
files = d.files.list("/sdcard/DCIM/")
d.files.push("./config.json", "/sdcard/config.json")
d.files.pull("/sdcard/photo.jpg", "./photo.jpg")
# App management
d.app.launch("com.android.chrome")
apps = d.app.list(filter="user")
results = d.app.search("chrome")
# Notifications
notifications = d.notifications.list()
# Device metrics
metrics = d.metrics.snapshot()
print(f"CPU: {metrics.cpu_percent}%, RAM: {metrics.ram_used_mb}MB")
# Clipboard
d.clipboard.set("copied text")
print(d.clipboard.get())
CLI
droidlink devices # list connected devices
droidlink ping # check agent connectivity
droidlink info # show device info
droidlink screenshot -o s.png # take screenshot
droidlink shell "ls /sdcard" # run shell command
droidlink apps # list user apps
droidlink notifications # list notifications
droidlink metrics # show device metrics
pytest plugin
The package ships a pytest plugin with device and device_pool fixtures:
def test_login_flow(device):
device.app.launch("com.example.app")
device(text="Login").click()
assert device(text="Welcome").exists(timeout=5)
pytest tests/ --device <SERIAL> # USB device
pytest tests/ --device-wifi 192.168.1.5 # WiFi device
pytest tests/ --devicekit-url http://ci:5050 # report results to a DeviceKit backend
With --devicekit-url, test results, build lifecycle, and failure screenshots are
reported to the DeviceKit dashboard automatically.
Requirements
- Python 3.8+
- Android device with the DeviceKit agent app installed and running
- ADB (for USB connections) or WiFi connectivity
Part of DeviceKit
droidlink is the programmatic entry point to the larger DeviceKit platform: a fleet dashboard with real-time streaming, a visual automation editor with AI generation and self-healing, visual regression testing, fleet queries, and failure debug bundles.
License
MIT
Metadata
Release files for droidlink 0.1.0
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| droidlink-0.1.0.tar.gz | 28.7 kB | Without provenance | Details for droidlink-0.1.0.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| droidlink-0.1.0-py3-none-any.whl | Python 3 | none | any | Details for droidlink-0.1.0-py3-none-any.whl |
Total release size: 64.9 kB
Release files / droidlink-0.1.0.tar.gz
| Download URL | droidlink-0.1.0.tar.gz |
|---|---|
| Size | 28.7 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
d2d15aa17a7fe61f36228725becabe7737c430f9c7b0ff68adc131fd7632cdf6
|
|
BLAKE2b-256 checksum How to use checksums |
da8e10b399f9a224051bddb3d9f1db64f759cb651bf8bfacb20095072ecc06c4
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Release files / droidlink-0.1.0-py3-none-any.whl
| Download URL | droidlink-0.1.0-py3-none-any.whl |
|---|---|
| Size | 36.2 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
735b7bea6ce2bb138e3568a68a5e697d4a47f8a323b4353f40e44d7757da9672
|
|
BLAKE2b-256 checksum How to use checksums |
e7b20e24623f82586437e8fcbd0170b418bc05e25be7bb0841dec294a35bef17
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.2.0 CPython/3.11.7
|
Security for droidlink 0.1.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.
No provenance found
None of the files in this release were uploaded with provenance metadata.
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.