Skip to main content

一款轻量级的 Python 工具,用于高效测试多个镜像源的连接速度,帮助用户选择最优的镜像源以提高包管理效率。

Project description

pip-fc

pip-fc 全称是:pip fast check

pip-fc 是一个轻量级的 Python 工具,旨在测试多个镜像源的连接速度,并帮助用户选择最快的镜像源进行软件包安装。支持 Python 2.7 和 3.x 版本,能够自动根据环境选择适合的并发模式(asynciothreading)。


功能

  • 测试多个镜像源的连接速度。
    • v0.1.12: 丢弃了部分过时的mirror,使用文件实际下载速度进行测速
  • 自动选择连接速度最快的镜像源。
  • 支持 Python 2.7 和 3.x 版本。
  • 使用异步(asyncio)或线程池(threading)来提高测试效率。
  • 简单易用的命令行界面。

安装

使用 pip 安装:

pip install pip-fc

使用方法

通过运行以下命令启动:

pip-fc 或者 python -m pip_fc

此命令将会测试预设的镜像源,并显示连接速度最快的镜像源。你也可以自定义镜像源进行测试。

设置全局镜像源

如果你希望将测试中找到的最快镜像源设置为全局 pip 镜像源,可以在运行完成后输入 y 来确认:

Do you want to set the fastest mirror as the global pip mirror? (y/n): y

此操作将更新 pip 的配置文件,设置全局镜像源和回退镜像源。

依赖

  • pip:用于安装和管理 Python 包。
  • futures:仅在 Python 2.7 环境下需要,安装时自动处理。

示例输出 v2

Detected Python Version: 3.12.12 (asyncio)
========================================
--- Starting HTTP download (v2) for speedtest (4096 bytes, 3 times average) ---

Mirror HTTP Download Test Results (sorted by speed):
----------------------------------------
Speed (KB/s)    URL                                                         
----------------------------------------
27.53           https://mirrors.cloud.tencent.com/pypi/simple/
26.83           https://mirrors.ustc.edu.cn/pypi/simple/
16.45           https://pypi.tuna.tsinghua.edu.cn/simple/
16.39           https://mirrors.tuna.tsinghua.edu.cn/pypi/web/simple/
2.33            https://repo.huaweicloud.com/repository/pypi/simple/
0.51            https://mirrors.aliyun.com/pypi/simple/
----------------------------------------

*** Fastest mirror is: https://mirrors.cloud.tencent.com/pypi/simple/ (speed: 27.53 KB/s)

= = = = = = = = = = = = = = = = = = = = 

Do you want to set the fastest mirror as the global pip mirror? (y/n): 

Timeout reached! No input received.
Skipping mirror setup.

示例输出 v1

Detected Python Version: 3.8.5 (asyncio)
--- Starting connection speed test using asyncio mode ---
Successfully tested 6 mirrors.
Fastest Mirror: https://pypi.tuna.tsinghua.edu.cn/simple/
Latency: 50.12345 ms

--- All Successful Connection Results (URL, Latency in ms) ---
  https://pypi.tuna.tsinghua.edu.cn/simple/: 50.12345 ms
  https://mirrors.aliyun.com/pypi/simple/: 65.67890 ms
  ...

贡献

欢迎提出问题、提交 bug 或者贡献代码。如果你有任何问题,或者希望添加新特性,请提交 issue

许可

该项目采用 MIT 许可证,详情请见 LICENSE 文件。

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

pip_fc-0.1.12.tar.gz (11.7 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

pip_fc-0.1.12-py3-none-any.whl (10.7 kB view details)

Uploaded Python 3

pip_fc-0.1.12-py2-none-any.whl (10.7 kB view details)

Uploaded Python 2

File details

Details for the file pip_fc-0.1.12.tar.gz.

File metadata

  • Download URL: pip_fc-0.1.12.tar.gz
  • Upload date:
  • Size: 11.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pip_fc-0.1.12.tar.gz
Algorithm Hash digest
SHA256 c5e5e552bfda798ee7a685b24605eed7a827fc43dd0a6409132624426c54ac0e
MD5 02135b39eb70df00d9077ce488951639
BLAKE2b-256 0b63c4219953b7d8e8ed78e67b6643048c9c1467e0b792fe435ccbb37249e983

See more details on using hashes here.

File details

Details for the file pip_fc-0.1.12-py3-none-any.whl.

File metadata

  • Download URL: pip_fc-0.1.12-py3-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pip_fc-0.1.12-py3-none-any.whl
Algorithm Hash digest
SHA256 81a65410f0177ef66c54322d5c19bd0803e17459fcbf4d919eef48546f3f7946
MD5 62219552f820697201f722dedc59881b
BLAKE2b-256 cbc5fa0b457c86bc36e09b83d745249e256dedf0f4747236e20671dca8c76235

See more details on using hashes here.

File details

Details for the file pip_fc-0.1.12-py2-none-any.whl.

File metadata

  • Download URL: pip_fc-0.1.12-py2-none-any.whl
  • Upload date:
  • Size: 10.7 kB
  • Tags: Python 2
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for pip_fc-0.1.12-py2-none-any.whl
Algorithm Hash digest
SHA256 03a705afc43a3d3755d4767c0660bf0a509d2ff6d86bca4916885beb5a7128ac
MD5 8f48b3feac34d93560096c3821a897a4
BLAKE2b-256 5f82643e9c4e72f5ac0d92a5f2d0a71c7ef2817478d07821cd9c7eee35b3003e

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page