Skip to main content

mihomo-py

Your server's proxies. One terminal.

Subscriptions, nodes and logs — without leaving SSH.

PyPI Python Platform

English · 简体中文

TUI: subscriptions, core controls and server status

A mihomo client for Linux servers and Apple Silicon Macs. Add a subscription, start the core, and manage it with your mouse or keyboard. The core and default GEO databases ship with the package.

The TUI screenshots show v0.1.5 in English at 100 × 32. Use the language button to switch between English and Chinese.

Install. Open. Done.

python -m pip install mihomo-py
mihomo-py

Requires Python 3.11+ and either Linux 5.3+ (x86_64 / aarch64, with pidfd) or macOS 12+ (Apple Silicon / arm64). Works with virtual environments, system Python and Conda. macOS supports the CLI, TUI, subscriptions, HTTP/SOCKS proxy and optional Web UI; TUN and --sudo remain Linux-only. Recommended terminal size: 80 × 24 or larger. The TUI follows the system language on first launch and supports Chinese and English; use the language button to switch between Follow system, Chinese, and English.

  1. Click Add, or press Ctrl+A. Enter a name and a subscription URL or local YAML path.
  2. Single-click to browse a subscription; double-click or press Enter to use it.
  3. Click Start. Your HTTP/SOCKS proxy is ready at 127.0.0.1:7897 by default. On GNOME, KDE Plasma or macOS, choose Settings → Enable system proxy for browsers that follow system settings. The CLI equivalent is mihomo-py system-proxy enable. System proxy switch

Subscriptions must be complete Clash/mihomo YAML configurations. Base64 node lists and individual proxy links are not supported.

Docker

The repository Dockerfile supports linux/amd64 and linux/arm64, and the default image starts the TUI. TUN requires CAP_NET_ADMIN and /dev/net/tun; use host networking when the container should take over host traffic:

docker buildx build --platform linux/amd64 --tag mihomo-py:latest --load .
mkdir -p ./mihomo-data
docker run --rm -it --network host \
  --cap-add NET_ADMIN --device /dev/net/tun:/dev/net/tun \
  --volume "$PWD/mihomo-data:/data" mihomo-py:latest

Replace the arguments after the image with tun doctor, tun enable --yes, or another mihomo-py subcommand. See offline packaging for multi-platform publishing, Web resources, and the installation check target.

Find a node. Switch. Test.

TUI: proxy groups, node selection and latency testing

Press 2 for nodes, select a proxy group, and press / to search. In a manual group, Enter switches the selected node immediately; Test latency measures one node. Node choices survive core restarts.

Follow logs. Keep your place.

TUI: live logs with pause and resume controls

Press 3 for logs. Scroll up to pause; press End to resume following. Press q to leave the TUI — the core keeps running.

1 / 2 / 3 switch tabs · i opens details · ? shows shortcuts. Full TUI guide →

Prefer a browser?

Web: subscription management using the same configuration as the TUI

Install the optional Web resources with python -m pip install 'mihomo-py[web]', then click Enable Web in the TUI. The gateway runs as a separate service on port 9091 by default, uses the configured management bind address, and stays running after the TUI exits. Click Web for the address and login key; Settings can rotate the shared login key. The same gateway manages subscriptions and embeds the node dashboard. Setup →

Shell proxy and local TUN

mihomo-py proxy run -- curl https://example.com
eval "$(mihomo-py proxy env --shell bash)"

proxy run works with programs that honor proxy environment variables. Use proxy env --unset --shell bash to output cleanup commands. For local traffic interception, start mihomo-py --sudo, enter your sudo password, and enable TUN in Settings. CLI users can run mihomo-py --sudo tun doctor, then mihomo-py --sudo tun enable. TUN requires Linux, iproute2, CAP_NET_ADMIN and /dev/net/tun; it may interrupt SSH and connectivity when proxies fail. Inspect with tun status, disable with tun disable. No automatic privilege elevation, firewall changes or Shell startup file edits. Configuration and recovery →

Go further

CLI & scripting · TUI guide · Documentation · Offline installation

