中文 | English
This is a plugin for oh-my-zsh to manage PyPI mirrors. The plugin provides several convenient commands to list available PyPI mirrors, switch mirrors, and test mirror connectivity.
Using git
git clone https://github.com/belingud/pypi ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/pypi
Or copy the plugin script to the ~/.oh-my-zsh/custom/plugins/
directory manually, then add the plugin name to ~/.zshrc
. For example:
plugins=(... pypi ...)
-
List Supported Mirrors
pypi list
This command lists all supported PyPI mirrors and their URLs.
-
Switch Mirrors
pypi use <shortname>
Switch to the specified mirror, where
<shortname>
is the mirror's short name. For example:pypi use aliyun
-
Test Mirror Connectivity
pypi ping <shortname|url>
Check the network connectivity of the specified mirror, where
<shortname>
is the mirror's short name, or you can directly use the mirror's URL. For example:pypi ping tsinghua
or
pypi ping https://pypi.org/simple/
pypi list
lists all supported PyPI mirrors and their URLs.pypi use <shortname>
switches to the specified PyPI mirror.pypi ping <shortname|url>
tests the network connectivity of the specified mirror or URL.
List all supported mirrors:
pypi list
Switch to the Aliyun mirror:
pypi use aliyun
Test the connectivity of the Tsinghua mirror:
pypi ping tsinghua
Here are some supported PyPI mirrors and their short names:
- pypi: https://pypi.org/simple/
- aliyun: https://mirrors.aliyun.com/pypi/simple/
- tencent: https://mirrors.cloud.tencent.com/pypi/simple/
- huawei: https://repo.huaweicloud.com/repository/pypi/simple/
- 163: https://mirrors.163.com/pypi/simple/
- tsinghua: https://pypi.tuna.tsinghua.edu.cn/simple/
- bfsu: https://mirrors.bfsu.edu.cn/pypi/web/simple/
More mirrors can be viewed by running pypi list
.
- The
ping
command accepts both mirror short names and direct URLs. - The
use
command requires a valid mirror short name.
To view detailed help information for each command, run:
pypi <command> -h/--help
For example:
pypi use -h
This project is licensed under the MIT License - see the LICENSE file for details.