Skip to main content

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 .mumudata files
  • Tap, swipe, long press via shell

Requirements


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

Metadata

Release files for pymumu 0.1.0

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for pymumu 0.1.0
File Size Uploaded Provenance Actions
pymumu-0.1.0.tar.gz 9.6 kB Without provenance Details for pymumu-0.1.0.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for pymumu 0.1.0
File Interpreter ABI Platform Actions
pymumu-0.1.0-py3-none-any.whl Python 3 none any Details for pymumu-0.1.0-py3-none-any.whl

Total release size: 19.4 kB

Release files / pymumu-0.1.0.tar.gz

Download URL pymumu-0.1.0.tar.gz
Size 9.6 kB
Tags Source
SHA-256 checksum
How to use checksums
84cd3319c167f02b38a23f9fa45bb316846e0e37088c173ee8cd8190bdb9321f
BLAKE2b-256 checksum
How to use checksums
2d00903c41925d93e33bef9473392275beae4eb3531f3f29b662978a106d37b5
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Release files / pymumu-0.1.0-py3-none-any.whl

Download URL pymumu-0.1.0-py3-none-any.whl
Size 9.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
62357b26e1a5bb8d1a7de7a0da21ac700a241f157bb67288506dca6d7f714dc0
BLAKE2b-256 checksum
How to use checksums
983b756bc54783307d8a24849cb0b17ca3979339d094335d6d48953ab3300904
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.13

Security for pymumu 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.

Release history Release notifications | RSS feed

This release

0.1.0 This release

2 release files No 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