中文 | 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 for pip and uv, and test mirror connectivity.
Using git
git clone https://github.com/belingud/pypi ${ZSH_CUSTOM:-~/.oh-my-zsh/custom}/plugins/pypiOr 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> [--pip|--uv|--all]
Switch to the specified mirror, where
<shortname>is the mirror's short name. The target flags are:--pip: updatepiponly, the default--uv: update the user-leveluvconfig only--all: update bothpipanduv
For example:
pypi use aliyun
pypi use aliyun --uv
pypi use aliyun --all
-
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/
-
Show Current Configuration
pypi cur [--pip|--uv|--all]
Show the current mirror configuration for
pipand/oruv. For example:pypi cur
pypi cur --all
pypi listlists all supported PyPI mirrors and their URLs.pypi use <shortname> [--pip|--uv|--all]switches to the specified PyPI mirror.pypi ping <shortname|url>tests the network connectivity of the specified mirror or URL.pypi cur [--pip|--uv|--all]shows the current mirror configuration forpipand/oruv.
List all supported mirrors:
pypi listSwitch to the Aliyun mirror:
pypi use aliyunSwitch only the user-level uv config to the Aliyun mirror:
pypi use aliyun --uvSwitch both pip and uv to the Tsinghua mirror:
pypi use tsinghua --allTest the connectivity of the Tsinghua mirror:
pypi ping tsinghuaShow the current pip and uv configuration:
pypi cur --allHere 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
pingcommand accepts both mirror short names and direct URLs. - The
usecommand requires a valid mirror short name. pypi use <shortname>updatespiponly by default. Use--uvor--allto updateuv.uvis managed via the user-level config file at${XDG_CONFIG_HOME:-~/.config}/uv/uv.toml.- If the
uvconfig file does not exist, the plugin creates it. If index-related settings already exist, the plugin normalizes those settings into a single-mirror configuration while preserving non-index settings. - Project-level
uvconfig, environment variables, and CLI flags can override the user-level config.
To view detailed help information for each command, run:
pypi <command> -h/--helpFor example:
pypi use -hThis project is licensed under the MIT License - see the LICENSE file for details.