Py系列
===================================
:锁定版本: 3.10.16
:生命周期: 2021-10-04~2026-10
:文档: https://docs.python.org/zh-cn/3.10/
:github地址: https://github.com/python/cpython
:版本生命周期: https://devguide.python.org/versions/
:参考: https://pythonguidecn.readthedocs.io/zh/latest/
:awesome-python: https://github.com/vinta/awesome-python
:awesome-python.cn: https://github.com/jobbole/awesome-python-cn
:视频教学: `黑马程序员python教程,8天python从入门到精通,学python看这套就够了 `_
:下载地址: https://www.python.org/downloads/
:风向标项目: django
.. seealso::
* 官方文档: https://docs.python.org/zh-cn/3.10/using/unix.html
* B站: `Linux系统上升级安装Python3.10 `_ (Centos)
* B站: `在Ubuntu服务器安装Python 3.10 `_
* 官网安装包: https://www.python.org/ftp/python/3.10.12/Python-3.10.16.tgz
**源码构建Python**
在root账号操作
官网下载慢,建议在镜像源下载: https://registry.npmmirror.com/binary.html?path=python/
.. code-block:: console
$ wget https://registry.npmmirror.com/-/binary/python/3.10.16/Python-3.10.16.tgz
$ tar -zxvf Python-3.10.16.tgz
$ cd Python-3.10.16/
$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade
$ sudo apt-get install python-dev
$ sudo apt-get install libffi-dev
$ sudo apt-get install libssl-dev
$ sudo apt-get install -y make build-essential libssl-dev zlib1g-dev libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev libncursesw5-dev xz-utils tk-dev
$ ./configure --prefix=/usr/local/python3.10
$ make -j8
$ make altinstall
$ ./configure -C \
--with-openssl=/usr/local/custom-openssl \
--with-openssl-rpath=auto \
--prefix=/usr/local/python3.10
$ ln -s /usr/local/python3.10/bin/python3.10 /usr/local/bin/python3.10
$ ln -s /usr/local/python3.10/bin/pip3.10 /usr/local/bin/pip3.10
**加入环境变量(可选)**
编辑 :file:`~/.bashrc` 和 :file:`$HOME/.profile`
添加一行脚本
.. code-block:: shell
export PATH=$PATH:/usr/local/python3.10/bin/
**安装sqlite3**
解决无法import _sqlite3的问题
https://blog.csdn.net/line_on_database/article/details/116058659
**安装ssl**
解决无法import _ssl的问题
第一种: 升级openssl
操作步骤参考文档: https://docs.python.org/zh-cn/3.10/using/unix.html#custom-openssl
第二种: libressl
.. warning::
实践中,发现Python3.10仍然安装不了_ssl,3.10+只能使用openssl
https://blog.csdn.net/weixin_39703551/article/details/111795468
**缺失_lzma模块**
.. code-block:: console
$ apt-get install liblzma-dev -y
然后重新编译python
ai
-------------------------------------
sentence-transformers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 4.1.0(2025-04-15)
:github: https://github.com/UKPLab/sentence-transformers
:文档: https://www.sbert.net/index.html
在向量数据库召回重排打分时使用, 中文模型建议用BAAI/bge-reranker-large
ollama
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
在本地运行大模型, 对硬件有一定的要求
:锁定版本: 0.6.5(2025-03-12 ~ 2025-04-06)
:github: https://github.com/ollama/ollama
.. seealso::
`Ollama 与 LM Studio,本地 AI 推理工具怎么选? `_
langchain
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.3.17(2024-09-14 ~ 2025-01-30)
:文档: https://python.langchain.com/docs/introduction/
:github: https://github.com/langchain-ai/langchain
langgraph
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.2.72(2024-08-07 ~ 2025-02-13)
:文档: https://langchain-ai.github.io/langgraph/
:github: https://www.github.com/langchain-ai/langgraph
langchain-openai
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.3.5(2025-01-11 ~ 2025-02-12)
:文档: https://python.langchain.com/docs/integrations/chat/openai/
:github: https://github.com/langchain-ai/langchain/tree/master/libs/partners/openai
openai
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 1.61.0(2025-02-01)
:文档: https://github.com/openai/openai-python/tree/main/api.md
:github: https://github.com/openai/openai-python
streamlit
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
构建前端ui的玩具
:锁定版本: 1.41.1(2024-12-11 ~ 2024-12-14)
:文档: https://docs.streamlit.io/
:github: https://github.com/streamlit/streamlit
zhipuai
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
(在嵌入模型使用)
:锁定版本: 2.1.5.20250106(2024-08-30 ~ 2025-01-06)
:文档: https://open.bigmodel.cn/dev/howuse/introduction
后端
-------------------------------------
Django
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 5.0.13(2023-12-04 ~ 2025-03-06)
:文档: https://docs.djangoproject.com/zh-hans/5.0/
:github: https://github.com/django/django
:最新版本: 5.1.7(2025-03-06)
:风向标项目: `cookiecutter-django `_ 的实例化项目
django-filter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 25.1(2025-02-15)
:文档: https://django-filter.readthedocs.io/en/latest/index.html
:github: https://github.com/carltongibson/django-filter
django-environ
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.12.0(2025-01-14)
:文档: https://django-environ.readthedocs.org/
:github: https://github.com/joke2k/django-environ
django-compressor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
帮助优化和减少网页加载时间,在django template中使用
:锁定版本: 4.5.1(2024-06-17 ~ 2024-07-22)
:文档: https://django-compressor.readthedocs.io/en/latest/
:github: https://github.com/django-compressor/django-compressor
djangorestframework
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.15.2(2024-03-17 ~ 2024-06-19)
:文档: https://www.django-rest-framework.org/
:github: https://github.com/encode/django-rest-framework
django-vite
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.0.6(2023-11-15 ~ 2024-12-31)
:github: https://github.com/MrBin99/django-vite
django-configurations
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.5.1(2023-10-21 ~ 2024-03-27)
:文档: https://django-configurations.readthedocs.io/en/latest/
:github: https://github.com/jazzband/django-configurations
Fastapi
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.115.6(2024-09-28 ~ 2024-12-04)
:文档: https://fastapi.tiangolo.com/
:github: https://github.com/fastapi/fastapi
:风向标项目: https://github.com/fastapi/full-stack-fastapi-template
Pandas
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.1.4(2023-08-30 ~ 2023-12-08)
:文档: https://pandas.pydata.org/docs/
:github: https://github.com/pandas-dev/pandas
drf-spectacular
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.28.0(2024-11-30)
:文档: https://drf-spectacular.readthedocs.io/
:github: https://github.com/tfranzel/drf-spectacular
django-redis
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
可以使用原生的redis执行脚本
:锁定版本: 5.4.0(2023-10-02)
:文档: https://github.com/jazzband/django-redis?tab=readme-ov-file#user-guide
:github: https://github.com/jazzband/django-redis
:最新版本: (2025.3.19)
ORM
----------------------------------
sqlalchemy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.0.36(2023-01-27 ~ 2024-10-16)
:文档: https://docs.sqlalchemy.org/
:github: https://docs.sqlalchemy.org/en/20/
sqlmodel
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
sqlalchemy的浅层封装
:锁定版本: 0.0.22(2021-08-24 ~ 2024-08-31)
:文档: https://sqlmodel.tiangolo.com
:github: https://github.com/fastapi/sqlmodel
sqlacodegen
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.3.0.post1(2020-07-13 ~ 2023-03-06)
:github: https://github.com/agronholm/sqlacodegen
插件
----------------------------
django-ninja
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
需要注意的是作者是一名乌克兰人,居住在哈尔科夫
:锁定版本: 1.3.0(2024-08-15)
:文档: https://django-ninja.dev
:github: https://github.com/vitalik/django-ninja
sphinx-tabs
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.4.5(2022-06-25 ~ 2024-01-21)
:文档: https://sphinx-tabs.readthedocs.io/
:github: https://github.com/executablebooks/sphinx-tabs
pydantic-settings
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.7.0(2024-12-13)
:文档: https://docs.pydantic.dev/latest/concepts/pydantic_settings/
:github: https://github.com/pydantic/pydantic-settings
测试
-----------------------------
Faker
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 37.0.1(2025-03-07 ~ 2025-03-19)
:文档: https://faker.readthedocs.io/en/stable/
:github: https://github.com/joke2k/faker
pytest-django
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 4.9.0(2024-09-02)
:文档: https://pytest-django.readthedocs.io/en/latest/index.html
:github: https://github.com/pytest-dev/pytest-django
:变更日志: https://pytest-django.readthedocs.io/en/latest/changelog.html
pytest
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 8.0.2(2024-01-02 ~ 2024-02-25)
:文档: https://docs.pytest.org/en/stable/
:github: https://github.com/pytest-dev/pytest
:变更日志: https://docs.pytest.org/en/stable/changelog.html
:最新版本: 8.3.5(2025-03-02)
pytest-cookies
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.7.0(2023-05-22)
:文档: https://github.com/hackebrot/pytest-cookies?tab=readme-ov-file#usage
:github: https://github.com/hackebrot/pytest-cookies
pytest-xdist
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
并行执行用例
:锁定版本: 3.6.1(2024-04-29)
:文档: https://pytest-xdist.readthedocs.io/en/stable/
:github: https://github.com/pytest-dev/pytest-xdist
pytest-mock
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.14.0
:文档: https://pytest-mock.readthedocs.io/en/latest
:github: https://github.com/pytest-dev/pytest-mock/
freezegun
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 1.5.1(2024-04-24 ~ 2024-05-12)
:文档: https://github.com/spulec/freezegun/blob/master/README.rst
:github: https://github.com/spulec/freezegun
testcontainers
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 4.8.2(2024-06-28 ~ 2024-10-14)
:文档: https://testcontainers-python.readthedocs.io/en/latest/
:github: https://github.com/testcontainers/testcontainers-python
coverage
~~~~~~~~~~~~~~~~~~~~~~~~~~~~
明确支持Ukraine
:锁定版本: 7.6.12(2024-07-12 ~ 2025-02-11)
:文档: https://coverage.readthedocs.io/
:github: https://github.com/nedbat/coveragepy
:变更日志: https://coverage.readthedocs.io/en/7.6.9/changes.html
pytest-playwright
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.6.2(2024-11-26)
:文档: https://playwright.dev/python/docs/intro
:github: https://github.com/microsoft/playwright-pytest
pytest-asyncio
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.25.3(2024-12-13 ~ 2025-01-29)
:文档: https://pytest-asyncio.readthedocs.io/en/latest/
:github: https://github.com/pytest-dev/pytest-asyncio
factory-boy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.3.3(2023-07-19 ~ 2025-02-03)
:文档: https://factoryboy.readthedocs.io/
:github: https://github.com/FactoryBoy/factory_boy
文档
----------------------------
sphinx
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 7.3.7(2024-4-17 ~ 2024-4-19)
:文档: https://www.sphinx-doc.org/
:github: https://github.com/sphinx-doc/sphinx
:变更日志: https://www.sphinx-doc.org/en/master/changes/index.html
sphinx-rtd-theme
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.0.0(2023-11-28)
:文档: https://sphinx-rtd-theme.readthedocs.io/en/stable/
:github: https://github.com/readthedocs/sphinx_rtd_theme
sphinx-autobuild
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2024.10.3(2024-10-03)
:文档: https://github.com/sphinx-doc/sphinx-autobuild?tab=readme-ov-file#sphinx-autobuild
:github: https://github.com/sphinx-doc/sphinx-autobuild
sphinx-copybutton
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.5.2(2022-02-06 ~ 2023-04-14)
:文档: https://sphinx-copybutton.readthedocs.io/en/latest/
:github: https://github.com/executablebooks/sphinx-copybutton
:最新版本: (2025-03-13)
运维
----------------------------
ansible
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 9.13.0(2023-11-12 ~ 2024-12-04)
:文档: https://docs.ansible.com/ansible/latest/index.html
:github: https://github.com/ansible/ansible
:changelog: https://docs.ansible.com/ansible/latest/porting_guides/porting_guides.html & https://github.com/ansible-community/ansible-build-data/blob/main/9/CHANGELOG-v9.rst
应用于部署基础设施及配置文件存储和生效, 例如buildbot、prometheus、nginx等
ansible-lint
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 24.2.3(2024-02-07 ~ 2024-4-30)
:文档: https://ansible.readthedocs.io/projects/lint/
:github: https://github.com/ansible/ansible-lint
:changelog: Not Found
supervisor
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 4.2.5(2020-05-01 ~ 2022-12-24)
:文档: http://supervisord.org/
:github: https://github.com/Supervisor/supervisor
buildbot
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.11.9(2024-01-26 ~ 2024-10-14)
:文档: https://docs.buildbot.net/current/index.html
:github: https://github.com/buildbot/buildbot
模板
---------------------------------
jinja2
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.1.5(2022-03-24 ~ 2024-12-22)
:文档: https://jinja.palletsprojects.com/
:github: https://github.com/pallets/jinja
:重要程度: ***
cookiecutter
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.6.0(2024-02-22)
:文档: https://cookiecutter.readthedocs.io/en/stable/index.html
:github: https://github.com/cookiecutter/cookiecutter
* 提供从需求到落地的解决方案
* 工作环境的低代码工具
抽象企业项目代码风格,将开发思路模板起来, 然后根据实际业务填充业务代码(业务代码没办法模板)
例如excel导入
.. code-block:: python
@action
def imports(self, request, *args, **kwargs):
# 调用封装好的excel处理函数
pass
# ....
pass
# ...
pass
.. _cookiecutter-django:
cookiecutter-django
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2024.10.30(2024-10-30)
:文档: https://cookiecutter-django.readthedocs.io/en/latest
:github: https://github.com/cookiecutter/cookiecutter-django
序列化
--------------------------------
marshmallow-dataclass
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
好处: IDE类型提示
:锁定版本: 8.7.1(2024-06-24 ~ 2024-09-13)
:文档: https://lovasoa.github.io/marshmallow_dataclass/html/marshmallow_dataclass.html
:github: https://github.com/lovasoa/marshmallow_dataclass
http客户端
------------------------------
requests
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.32.3(2024-05-20 ~ 2024-05-29)
:文档: https://requests.readthedocs.io/en/latest/
:github: https://github.com/psf/requests
有空去了解下 https://httpbin.org/
aiohttp
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 3.11.7(2024-11-14 ~ 2024-11-21)
:文档: https://aiohttp.readthedocs.io/
:github: https://github.com/aio-libs/aiohttp
开发工具
---------------------------------
uv
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
由rust编写, 集pyenv、venv、pip等功能于一身的强大工具
:锁定版本: 0.6.4(2025-02-15 ~ 2025-03-04)
:文档: https://docs.astral.sh/uv/
:github: https://github.com/astral-sh/uv
invoke
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make命令的平替工具
:锁定版本: 2.2.0(2023-07-13)
:文档: https://docs.pyinvoke.org/en/stable/
:github: https://github.com/pyinvoke/invoke
ipdb
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.13.13(2020-2-28 ~ 2023-05-09)
:github: https://github.com/gotcha/ipdb
bpython
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.25(2025-01-17)
:文档: https://docs.bpython-interpreter.org/en/latest/index.html
:github: https://github.com/bpython/bpython
watchfiles
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 1.0.4(2024-11-25 ~ 2025-01-10)
:文档: https://watchfiles.helpmanual.io/
:github: https://github.com/samuelcolvin/watchfiles
爬虫
----------------------------------
scrapy
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.10.1(2023-08-04 ~ 2023-08-31)
:文档: https://docs.scrapy.org/
:github: https://github.com/scrapy/scrapy
:变更日志: https://docs.scrapy.org/en/latest/news.html
:视频教程: https://www.bilibili.com/video/BV1gA4m1G7zk
scrapy-playwright
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 0.0.42(2024-11-06)
:github: https://github.com/scrapy-plugins/scrapy-playwright
:变更日志: https://pypi.org/project/scrapy-playwright/docs/changelog.md
beautifulsoup4
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 4.13.3(2025-02-03 ~ 2025-02-05)
:文档: https://www.crummy.com/software/BeautifulSoup/bs4/doc/
异步任务
--------------------------------
django-celery-beat
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.7.0(2024-08-22)
:文档: https://django-celery-beat.readthedocs.io/en/latest/
:github: http://github.com/celery/django-celery-beat
:变更日志: https://django-celery-beat.readthedocs.io/en/latest/changelog.html
:关注issue: https://github.com/celery/django-celery-beat/issues/798
celery
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 5.4.0(2024-04-18)
:文档: https://docs.celeryq.dev/en/stable/index.html
:github: https://github.com/celery/celery
:最新版本: - (2025-03-13)
flower
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:锁定版本: 2.0.1(2023-06-18 ~ 2023-08-13)
:文档: https://flower.readthedocs.io/
:github: https://github.com/mher/flower
:最新确认: 2025-03-24
web服务
--------------------------------------
gunicorn
~~~~~~~~~~~~~~~
:锁定版本: 23.0.0(2024-08-11)
:文档: https://docs.gunicorn.org/en/stable/
:github: https://github.com/benoitc/gunicorn
:变更日志: https://docs.gunicorn.org/en/stable/news.html