Registry / testing / mozdevice

mozdevice

JSON →
library4.2.0pypypi✓ verified 83d ago

Mozdevice is a Python library developed by Mozilla for managing and interacting with mobile devices (Android, Firefox OS/B2G) via ADB, as well as desktop browsers. It provides functionalities for device introspection, application management, and remote command execution, primarily used in automated testing and development workflows. The current version is 4.2.0, with an active release cadence driven by Mozilla's mobile testing needs. It requires Python 3.6 or newer.

pip install mozdevice
INSTALL
IMPORT
SIG · MOZDEVICE
M
mozdevice
testingpythonv4.2.0
Install
2.5s avg
Import
Disk
25MB
Pass rate
10/ 10
Env Coverage10 / 10
glibc
3.93.13
musl
3.93.13
Install & Compatibility
Where this runs
tested against v4.2.0 · pip install
no network on importno background threads
Install × environment matrix
Each cell = how many times install + import succeeded across repeated harness runs. Partial = flaky.
glibc = Debian/Ubuntu slim · musl = Alpine Linux
musl
py 3.103.920 runs
installs and imports cleanly · install 0.0s · import 0.000s · 28.5MB
glibc
py 3.103.920 runs
installs and imports cleanly · install 2.5s · import 0.000s · 29MB
25MB installed
● package 25MB
Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ADBDevice
from mozdevice import ADBDevice
from mozdevice.devicemanager import DeviceManager

This quickstart connects to a locally available Android device via ADB, retrieves basic device information, and lists installed packages. Ensure ADB (Android Debug Bridge) is installed and configured in your system's PATH, and a device is connected and authorized.

import os from mozdevice.devicemanager import DeviceManager try: # Connect to a locally available ADB device # If multiple devices are connected, you might need to specify 'serial' dm = DeviceManager() print(f"Connected to device: {dm.name}") print(f"Device type: {dm.device_type}") print(f"Device OS: {dm.os}") # Example: Get a list of installed packages (Android) if dm.os == 'android': packages = dm.list_packages() print(f"Number of installed packages: {len(packages)}") # print(f"Sample packages: {packages[:5]}") except Exception as e: print(f"Error connecting or interacting with device: {e}") print("Please ensure ADB is installed and a device is connected and authorized.")
Debug
Known issues
gotchaMozdevice relies on ADB (Android Debug Bridge) being installed and accessible in your system's PATH. Without a correctly set up ADB environment, device connection will fail.
fix
Install Android SDK Platform-Tools (which includes ADB) and ensure its location is added to your system's PATH environment variable. Verify with `adb devices` command.
affects: All versions
breakingThe minimum Python version required is 3.6. While PyPI metadata might sometimes show `None` for `requires_python`, the project's `setup.cfg` explicitly states `>=3.6`.
fix
Ensure you are using Python 3.6 or a newer version (e.g., `python3.9 -m pip install mozdevice`).
affects: <4.0 (for older Python), >=4.0 (strictly Python 3.6+)
gotchaConnecting to specific devices when multiple are present or connecting to remote devices requires specifying connection parameters (e.g., `serial`, `addr`, `port`) during `DeviceManager` initialization.
fix
Initialize `DeviceManager` with `DeviceManager(serial='<DEVICE_SERIAL>')` for specific local devices, or `DeviceManager(addr='<REMOTE_IP>', port=<REMOTE_PORT>)` for remote connections. Use `adb devices` to find local device serials.
affects: All versions
Upgrade
Version history
4.2.0latest on PyPI · released Nov 7, 2024
Audit
Dependencies
manifest-parserrequiredRequired for parsing application manifests (e.g., Firefox OS apps).
Agent activity
8 hits · last 30 days
node
6
Resources
mozdevice — pip install mozdevice · libregistry