An API to control MuMu Player for Windows using python
Project description
pymumu
A Python API for controlling and managing MuMu Player Android emulator — inspired by pymemuc.
Features
- Auto-detect MuMu Player installation via Windows Registry
- Start, stop, restart, clone, and delete emulator instances
- Control app lifecycle (install, uninstall, launch, close)
- ADB shell commands and key events
- Window management (show, hide, layout)
- Simulate device properties (Android ID, MAC, IMEI)
- GPS location spoofing
- Import/export instances as
.mumudatafiles - Tap, swipe, long press via shell
Requirements
- Windows 10/11
- MuMu Player installed
- Python 3.8+
Installation
pip install pymumu
Or install from source:
git clone https://github.com/yourusername/pymumu
cd pymumu
pip install -e .
Quick Start
from pymumu import PyMumu
# auto detect MuMu installation
mumu = PyMumu()
# or pass path manually
mumu = PyMumu(path=r"C:\Program Files\Netease\MuMuPlayer\nx_main\MumuManager.exe")
print(mumu)
# PyMumu(path='C:\...MumuManager.exe', index=0)
Usage
Instance Management
# get version and info
mumu.version()
mumu.info(index=0)
# lifecycle
mumu.start(index=0)
mumu.stop(index=0)
mumu.restart(index=0)
# management
mumu.create()
mumu.clone(index=0, number=3) # clone 3 times
mumu.delete(index=1)
mumu.rename("MyDevice", index=0)
# import / export
mumu.import_player(r"C:\backup.mumudata")
mumu.export_player(index=0, directory=r"C:\backups", zip=True)
Window Control
mumu.show_window(index=0)
mumu.hide_window(index=0)
mumu.layout_window(x=0, y=0, width=720, height=1280, index=0)
mumu.sort()
App Control
mumu.app_install(r"C:\Downloads\app.apk", index=0)
mumu.app_uninstall("com.example.app", index=0)
mumu.app_launch("com.example.app", index=0)
mumu.app_close("com.example.app", index=0)
mumu.app_info("com.example.app", index=0)
mumu.app_info(index=0) # list all installed apps
ADB & Shell
# adb commands
mumu.adb_connect(index=0)
mumu.adb_cmd("connect", index=0)
# shell commands
mumu.shell("input tap 500 500", index=0)
mumu.getprop("ro.build.version.release", index=0)
mumu.setprop("ro.build.version.release", "12", index=0)
mumu.input_text("hello world", index=0)
Touch & Input
mumu.tap(500, 500, index=0)
mumu.swipe(100, 500, 600, 500, duration_ms=300, index=0)
mumu.long_press(500, 500, duration_ms=900, index=0)
Key Events
mumu.key_back(index=0)
mumu.key_home(index=0)
mumu.key_task(index=0)
mumu.key_enter(index=0)
mumu.volume_up(index=0)
mumu.volume_down(index=0)
mumu.volume_mute(index=0)
Toolbar
mumu.tool_func("screenshot", index=0)
mumu.tool_func("rotate", index=0)
mumu.tool_location(longitude=-0.1276, latitude=51.5074, index=0) # London
mumu.tool_downcpu(cap=50, index=0)
mumu.tool_gyro(x=0.0, y=9.8, z=0.0, index=0)
Simulation
mumu.set_android_id("abc123", index=0)
mumu.set_mac_address("00:11:22:33:44:55", index=0)
mumu.set_imei("123456789012345", index=0)
mumu.set_simulation("android_id", "__null__", index=0) # clear
Settings
mumu.get_setting("root_permission", index=0)
mumu.set_setting("root_permission", "true", index=0)
mumu.get_all_settings(index=0)
mumu.set_settings_from_file(r"C:\settings.json", index=0)
Shortcuts & Drivers
mumu.shortcut_create(index=0)
mumu.shortcut_delete(index=0)
mumu.driver_install()
mumu.driver_uninstall()
Logging
mumu.log_on()
mumu.log_off()
Multiple Instances
# use index parameter on any method
mumu.start(index=0)
mumu.start(index=1)
mumu.start(index=2)
# or set default index
mumu = PyMumu(index=2)
mumu.start() # starts instance 2
Error Handling
from pymumu import PyMumu, MuMuException, MuMuNotFoundError
try:
mumu = PyMumu()
mumu.start(index=0)
except MuMuNotFoundError:
print("MuMu Player not found!")
except MuMuException as e:
print(f"Error: {e}")
Exceptions
| Exception | Description |
|---|---|
MuMuException |
Base exception for all pymumu errors |
MuMuNotFoundError |
MuMu Player installation not found |
EmulatorNotRunningError |
Emulator is not running |
AdbCommandError |
ADB command failed |
InvalidInstanceError |
Invalid emulator index |
Project Structure
src/pymumu/
├── __init__.py # public API
├── pymumu.py # main class
├── instance.py # instance management mixin
├── control.py # app/tool/settings mixin
├── adb.py # adb/shell/keyevents mixin
├── utils.py # _run, _find_mumu
└── exception.py # custom exceptions
License
MIT
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
pymumu-0.1.0.tar.gz
(9.6 kB
view details)
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pymumu-0.1.0.tar.gz.
File metadata
- Download URL: pymumu-0.1.0.tar.gz
- Upload date:
- Size: 9.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
84cd3319c167f02b38a23f9fa45bb316846e0e37088c173ee8cd8190bdb9321f
|
|
| MD5 |
7dbf91c19aeaa436abfb72095d2b596b
|
|
| BLAKE2b-256 |
2d00903c41925d93e33bef9473392275beae4eb3531f3f29b662978a106d37b5
|
File details
Details for the file pymumu-0.1.0-py3-none-any.whl.
File metadata
- Download URL: pymumu-0.1.0-py3-none-any.whl
- Upload date:
- Size: 9.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.2.0 CPython/3.13.13
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
62357b26e1a5bb8d1a7de7a0da21ac700a241f157bb67288506dca6d7f714dc0
|
|
| MD5 |
23ce16657ed8309c5726da18f3ee7605
|
|
| BLAKE2b-256 |
983b756bc54783307d8a24849cb0b17ca3979339d094335d6d48953ab3300904
|