Python库之杂项汇总

来源地址:
https://mp.weixin.qq.com/s/sPAomFg-5JZigFUG_CtnaQ

 

1.attrs、cattrs
GitHub:https://github.com/python-attrs/attrs、https://github.com/Tinche/cattrs
简化类的定义、序列化反序列化等操作。
个人写的简介:https://mp.weixin.qq.com/s/oHK-Y4lOeaQCFtDWgqXxFA

2.loguru
GitHub:https://github.com/Delgan/loguru
可简化日志记录写法。
个人写的简介:https://mp.weixin.qq.com/s/5Ri1WS5cTGCNAQ0I_zYycg

3.autopep8
GitHub:https://github.com/hhatto/autopep8
把 Python 代码转成符合 PEP8 规范的代码。

4.psutil
GitHub:https://github.com/giampaolo/psutil
Python 实现任务监控的库。

5.furl
GitHub:https://github.com/gruns/furl
对 url 的处理非常方便,比 urllib 等库好用多。

6.retrying、tenacity
GitHub:https://github.com/rholder/retrying、https://github.com/jd/tenacity
异常重试库,如出错之后重试多少次,尤其在发起一些 HTTP 请求时非常有用,当然也能用于其他地方。

7.typing
Docs:https://docs.python.org/zh-cn/3/library/typing.html#module-typing
对 Python 类型的支持,支持多种类型、嵌套类型,也推荐多多使用 Python 的类型注解。

8.argparse
Docs:https://docs.python.org/zh-cn/3/library/argparse.html
个人曾经使用过几个命令行解析工具,如 docopt,但后来还是转回来了 argparse,功能齐全强大。

9.absl-py
GitHub:https://github.com/abseil/abseil-py
个人感觉比 argparse 更易用的库,如 TensorFlow 就在使用这个,对于定义一些 Flag 非常方便。

10.pipenv
GitHub:https://github.com/pypa/pipenv
功能更全的包管理工具,集成虚拟环境、支持 Lock 机制锁定安装包版本和依赖信息。当然也有坑点,可自行搜索。

11.drf
Docs:https://www.django-rest-framework.org/
基于 Django 的 REST Framework,快速实现 REST API。

12.watchdog
GitHub:https://github.com/gorakhargosh/watchdog
方便监视文件系统改动。

13.glob
Docs:https://docs.python.org/3/library/glob.html
对文件的操作非常方便。

14.2to3
Docs:https://docs.python.org/2/library/2to3.html
把 Python2 代码转成 Python3 代码。

14.glom
GitHub:https://github.com/mahmoud/glom
对 JSON 嵌套的处理非常方便。

15.pathlib
Docs:https://docs.python.org/3/library/pathlib.html
更为方便的 Python 路径操作库。

16.environs
GitHub:https://github.com/sloria/environs
对于环境变量的获取非常方便,支持多种类型,如 int、bool 等。

17.pysnooper
GitHub:https://github.com/cool-RR/PySnooper
非常方便简单的 Python 调试器,可以追踪到代码每一处细节的执行状态。

18.tqdm
GitHub:https://github.com/tqdm/tqdm
进度条控制显示非常方便。

19.sh
GitHub:https://github.com/amoffat/sh
对 Linux 一些命令的封装,简单好用又高效。

20.faker
GitHub:https://github.com/joke2k/faker
模拟数据的生成。

21.arrow、dateutil、dateparser、pendulum
GitHub:https://github.com/crsmithdev/arrow、https://github.com/dateutil/dateutil、https://github.com/scrapinghub/dateparser、https://github.com/sdispater/pendulum
时间解析和处理库,非常方便。arrow 目前 Star 最多,好评最多。

22.yagmail
GitHub:https://github.com/kootenpv/yagmail
方便的发邮件库,替代自带的 smtplib。

23.chardet
GitHub:https://github.com/chardet/chardet
字符串类型编码检测。

24.pypinyin
GitHub:https://github.com/mozillazg/python-pinyin
汉字转拼音,在一些中文转化处理上很有用。

25.sphinx
Docs:https://www.sphinx-doc.org/en/master/
编写文档使用,大多数 Python 库文档都是这个写的,如 Scrapy、requests。

26.jinja2
GitHub:https://github.com/pallets/jinja
一个方便的模板引擎,呈现页面时很方便。

27.click
GitHub:https://github.com/pallets/click
更方便灵活地实现命令行传递参数。

28.ray
GitHub:https://github.com/ray-project/ray
分布式多进程管理。

29.supervisor
GitHub:https://github.com/Supervisor/supervisor
进程管理工具,如实现多任务后台运行,Docker 打包时会经常用到。

30.apscheduler
GitHub:https://github.com/agronholm/apscheduler
Python 定时任务,不过 K8S 也可以实现,个人目前可能更倾向于 K8S。

31.intelpython
Home:https://software.intel.com/en-us/distribution-for-python
这不是 Python 库,是一个 Intel 开发的基于 Intel 处理器优化的 Python 解释器,对于大规模运算提升很大

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值