The proxy listens on 127.0.0.1:7897 by default. The authenticated management API listens on 0.0.0.0:9090; the optional Web gateway listens on 0.0.0.0:9091. Use a trusted network or change the bind address in Settings. Linux local TUN is explicitly opt-in and disabled by default. Shell proxy environment output and command wrapping are available; privileges are never elevated automatically.

TUI screenshots render the current application with fixed demo data (including sample logs and latency), without real subscription credentials. The Web screenshot uses an isolated local instance. Bundled resources retain their upstream notices.

Metadata

Release files for mihomo-py 0.4.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 mihomo-py 0.4.0
File Size Uploaded Provenance Actions
mihomo_py-0.4.0.tar.gz 79.9 MB Without provenance Details for mihomo_py-0.4.0.tar.gz

Built distributions (wheels)

Table of built distributions (wheels) for mihomo-py 0.4.0
File Interpreter ABI Platform Actions
mihomo_py-0.4.0-py3-none-manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl Python 3 none Linux glibc 2.17+ x86-64, Linux musl 1.2+ x86-64 Details for mihomo_py-0.4.0-py3-none-manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl
mihomo_py-0.4.0-py3-none-manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl Python 3 none Linux musl 1.2+ ARM64, Linux glibc 2.17+ ARM64 Details for mihomo_py-0.4.0-py3-none-manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl
mihomo_py-0.4.0-py3-none-macosx_12_0_arm64.whl Python 3 none macOS 12.0+ ARM64 Details for mihomo_py-0.4.0-py3-none-macosx_12_0_arm64.whl

Total release size: 190.1 MB

Release files / mihomo_py-0.4.0.tar.gz

Download URL mihomo_py-0.4.0.tar.gz
Size 79.9 MB
Tags Source
SHA-256 checksum
How to use checksums
d7c203df4700055452618c45a24ddfa3352496ccbf7780e64a97c82d266e3bce
BLAKE2b-256 checksum
How to use checksums
448678ddd1bf11b02c8a55c5dc336c3f83be5c96c4531cbc7456f1f7f0bf91d1
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mihomo_py-0.4.0-py3-none-manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl

Download URL mihomo_py-0.4.0-py3-none-manylinux_2_17_x86_64.musllinux_1_2_x86_64.whl
Size 38.1 MB
Tags Linux glibc 2.17+ x86-64 Linux musl 1.2+ x86-64 Python 3
SHA-256 checksum
How to use checksums
d96e682177dafe1bd131274d4ac287326630f7240ecb2f2ab39f3abf6e36a3d6
BLAKE2b-256 checksum
How to use checksums
7796da70773e6aff7c7c0112e46d5a850fd4475829693b55ed5b95327b09dc71
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mihomo_py-0.4.0-py3-none-manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl

Download URL mihomo_py-0.4.0-py3-none-manylinux_2_17_aarch64.musllinux_1_2_aarch64.whl
Size 36.0 MB
Tags Linux glibc 2.17+ ARM64 Linux musl 1.2+ ARM64 Python 3
SHA-256 checksum
How to use checksums
b60f2ff2c63f7b2e8762f278da1a172e59ef6b16542aaaf5a559bbaf932fa234
BLAKE2b-256 checksum
How to use checksums
1b85f6f7599f35ab2488eb1fc360ab8f3d04ae134317dc95fc8fc4bd33fb2ed3
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Release files / mihomo_py-0.4.0-py3-none-macosx_12_0_arm64.whl

Download URL mihomo_py-0.4.0-py3-none-macosx_12_0_arm64.whl
Size 36.0 MB
Tags Python 3 macOS 12.0+ ARM64
SHA-256 checksum
How to use checksums
c6c20f053fda808545476cccb5cbaf7b39cfe099a627e3d8a5a77f4af21aca07
BLAKE2b-256 checksum
How to use checksums
2a56cc077b2dd52668742b516909681db9d5db770c727c5671d3dfbe34c60133
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.13.16

Security for mihomo-py 0.4.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.

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