分类目录归档:github

Scikit-learn-SCRKIT-学习:Python中的机器学习



Scikit-learn 是构建在SciPy之上的用于机器学习的Python模块。

该项目由David Cournapeau于2007年作为Google Summer of Code项目启动,从那时起,许多志愿者都做出了贡献。请参阅About us获取核心贡献者列表的页面。

它目前由一支志愿者团队负责维护。

网站:https://scikit-learn.org

安装

依赖项

SCRICKIT-学习要求:

  • Python(>=3.7)
  • NumPy(>=1.14.6)
  • SciPy(>=1.1.0)
  • joblib(>=0.11)
  • threadpoolctl(>=2.0.0)

Scikit-Learn 0.20是支持Python 2.7和Python 3.4的最后一个版本SCRICKIT-学习0.23和更高版本需要Python3.6或更高版本。SCRICKIT-学习1.0和更高版本需要Python 3.7或更高版本

Scikit-了解绘图功能(即函数以plot_并且类以“display”结尾)需要Matplotlib(>=2.2.2)。要运行示例,需要Matplotlib>=2.2.2。少数示例需要SCRICKIT-image>=0.14.5,少数示例需要熊猫>=0.25.0,有些示例需要海运>=0.9.0

用户安装

如果您已经安装了能正常工作的Numpy和Scipy,则安装SCRICIT-LEARN的最简单方法是使用pip

pip install -U scikit-learn

conda

conda install -c conda-forge scikit-learn

该文档包括更详细的installation instructions

更改日志

请参阅changelog有关SCRICKIT显著变化的历史-了解

发展

我们欢迎所有经验水平的新贡献者。科学工具包学习社区的目标是帮助、欢迎和有效。这个Development Guide包含有关贡献代码、文档、测试等的详细信息。我们在本自述中包含了一些基本信息

重要链接

源代码

您可以使用以下命令查看最新的源代码:

git clone https://github.com/scikit-learn/scikit-learn.git

贡献

要了解更多关于为SCRICKIT-LEARN做出贡献的信息,请参阅我们的Contributing guide

测试

安装之后,您可以从源目录外部启动测试套件(您将需要pytest>=5.0.1已安装):

pytest sklearn

请参阅网页https://scikit-learn.org/dev/developers/advanced_installation.html#testing了解更多信息

随机数生成可以在测试期间通过设置SKLEARN_SEED环境变量

提交拉取请求

在打开拉取请求之前,请查看完整的贡献页面,以确保您的代码符合我们的指导原则:https://scikit-learn.org/stable/developers/index.html

项目历史记录

该项目由David Cournapeau于2007年作为Google Summer of Code项目启动,从那时起,许多志愿者都做出了贡献。请参阅About us获取核心贡献者列表的页面

该项目目前由一组志愿者负责维护。

注意事项:SCRICIT-LEARN以前被称为SCRICKIT。

帮助和支持

文档

沟通

引文

如果您在科学出版物中使用SCRICKIT-LEARN,我们将非常感谢您的引用:https://scikit-learn.org/stable/about.html#citing-scikit-learn

Ansible 一个极其简单的IT自动化平台

基本介绍

Ansible是一个非常简单的IT自动化系统。它处理配置管理、应用部署、云调配、临时任务执行、网络自动化和多节点协调。Ansible使使用负载均衡器进行零宕机滚动更新等复杂更改变得容易。关于Ansible的更多信息: website

设计原则

  • 设置过程极其简单,学习曲线最短
  • 快速、并行地管理计算机
  • 避免自定义代理和其他开放端口,通过利用现有SSH守护进程实现无代理
  • 用对机器和人都友好的语言描述基础架构
  • 重点关注内容的安全性和易审核性/审阅/重写
  • 即时管理新的远程计算机,无需引导任何软件
  • 允许使用任何动态语言进行模块开发,而不仅仅是Python
  • 可作为非根用户使用
  • 成为有史以来最易于使用的IT自动化系统

使用Ansible

您可以使用安装Ansible的发布版本pip或者是包裹管理员。请参阅我们的installation guide有关在各种平台上安装Ansible的详细信息

Red Hat提供受支持的Ansible Engine

高级用户和开发人员可以运行devel分支,它具有最新的功能和修复,直接。虽然它相当稳定,但在运行时更有可能遇到破坏性更改。devel布兰奇。我们建议您参与Ansible社区,如果您想要运行devel分支机构

参与进来吧

  • 朗读Community
    Information
    以各种方式为项目做出贡献并与之交互,包括邮件列表信息以及如何向Ansible提交错误报告和代码
  • 加入Working Group,一个致力于特定技术领域或平台的有组织的社区
  • 通过拉入请求将建议的代码更新提交给devel分支机构
  • 在进行更大规模的更改之前,请与我们联系,以避免重复工作。这不仅帮助每个人了解正在发生的事情,而且如果我们决定需要进行一些更改,它还有助于节省时间和精力
  • 有关电子邮件列表、IRC频道和工作组的列表,请参阅Communication page

编码指南

我们将我们的编码指南记录在Developer Guide我们特别建议您回顾一下:

分支机构信息

  • 这个devel分支对应于正在积极开发的版本
  • 这个stable-2.X分支对应于稳定版本
  • 根据以下内容创建分支devel并设置一个dev environment如果您想要打开公关
  • 请参阅Ansible release and maintenance有关活动分支机构的信息,请参见页面

路线图

根据团队和社区的反馈,将发布主要或次要版本(例如:2.7、2.8)的初始路线图。这个Ansible Roadmap page详细说明计划的内容以及如何影响路线图

作者

Ansible是由Michael DeHaan并拥有超过5000名用户的贡献(而且还在不断增加)。谢谢大家!

Ansible赞助商是Red Hat, Inc.

许可证

GNU通用公共许可证v3.0或更高版本

看见COPYING要查看全文,请执行以下操作

Pytorch-强GPU加速的Python中的张量和动态神经网络

PyTorch是一个Python软件包,提供了两个高级功能。

张量计算(如NumPy),具有强大的GPU加速能力,建立在基于磁带的autograd系统上的深度神经网络,在需要的时候,你可以重复使用你最喜欢的Python包,如NumPy、SciPy和Cython,来扩展PyTorch。

系统 3.6 3.7 3.8
Linux CPU
Linux GPU
Windows CPU/GPU
Linux(Ppc64le)CPU
Linux(Ppc64le)GPU
Linux(Aarch64)CPU

另请参阅ci.pytorch.org HUD

更多关于PyTorch的信息

在粒度级别上,PyTorch是一个由以下组件组成的库:

组件 描述
火炬 像NumPy这样的张量器库,具有强大的GPU支持
torch.autograd 基于磁带的自动区分库,支持TORCH中的所有可微分张量操作
torch.jit 从PyTorch代码创建可序列化和可优化模型的编译堆栈(TorchScript)
torch.nn 与Autograd深度集成的神经网络库,旨在实现最大的灵活性
torch.multiprocessing Python多处理,但具有跨进程共享火炬张量的神奇内存。适用于数据加载和HogWild培训
torch.utils 为方便起见,DataLoader和其他实用程序功能

通常,PyTorch用作以下任一用途:

  • 替代NumPy使用GPU的功能
  • 提供最大灵活性和速度的深度学习研究平台

进一步阐述:

一种支持GPU的张量库

如果您使用NumPy,则您使用的是张量(也称为(Ndarray)

PyTorch提供的张量既可以在CPU上运行,也可以在GPU上运行,从而将计算速度大幅提高

我们提供各种各样的张量例程来加速和满足您的科学计算需求,例如切片、索引、数学运算、线性代数、约简。而且他们跑得很快!

动态神经网络:基于磁带的自动评分

PyTorch有一种构建神经网络的独特方式:使用和重放磁带录音机

大多数框架,如TensorFlow、Theano、Caffe和CNTK都有静电的世界观。人们必须建立一个神经网络,并一次又一次地重复使用相同的结构。改变网络的行为方式意味着必须从头开始

对于PyTorch,我们使用一种称为反向模式自动区分的技术,该技术允许您在没有延迟或开销的情况下任意更改网络的行为方式。我们的灵感来自于几篇关于这一主题的研究论文,以及目前和过去的工作,如手电筒-自动分级自动评分链条

虽然这种技术不是PyTorch独有的,但它是迄今为止最快的实现之一。你在疯狂的研究中获得了最快的速度和最好的灵活性

Python优先

PyTorch不是到单一C++框架的Python绑定。它是为深度集成到Python而构建的。你可以像以前一样自然地使用它NumPy/科学Py/科学工具包-学习等。您可以用Python本身编写新的神经网络层,使用您喜欢的库并使用包,如CythonNumba我们的目标是不在适当的地方重新发明轮子。

势在必行的经验

PyTorch被设计为直观、线性的思想,并且易于使用。当您执行一行代码时,它就会被执行。没有异步的世界观。当您进入调试器或接收错误消息和堆栈跟踪时,理解它们很简单。堆栈跟踪准确地指向定义代码的位置。我们希望您永远不要因为错误的堆栈跟踪或异步且不透明的执行引擎而花费数小时调试您的代码

快速精益

PyTorch的框架开销最小。我们集成了加速库,如英特尔MKL和NVIDIA(CuDNNNCCL)以最大限度地提高速度。在核心上,其CPU和GPU张量以及神经网络后端(TH、THC、THNN、THCUNN)已经成熟,并且经过多年的测试

因此,PyTorch是相当快的-无论您运行的是小型神经网络还是大型神经网络

与Torch或某些替代方案相比,PyTorch中的内存使用效率非常高。我们已经为GPU编写了自定义内存分配器,以确保您的深度学习模型具有最高的内存效率。这使您能够训练比以前更大的深度学习模型

无痛延长

编写新的神经网络模块,或者与PyTorch的张量API接口,设计得简单明了,抽象最少

您可以使用Torch API在Python中编写新的神经网络图层或者您最喜欢的基于NumPy的库,如SciPy

如果您想用C/C++编写您的层,我们提供了一个方便的扩展API,它是高效的,并且具有最少的样板。不需要编写包装器代码。你可以看到此处提供教程这里有一个例子

安装

二进制文件

通过conda或pip轮从二进制文件安装的命令在我们的网站上提供:https://pytorch.org

NVIDIA Jetson平台

NVIDIA的Jetson Nano、Jetson TX2和Jetson AGX Xavier的Python轮可通过以下URL获得:

它们需要JetPack 4.2和更高版本,以及@达斯蒂-内华达州维护它们

来自源

如果从源代码安装,则需要Python 3.6.2或更高版本和C++14编译器。此外,我们强烈建议您安装蟒蛇环境。您将获得一个高质量的BLAS库(MKL),并且无论您的Linux发行版是什么,您都可以获得受控的依赖项版本

一旦你有了蟒蛇已安装,以下是说明

如果要使用CUDA支持进行编译,请安装

如果要禁用CUDA支持,请导出环境变量USE_CUDA=0其他可能有用的环境变量可以在setup.py

如果您正在为NVIDIA的Jetson平台(Jetson Nano、TX1、TX2、AGX Xavier)构建,请参阅以下安装PyTorch for Jetson Nano的说明此处提供

如果要使用ROCM支持进行编译,请安装

  • AMD ROCM4.0及更高版本的安装
  • ROCM目前仅支持Linux系统

如果要禁用ROCM支持,请导出环境变量USE_ROCM=0其他可能有用的环境变量可以在setup.py

安装依赖项

常见

conda install astunparse numpy ninja pyyaml mkl mkl-include setuptools cmake cffi typing_extensions future six requests dataclasses

在Linux上

# CUDA only: Add LAPACK support for the GPU if needed
conda install -c pytorch magma-cuda110  # or the magma-cuda* that matches your CUDA version from https://anaconda.org/pytorch/repo

在MacOS上

# Add these packages if torch.distributed is needed
conda install pkg-config libuv

在Windows上

# Add these packages if torch.distributed is needed.
# Distributed package support on Windows is a prototype feature and is subject to changes.
conda install -c conda-forge libuv=1.39

获取PyTorch源代码

git clone --recursive https://github.com/pytorch/pytorch
cd pytorch
# if you are updating an existing checkout
git submodule sync
git submodule update --init --recursive --jobs 0

安装PyTorch

在Linux上

export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py install

请注意,如果您正在为ROCM编译,则必须首先运行此命令:

python tools/amd_build/build_amd.py

请注意,如果您使用的是Python,您可能会遇到链接器导致的错误:

build/temp.linux-x86_64-3.7/torch/csrc/stub.o: file not recognized: file format not recognized
collect2: error: ld returned 1 exit status
error: command 'g++' failed with exit status 1

这是由以下原因引起的ld从Conda环境跟踪系统ld您应该使用较新版本的Python来修复此问题。推荐的Python版本为3.6.10+、3.7.6+和3.8.1+

在MacOS上

export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py install

每个CUDA版本仅支持一个特定的XCode版本。据报道,以下组合可与PyTorch配合使用

CUDA版 Xcode版本
10.0 Xcode 9.4
10.1 Xcode 10.1

在Windows上

选择正确的Visual Studio版本

在Visual Studio的新版本中有时会出现回归,因此最好使用相同的Visual Studio版本16.8.5作为Pytorch CI。虽然PyTorch CI使用Visual Studio BuildTools,但您可以使用Visual Studio Enterprise、Professional或Community

如果您想构建遗留的python代码,请参阅在遗留代码和CUDA的基础上构建

使用CPU构建

使用CPU构建相当容易

有关OpenMP的说明:所需的OpenMP实施是英特尔OpenMP(IOMP)。为了链接到iomp,您需要手动下载库并通过调整设置构建环境CMAKE_INCLUDE_PATHLIB该说明这里是设置MKL和英特尔OpenMP的示例。如果没有这些CMake配置,将使用Microsoft Visual C OpenMP运行时(vcomp

使用CUDA构建

NVTX是使用CUDA构建Pytorch所必需的。NVTX是CUDA分布式的一部分,被称为“NSight Compute”。要将其安装到已安装的CUDA上,请再次运行CUDA安装并选中相应的复选框。确保在Visual Studio之后安装带Night Compute的CUDA

目前支持VS 2017/2019,支持忍者作为CMake的生成器。如果ninja.exe在以下位置检测到PATH,则使用忍者作为默认生成器,否则将使用VS 2017/2019
如果选择忍者作为生成器,则会选择最新的MSVC作为底层工具链

其他库,如岩浆oneDNN,也称为MKLDNN或DNNL,以及Sccache是经常需要的。请参阅安装帮助器要安装它们,请执行以下操作

您可以参考build_pytorch.bat其他一些环境变量配置的脚本

cmd

:: [Optional] If you want to build with the VS 2017 generator for old CUDA and PyTorch, please change the value in the next line to `Visual Studio 15 2017`.
:: Note: This value is useless if Ninja is detected. However, you can force that by using `set USE_NINJA=OFF`.
set CMAKE_GENERATOR=Visual Studio 16 2019

:: Read the content in the previous section carefully before you proceed.
:: [Optional] If you want to override the underlying toolset used by Ninja and Visual Studio with CUDA, please run the following script block.
:: "Visual Studio 2019 Developer Command Prompt" will be run automatically.
:: Make sure you have CMake >= 3.12 before you do this when you use the Visual Studio generator.
set CMAKE_GENERATOR_TOOLSET_VERSION=14.27
set DISTUTILS_USE_SDK=1
for /f "usebackq tokens=*" %i in (`"%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" -version [15^,16^) -products * -latest -property installationPath`) do call "%i\VC\Auxiliary\Build\vcvarsall.bat" x64 -vcvars_ver=%CMAKE_GENERATOR_TOOLSET_VERSION%

:: [Optional] If you want to override the CUDA host compiler
set CUDAHOSTCXX=C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Tools\MSVC\14.27.29110\bin\HostX64\x64\cl.exe

python setup.py install
调整生成选项(可选)

您可以通过执行以下操作来调整cmake变量的配置(无需首先构建)。例如,可以通过这样的步骤来调整CuDNN或BLAS的预先检测的目录

在Linux上

export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
python setup.py build --cmake-only
ccmake build  # or cmake-gui build

在MacOS上

export CMAKE_PREFIX_PATH=${CONDA_PREFIX:-"$(dirname $(which conda))/../"}
MACOSX_DEPLOYMENT_TARGET=10.9 CC=clang CXX=clang++ python setup.py build --cmake-only
ccmake build  # or cmake-gui build

Docker镜像

使用预构建映像

您还可以从Docker Hub获取预构建的坞站映像,并使用Docker v19.03+运行

docker run --gpus all --rm -ti --ipc=host pytorch/pytorch:latest

请注意,PyTorch使用共享内存在进程之间共享数据,因此如果使用Torch多处理(例如,对于多线程数据加载器),运行容器的默认共享内存段大小是不够的,您应该使用以下两种方法之一来增加共享内存大小--ipc=host--shm-size命令行选项用于nvidia-docker run

自己打造形象

注:必须使用18.06以上的坞站版本构建

这个Dockerfile用于构建支持CUDA 11.1和cuDNN V8的映像。你可以通过PYTHON_VERSION=x.yMake Variable指定Miniconda要使用的Python版本,或将其保留为未设置为使用默认版本

make -f docker.Makefile
# images are tagged as docker.io/${your_docker_username}/pytorch

构建文档

要构建各种格式的文档,您需要狮身人面像以及阅读文档的主题

cd docs/
pip install -r requirements.txt

然后,您可以通过运行以下命令来生成文档make <format>docs/文件夹。跑make要获取所有可用输出格式的列表,请执行以下操作

如果运行Katex错误npm install katex如果它持续存在,请尝试npm install -g katex

以前的版本

早期PyTorch版本的安装说明和二进制文件可在以下位置找到我们的网站

快速入门

帮助您入门的三点建议:

资源

沟通

发布和贡献

PyTorch有90天的发布周期(主要版本)。如果您通过以下方式遇到错误,请通知我们提交问题

我们感谢所有的贡献。如果您计划回馈错误修复,请在不做任何进一步讨论的情况下这样做

如果您计划为核心贡献新的功能、实用程序功能或扩展,请先打开一个问题并与我们讨论该功能。未经讨论发送PR可能最终导致拒绝PR,因为我们可能会将核心带到与您可能意识到的方向不同的方向

要了解更多关于为Pytorch做出贡献的信息,请参阅我们的投稿页面

团队

PyTorch是一个社区驱动的项目,有几个熟练的工程师和研究人员参与其中

PyTorch目前由亚当·帕兹克萨姆·格罗斯苏史密斯·钦塔拉格雷戈里·查南(Gregory Chanan)主要贡献来自于数以百计的各种形式和手段的人才。值得一提的是:特雷弗·基林(Trevor Killeen)、萨桑克·奇拉姆库尔蒂(Sasank Chilamkurthy)、谢尔盖·扎戈鲁伊科(Sergey Zagoruyko)、亚当·莱勒(Adam Lerer)、弗朗西斯科·马萨(Francisco Massa)、阿利汗·特贾尼(Alykhan Tejani)、卢卡·安提加(Luca Antiga)、阿尔班·德斯迈森(Alban Desmaison)、安德烈亚斯·科普夫(Andreas Koepf)、詹姆斯·布拉德伯里(James Bradbury)、林泽明、田远东、纪尧姆·兰普尔(Guillaume Lample

注:此项目与哈伯金/火炬同名同姓。休是Torch社区的一位有价值的贡献者,并在Torch和PyTorch的许多事情上提供了帮助

许可证

PyTorch具有BSD样式的许可证,可以在许可证

Keras-人类的深度学习

Keras: Deep Learning for humans

此存储库托管Kera库的开发。阅读keras.io上的文档

关于Keras

KERAS是一个用Python编写的深度学习API,运行在机器学习平台TensorFlow之上。它的开发重点是实现快速实验。能够尽快从想法转化为结果是做好研究的关键。

Keras特点是:

  • Simple
  • Flexible
  • Powerful

Kera&TensorFlow 2

TensorFlow 2是一个端到端的开源机器学习平台。您可以将其视为可区分编程的基础架构层。它结合了四项关键功能:

  • Efficiently executing low-level tensor operations on CPU, GPU, or TPU.
  • Computing the gradient of arbitrary differentiable expressions.
  • Scaling computation to many devices, such as clusters of hundreds of GPUs.
  • Exporting programs (“graphs”) to external runtimes such as servers, browsers, mobile and embedded devices.

KERAS是TensorFlow 2的高级API:TensorFlow 2是一个平易近人、高效的界面,用于解决机器学习问题,重点是现代深度学习。它为开发和发布高迭代速度的机器学习解决方案提供了必要的抽象和构建块

Kera使工程师和研究人员能够充分利用TensorFlow 2的可扩展性和跨平台功能:您可以在TPU或大型GPU群集上运行Kera,还可以导出Kera模型以在浏览器或移动设备上运行


与Keras的第一次接触

KERAS的核心数据结构是层和模型。最简单的模型类型是顺序模型,即层的线性堆栈。对于更复杂的体系结构,您应该使用Kera Functional API,它允许构建任意的层图,或者通过子类化完全从头开始编写模型

以下是顺序模型:

from tensorflow.keras.models import Sequential

model = Sequential()

堆叠层与.add()一样简单:

from tensorflow.keras.layers import Dense

model.add(Dense(units=64, activation='relu'))
model.add(Dense(units=10, activation='softmax'))

一旦您的模型看起来不错,就可以使用.Compile()配置其学习过程:

model.compile(loss='categorical_crossentropy',
              optimizer='sgd',
              metrics=['accuracy'])

如果需要,您可以进一步配置优化器。KERAS的理念是让简单的事情变得简单,同时允许用户在需要的时候完全控制(最终的控制是通过子类化实现源代码的轻松可扩展性)

model.compile(loss=tf.keras.losses.categorical_crossentropy,
              optimizer=tf.keras.optimizers.SGD(
                  learning_rate=0.01, momentum=0.9, nesterov=True))

现在,您可以批量迭代您的培训数据:

# x_train and y_train are Numpy arrays.
model.fit(x_train, y_train, epochs=5, batch_size=32)

在一行中评估您的测试损失和指标:

loss_and_metrics = model.evaluate(x_test, y_test, batch_size=128)

或对新数据生成预测:

classes = model.predict(x_test, batch_size=128)

您刚才看到的是使用KERAS的最基本的方式

然而,KERAS也是一个高度灵活的框架,适合重复最先进的研究思想。KERAS遵循逐步披露复杂性的原则:它使入门变得容易,但它使处理任意高级用例成为可能,每一步只需要增量学习

就像您可以用几行代码训练和评估上面的简单神经网络一样,您可以使用KERAS快速开发新的训练过程或奇异的模型体系结构。以下是一个低级培训循环示例,将KERAS功能与TensorFlow GradientTape相结合:

import tensorflow as tf

# Prepare an optimizer.
optimizer = tf.keras.optimizers.Adam()
# Prepare a loss function.
loss_fn = tf.keras.losses.kl_divergence

# Iterate over the batches of a dataset.
for inputs, targets in dataset:
    # Open a GradientTape.
    with tf.GradientTape() as tape:
        # Forward pass.
        predictions = model(inputs)
        # Compute the loss value for this batch.
        loss_value = loss_fn(targets, predictions)

    # Get gradients of loss wrt the weights.
    gradients = tape.gradient(loss_value, model.trainable_weights)
    # Update the weights of the model.
    optimizer.apply_gradients(zip(gradients, model.trainable_weights))

有关KERAS的更多深入教程,您可以查看:


安装

Kera与TensorFlow2一起打包为tensorflow.keras。要开始使用Kera,只需安装TensorFlow 2


支持

您可以提问并加入发展讨论:

您还可以在GitHub问题中发布错误报告和功能请求(仅限)

Project-based-learning-基于项目的教程的精选列表

Project Based Learning

编程教程列表,学员可以在这些教程中从头开始构建应用程序。这些教程分为不同的主要编程语言。有些拥有混合的技术和语言

要开始,只需fork此仓库即可。有关投稿指南,请参阅CONTRIBUTING.md

目录:

C/C++:

网络编程

OpenGL:

C#:

闭合:

灵丹妙药

二郎

F编号:

Java:

JavaScript:

HTML和CSS:

移动应用:

Web应用程序:

节点:

VUE

其他(Hapi,Express.):

D3.js

Others (Hapi, Express…):

D3.js

游戏开发:

桌面应用程序:

其他:

科特林:

Lua:

L?VE:

巨蟒:

网络抓取:

机器人:

数据科学:

机器学习:

OpenCV:

深度学习:

Ruby on Rails:

反应:

开始:

PHP:

OCaml:

红宝石:

角度:

哈斯克尔:

R:

Rust:

Scala:

Swift:

其他资源

Flask-用于构建Web应用程序的Python微框架

Flask

Flask是一个轻量级的WSGI Web应用程序框架。它旨在使入门变得快速而简单,并且能够向上扩展到复杂的应用程序。它最初只是Werkzeug和JJJA_的一个简单包装器,现在已经成为最流行的Python Web应用程序框架之一

Fask提供建议,但不强制执行任何依赖项或项目布局。由开发人员选择他们想要使用的工具和库。社区提供了许多扩展,使添加新功能变得容易

 

一个简单的例子

使用pip_安装和更新:

$ pip install -U Flask

_PIP:https://pip.pypa.io/en/stable/quickstart/

贡献

代码-挡路::蟒蛇

# save this as app.py
from flask import Flask

app = Flask(__name__)

@app.route("/")
def hello():
    return "Hello, World!"

有关设置开发环境以及如何为Flask做出贡献的指导,请参阅贡献指南_

$ flask run
  * Running on http://127.0.0.1:5000/ (Press CTRL+C to quit)

捐赠

_投稿指南:https://github.com/pallets/flask/blob/main/CONTRIBUTING.rst

托盘组织开发并支持Flask及其使用的库。为了扩大贡献者和用户的社区,让维护人员有更多的时间在项目上投入更多的时间,请今天就捐款。

链接

  • Documentation: https://flask.palletsprojects.com/
  • Changes: https://flask.palletsprojects.com/changes/
  • PyPI Releases: https://pypi.org/project/Flask/
  • Source Code: https://github.com/pallets/flask/
  • Issue Tracker: https://github.com/pallets/flask/issues/
  • Website: https://palletsprojects.com/p/flask/
  • Twitter: https://twitter.com/PalletsTeam
  • Chat: https://discord.gg/pallets

Django-为有最后期限的完美主义者准备的Web框架

Django是一个高级Python Web框架,它鼓励快速开发和干净、实用的设计。感谢您的查看

所有文档都在“docs”目录中,并在线访问https://docs.djangoproject.com/en/stable/.如果您刚刚开始,以下是我们建议您阅读文档的方法:

  • 首先,阅读docs/info/install.txt以获得有关安装Django的说明
  • 接下来,按顺序学习教程(docs/info/tutorial01.txt、docs/info/tutorial02.txt等)。
  • 如果要设置实际的部署服务器,请阅读docs/HOWTO/Deployment/index.txt以获取说明
  • 接下来,您可能想要通读主题指南(在文档/主题中);从那里您可以跳到HOWTO(在文档/HOWTO中)以了解特定问题,并查看参考资料(Docs/ref)以了解血淋淋的详细信息
  • 有关构建文档的HTML版本的说明,请参见docs/readme

文档会严格更新。如果您在文档中发现任何问题,或者认为应该以任何方式加以澄清,请在这里花30秒填写一张罚单:https://code.djangoproject.com/newticket

要获得更多帮助,请执行以下操作:

  • 加入irc.Libera.chat上的#Django频道。那里有很多乐于助人的人。如果您刚接触irc,请访问https://web.libera.chat。
  • 加入Django-Users邮件列表,或在https://groups.google.com/group/django-users上阅读存档

要对Django做出贡献,请执行以下操作:

  • Check out https://docs.djangoproject.com/en/dev/internals/contributing/ for
    information about getting involved.

要运行Django的测试套件,请执行以下操作:

  • Follow the instructions in the “Unit tests” section of
    docs/internals/contributing/writing-code/unit-tests.txt, published online at
    https://docs.djangoproject.com/en/dev/internals/contributing/writing-code/unit-tests/#running-the-unit-tests

Supporting the Development of Django

Django 的发展有赖于你们的贡献。

如果您依赖Django,请记住支持Django软件基金会:https://www.djangoproject.com/fundraising/

Thefuck-一款出色的应用程序,可更正您之前的控制台命令

The Fuck

The Fuck是一款很棒的应用程序,灵感来自@liamosaur推文,它可以纠正之前控制台命令中的错误

更多示例:

➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim [enter/↑/↓/ctrl+c]
[sudo] password for nvbn:
Reading package lists... Done
...
➜ git push
fatal: The current branch master has no upstream branch.
To push the current branch and set the remote as upstream, use

    git push --set-upstream origin master


➜ fuck
git push --set-upstream origin master [enter/↑/↓/ctrl+c]
Counting objects: 9, done.
...
➜ puthon
No command 'puthon' found, did you mean:
 Command 'python' from package 'python-minimal' (main)
 Command 'python' from package 'python3' (main)
zsh: command not found: puthon

➜ fuck
python [enter/↑/↓/ctrl+c]
Python 3.4.2 (default, Oct  8 2014, 13:08:17)
...
➜ git brnch
git: 'brnch' is not a git command. See 'git --help'.

Did you mean this?
    branch

➜ fuck
git branch [enter/↑/↓/ctrl+c]
* master
➜ lein rpl
'rpl' is not a task. See 'lein help'.

Did you mean this?
         repl

➜ fuck
lein repl [enter/↑/↓/ctrl+c]
nREPL server started on port 54848 on host 127.0.0.1 - nrepl://127.0.0.1:54848
REPL-y 0.3.1
...

如果您不怕盲目运行更正后的命令,可以禁用REQUIRED_CONFIRMATION设置选项:

➜ apt-get install vim
E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

➜ fuck
sudo apt-get install vim
[sudo] password for nvbn:
Reading package lists... Done
...

安装

  • python (3.4+)
  • pip
  • python-dev

在MacOS上,您可以通过Homebrew(或Linux上的Linuxbrew)安装Fuck:

brew install thefuck

在Ubuntu/Mint上,使用以下命令安装Fuck:

sudo apt update
sudo apt install python3-dev python3-pip python3-setuptools
sudo pip3 install thefuck

在FreeBSD上,使用以下命令安装Fuck:

pkg install thefuck

在ChromeOS上,使用以下命令使用chromebrew安装Fuck:

crew install thefuck

在其他系统上,使用pip安装Fuck:

pip install thefuck

或者,您也可以使用操作系统包管理器(OS X、Ubuntu、Arch)

#建议您将此命令放在.bash_profile、.bashrc、.zshc或其他启动脚本中:

eval $(thefuck --alias)
# You can use whatever you want as an alias, like for Mondays:
eval $(thefuck --alias FUCK)

或者在您的shell配置中(bash、zsh、Fish、powershell、tcsh)

更改仅在新的shell会话中可用。要使更改立即可用,请运行source~/.bashrc(或您的shell配置文件,如.zshc)

要在没有确认的情况下运行已修复的命令,请使用–yes选项(或者简称为-y,如果您特别沮丧,则使用–hard):

fuck --yeah

要递归修复命令直到成功,请使用-r选项:

fuck -r
Back to Contents

卸载

pip3 install thefuck --upgrade

注意:别名功能在Fuck的1.34版中已更改

它是如何工作的

要删除,请颠倒安装过程:-从您的Bash、zsh、Fish、powershell、tcsh中删除或注释别名行。shell配置-使用软件包管理器(BREW、PIP3、pkg、Crew、pip)卸载二进制文件

创建您自己的规则

The Fuck 试图将前一条命令与规则相匹配。如果找到匹配项,则使用匹配的规则创建新命令并执行。默认情况下启用以下规则:

  • adb_unknown_command – fixes misspelled commands like adb logcta;
  • ag_literal – adds -Q to ag when suggested;
  • aws_cli – fixes misspelled commands like aws dynamdb scan;
  • az_cli – fixes misspelled commands like az providers;
  • cargo – runs cargo build instead of cargo;
  • cargo_no_command – fixes wrongs commands like cargo buid;
  • cat_dir – replaces cat with ls when you try to cat a directory;
  • cd_correction – spellchecks and correct failed cd commands;
  • cd_cs – changes cs to cd;
  • cd_mkdir – creates directories before cd’ing into them;
  • cd_parent – changes cd.. to cd ..;
  • chmod_x – add execution bit;
  • choco_install – append common suffixes for chocolatey packages;
  • composer_not_command – fixes composer command name;
  • conda_mistype – fixes conda commands;
  • cp_create_destination – creates a new directory when you attempt to cp or mv to a non existent one
  • cp_omitting_directory – adds -a when you cp directory;
  • cpp11 – adds missing -std=c++11 to g++ or clang++;
  • dirty_untar – fixes tar x command that untarred in the current directory;
  • dirty_unzip – fixes unzip command that unzipped in the current directory;
  • django_south_ghost – adds --delete-ghost-migrations to failed because ghosts django south migration;
  • django_south_merge – adds --merge to inconsistent django south migration;
  • docker_login – executes a docker login and repeats the previous command;
  • docker_not_command – fixes wrong docker commands like docker tags;
  • docker_image_being_used_by_container &dash removes the container that is using the image before removing the image;
  • dry – fixes repetitions like git git push;
  • fab_command_not_found – fix misspelled fabric commands;
  • fix_alt_space – replaces Alt+Space with Space character;
  • fix_file – opens a file with an error in your $EDITOR;
  • gem_unknown_command – fixes wrong gem commands;
  • git_add – fixes “pathspec ‘foo’ did not match any file(s) known to git.”;
  • git_add_force – adds --force to git add <pathspec>... when paths are .gitignore’d;
  • git_bisect_usage – fixes git bisect strt, git bisect goood, git bisect rset, etc. when bisecting;
  • git_branch_delete – changes git branch -d to git branch -D;
  • git_branch_delete_checked_out – changes git branch -d to git checkout master && git branch -D when trying to delete a checked out branch;
  • git_branch_exists – offers git branch -d foo, git branch -D foo or git checkout foo when creating a branch that already exists;
  • git_branch_list – catches git branch list in place of git branch and removes created branch;
  • git_branch_flag_0_to_flag_dash_v – undoes git branch 0v and runs git branch -v in its place;
  • git_checkout – fixes branch name or creates new branch;
  • git_clone_git_clone – replaces git clone git clone ... with git clone ...
  • git_commit_amend – offers git commit --amend after previous commit;
  • git_commit_reset – offers git reset HEAD~ after previous commit;
  • git_diff_no_index – adds --no-index to previous git diff on untracked files;
  • git_diff_staged – adds --staged to previous git diff with unexpected output;
  • git_fix_stash – fixes git stash commands (misspelled subcommand and missing save);
  • git_flag_after_filename – fixes fatal: bad flag '...' after filename
  • git_help_aliased – fixes git help <alias> commands replacing with the aliased command;
  • git_hook_bypass – adds --no-verify flag previous to git am, git commit, or git push command;
  • git_lfs_mistype – fixes mistyped git lfs <command> commands;
  • git_merge – adds remote to branch names;
  • git_merge_unrelated – adds --allow-unrelated-histories when required
  • git_not_command – fixes wrong git commands like git brnch;
  • git_pull – sets upstream before executing previous git pull;
  • git_pull_clone – clones instead of pulling when the repo does not exist;
  • git_pull_uncommitted_changes – stashes changes before pulling and pops them afterwards;
  • git_push – adds --set-upstream origin $branch to previous failed git push;
  • git_push_different_branch_names – fixes pushes when local branch name does not match remote branch name;
  • git_push_pull – runs git pull when push was rejected;
  • git_push_without_commits – Creates an initial commit if you forget and only git add ., when setting up a new project;
  • git_rebase_no_changes – runs git rebase --skip instead of git rebase --continue when there are no changes;
  • git_remote_delete – replaces git remote delete remote_name with git remote remove remote_name;
  • git_rm_local_modifications – adds -f or --cached when you try to rm a locally modified file;
  • git_rm_recursive – adds -r when you try to rm a directory;
  • git_rm_staged – adds -f or --cached when you try to rm a file with staged changes
  • git_rebase_merge_dir – offers git rebase (--continue | --abort | --skip) or removing the .git/rebase-merge dir when a rebase is in progress;
  • git_remote_seturl_add – runs git remote add when git remote set_url on nonexistent remote;
  • git_stash – stashes your local modifications before rebasing or switching branch;
  • git_stash_pop – adds your local modifications before popping stash, then resets;
  • git_tag_force – adds --force to git tag <tagname> when the tag already exists;
  • git_two_dashes – adds a missing dash to commands like git commit -amend or git rebase -continue;
  • go_run – appends .go extension when compiling/running Go programs;
  • go_unknown_command – fixes wrong go commands, for example go bulid;
  • gradle_no_task – fixes not found or ambiguous gradle task;
  • gradle_wrapper – replaces gradle with ./gradlew;
  • grep_arguments_order – fixes grep arguments order for situations like grep -lir . test;
  • grep_recursive – adds -r when you try to grep directory;
  • grunt_task_not_found – fixes misspelled grunt commands;
  • gulp_not_task – fixes misspelled gulp tasks;
  • has_exists_script – prepends ./ when script/binary exists;
  • heroku_multiple_apps – add --app <app> to heroku commands like heroku pg;
  • heroku_not_command – fixes wrong heroku commands like heroku log;
  • history – tries to replace command with the most similar command from history;
  • hostscli – tries to fix hostscli usage;
  • ifconfig_device_not_found – fixes wrong device names like wlan0 to wlp2s0;
  • java – removes .java extension when running Java programs;
  • javac – appends missing .java when compiling Java files;
  • lein_not_task – fixes wrong lein tasks like lein rpl;
  • long_form_help – changes -h to --help when the short form version is not supported
  • ln_no_hard_link – catches hard link creation on directories, suggest symbolic link;
  • ln_s_order – fixes ln -s arguments order;
  • ls_all – adds -A to ls when output is empty;
  • ls_lah – adds -lah to ls;
  • man – changes manual section;
  • man_no_space – fixes man commands without spaces, for example mandiff;
  • mercurial – fixes wrong hg commands;
  • missing_space_before_subcommand – fixes command with missing space like npminstall;
  • mkdir_p – adds -p when you try to create a directory without a parent;
  • mvn_no_command – adds clean package to mvn;
  • mvn_unknown_lifecycle_phase – fixes misspelled life cycle phases with mvn;
  • npm_missing_script – fixes npm custom script name in npm run-script <script>;
  • npm_run_script – adds missing run-script for custom npm scripts;
  • npm_wrong_command – fixes wrong npm commands like npm urgrade;
  • no_command – fixes wrong console commands, for example vom/vim;
  • no_such_file – creates missing directories with mv and cp commands;
  • omnienv_no_such_command – fixes wrong commands for goenv, nodenv, pyenv and rbenv (eg.: pyenv isntall or goenv list);
  • open – either prepends http:// to address passed to open or create a new file or directory and passes it to open;
  • pip_install – fixes permission issues with pip install commands by adding --user or prepending sudo if necessary;
  • pip_unknown_command – fixes wrong pip commands, for example pip instatl/pip install;
  • php_s – replaces -s by -S when trying to run a local php server;
  • port_already_in_use – kills process that bound port;
  • prove_recursively – adds -r when called with directory;
  • python_command – prepends python when you try to run non-executable/without ./ python script;
  • python_execute – appends missing .py when executing Python files;
  • python_module_error – fixes ModuleNotFoundError by trying to pip install that module;
  • quotation_marks – fixes uneven usage of ' and " when containing args’;
  • path_from_history – replaces not found path with a similar absolute path from history;
  • rails_migrations_pending – runs pending migrations;
  • react_native_command_unrecognized – fixes unrecognized react-native commands;
  • remove_shell_prompt_literal – remove leading shell prompt symbol $, common when copying commands from documentations;
  • remove_trailing_cedilla – remove trailing cedillas ç, a common typo for European keyboard layouts;
  • rm_dir – adds -rf when you try to remove a directory;
  • scm_correction – corrects wrong scm like hg log to git log;
  • sed_unterminated_s – adds missing ‘/’ to sed‘s s commands;
  • sl_ls – changes sl to ls;
  • ssh_known_hosts – removes host from known_hosts on warning;
  • sudo – prepends sudo to the previous command if it failed because of permissions;
  • sudo_command_from_user_path – runs commands from users $PATH with sudo;
  • switch_lang – switches command from your local layout to en;
  • systemctl – correctly orders parameters of confusing systemctl;
  • terraform_init.py – run terraform init before plan or apply;
  • test.py – runs py.test instead of test.py;
  • touch – creates missing directories before “touching”;
  • tsuru_login – runs tsuru login if not authenticated or session expired;
  • tsuru_not_command – fixes wrong tsuru commands like tsuru shell;
  • tmux – fixes tmux commands;
  • unknown_command – fixes hadoop hdfs-style “unknown command”, for example adds missing ‘-‘ to the command on hdfs dfs ls;
  • unsudo – removes sudo from previous command if a process refuses to run on superuser privilege.
  • vagrant_up – starts up the vagrant instance;
  • whois – fixes whois command;
  • workon_doesnt_exists – fixes virtualenvwrapper env name os suggests to create new.
  • yarn_alias – fixes aliased yarn commands like yarn ls;
  • yarn_command_not_found – fixes misspelled yarn commands;
  • yarn_command_replaced – fixes replaced yarn commands;
  • yarn_help – makes it easier to open yarn documentation;
Back to Contents

默认情况下,仅在特定平台上启用以下规则:

  • apt_get – installs app from apt if it not installed (requires python-commandnotfound / python3-commandnotfound);
  • apt_get_search – changes trying to search using apt-get with searching using apt-cache;
  • apt_invalid_operation – fixes invalid apt and apt-get calls, like apt-get isntall vim;
  • apt_list_upgradable – helps you run apt list --upgradable after apt update;
  • apt_upgrade – helps you run apt upgrade after apt list --upgradable;
  • brew_cask_dependency – installs cask dependencies;
  • brew_install – fixes formula name for brew install;
  • brew_reinstall – turns brew install <formula> into brew reinstall <formula>;
  • brew_link – adds --overwrite --dry-run if linking fails;
  • brew_uninstall – adds --force to brew uninstall if multiple versions were installed;
  • brew_unknown_command – fixes wrong brew commands, for example brew docto/brew doctor;
  • brew_update_formula – turns brew update <formula> into brew upgrade <formula>;
  • dnf_no_such_command – fixes mistyped DNF commands;
  • nixos_cmd_not_found – installs apps on NixOS;
  • pacman – installs app with pacman if it is not installed (uses yay or yaourt if available);
  • pacman_invalid_option – replaces lowercase pacman options with uppercase.
  • pacman_not_found – fixes package name with pacman, yay or yaourt.
  • yum_invalid_operation – fixes invalid yum calls, like yum isntall vim;

以下命令与Fuck捆绑在一起,但默认情况下不启用:

  • git_push_force – adds --force-with-lease to a git push (may conflict with git_push_pull);
  • rm_root – adds --no-preserve-root to rm -rf / command.

设置

要添加您自己的规则,请在~/.config/TheMASH/Rules中创建一个名为your-Rule-name.py的文件。规则文件必须包含两个函数:

match(command: Command) -> bool
get_new_command(command: Command) -> str | list[str]

此外,规则可以包含可选函数:

side_effect(old_command: Command, fixed_command: str) -> None

规则还可以包含可选变量Enabled_by_Default、Requires_Output和Priority

命令有三个属性:script、output和script_part。您的规则不应更改命令

规则API在3.0中发生了更改:要访问规则的设置,请使用Fuck.conf导入设置将其导入

Settings是一个特殊的对象,它由~/.config/the妈的/settings.py和env中的值组合而成(参见下面的更多内容)

使用sudo运行脚本的一个简单示例规则:

def match(command):
    return ('permission denied' in command.output.lower()
            or 'EACCES' in command.output)


def get_new_command(command):
    return 'sudo {}'.format(command.script)

# Optional:
enabled_by_default = True

def side_effect(command, fixed_command):
    subprocess.call('chmod 777 .', shell=True)

priority = 1000  # Lower first, default is 1000

requires_output = True

更多规则示例、用于规则的实用程序函数、特定于应用程序/操作系统的帮助器

带规则的第三方包

可以在文件$XDG_CONFIG_HOME/the他妈的/settings.py($XDG_CONFIG_HOME默认为~/.config)中更改几个Fuck参数:

  • rules – list of enabled rules, by default thefuck.const.DEFAULT_RULES;
  • exclude_rules – list of disabled rules, by default [];
  • require_confirmation – requires confirmation before running new command, by default True;
  • wait_command – the max amount of time in seconds for getting previous command output;
  • no_colors – disable colored output;
  • priority – dict with rules priorities, rule with lower priority will be matched first;
  • debug – enables debug output, by default False;
  • history_limit – the numeric value of how many history commands will be scanned, like 2000;
  • alter_history – push fixed command to history, by default True;
  • wait_slow_command – max amount of time in seconds for getting previous command output if it in slow_commands list;
  • slow_commands – list of slow commands;
  • num_close_matches – the maximum number of close matches to suggest, by default 3.
  • excluded_search_path_prefixes – path prefixes to ignore when searching for commands, by default [].

settings.py的一个示例:

rules = ['sudo', 'no_command']
exclude_rules = ['git_push']
require_confirmation = True
wait_command = 10
no_colors = False
priority = {'sudo': 100, 'no_command': 9999}
debug = False
history_limit = 9999
wait_slow_command = 20
slow_commands = ['react-native', 'gradle']
num_close_matches = 5

或通过环境变量:

  • THEFUCK_RULES – list of enabled rules, like DEFAULT_RULES:rm_root or sudo:no_command;
  • THEFUCK_EXCLUDE_RULES – list of disabled rules, like git_pull:git_push;
  • THEFUCK_REQUIRE_CONFIRMATION – require confirmation before running new command, true/false;
  • THEFUCK_WAIT_COMMAND – the max amount of time in seconds for getting previous command output;
  • THEFUCK_NO_COLORS – disable colored output, true/false;
  • THEFUCK_PRIORITY – priority of the rules, like no_command=9999:apt_get=100,
    rule with lower priority will be matched first;
  • THEFUCK_DEBUG – enables debug output, true/false;
  • THEFUCK_HISTORY_LIMIT – how many history commands will be scanned, like 2000;
  • THEFUCK_ALTER_HISTORY – push fixed command to history true/false;
  • THEFUCK_WAIT_SLOW_COMMAND – the max amount of time in seconds for getting previous command output if it in slow_commands list;
  • THEFUCK_SLOW_COMMANDS – list of slow commands, like lein:gradle;
  • THEFUCK_NUM_CLOSE_MATCHES – the maximum number of close matches to suggest, like 5.
  • THEFUCK_EXCLUDED_SEARCH_PATH_PREFIXES – path prefixes to ignore when searching for commands, by default [].

例如:

export THEFUCK_RULES='sudo:no_command'
export THEFUCK_EXCLUDE_RULES='git_pull:git_push'
export THEFUCK_REQUIRE_CONFIRMATION='true'
export THEFUCK_WAIT_COMMAND=10
export THEFUCK_NO_COLORS='false'
export THEFUCK_PRIORITY='no_command=9999:apt_get=100'
export THEFUCK_HISTORY_LIMIT='2000'
export THEFUCK_NUM_CLOSE_MATCHES='5'
Back to Contents

实验即时模式

如果您希望制定一组特定的非公共规则,但仍希望与其他人共享这些规则,请创建一个名为TheMASH_CONTRIB_*的包,其结构如下:

thefuck_contrib_foo
  thefuck_contrib_foo
    rules
      __init__.py
      *third-party rules*
    __init__.py
    *third-party-utils*
  setup.py

操蛋将在规则模块中查找规则

Back to Contents

发展中

Fuck的默认行为需要时间来重新运行先前的命令。在即时模式下,Fuck通过使用脚本记录输出,然后读取日志来节省时间

目前,即时模式仅支持带有bash或zsh的Python3。为了正常工作,还需要禁用zsh的自动更正功能

要启用即时模式,请向.bashrc、.bash_profile或.zshc中的别名初始化添加–enable-explementation-instant-mode

请参阅CONTRIBUTING.md

eval $(thefuck --alias --enable-experimental-instant-mode)

Awesome-python-一个不错的Python框架、库、软件和资源的精选列表

Awesome Python

一个不错的Python框架、库、软件和资源的精选列表

灵感来自awawed-php


管理面板

管理接口库

  • ajenti – The admin panel your servers deserve.
  • django-grappelli – A jazzy skin for the Django Admin-Interface.
  • django-jet – Modern responsive template for the Django admin interface with improved functionality.
  • django-suit – Alternative Django Admin-Interface (free only for Non-commercial use).
  • django-xadmin – Drop-in replacement of Django admin comes with lots of goodies.
  • flask-admin – Simple and extensible administrative interface framework for Flask.
  • flower – Real-time monitor and web admin for Celery.
  • jet-bridge – Admin panel framework for any application with nice UI (ex Jet Django)
  • wooey – A Django app which creates automatic web UIs for Python scripts.

算法和设计模式

数据结构、算法和设计模式的Python实现。另见令人敬畏的算法

  • Algorithms
    • algorithms – Minimal examples of data structures and algorithms.
    • python-ds – A collection of data structure and algorithms for coding interviews.
    • sortedcontainers – Fast and pure-Python implementation of sorted collections.
    • TheAlgorithms – All Algorithms implemented in Python.
  • Design Patterns
    • PyPattyrn – A simple yet effective library for implementing common design patterns.
    • python-patterns – A collection of design patterns in Python.
    • transitions – A lightweight, object-oriented finite state machine implementation.

ASGI服务器

与ASGI兼容的Web服务器

  • daphne – A HTTP, HTTP2 and WebSocket protocol server for ASGI and ASGI-HTTP.
  • uvicorn – A lightning-fast ASGI server implementation, using uvloop and httptools.

异步编程

  • asyncio – (Python standard library) Asynchronous I/O, event loop, coroutines and tasks.
  • trio – A friendly library for async concurrency and I/O.
  • Twisted – An event-driven networking engine.
  • uvloop – Ultra fast asyncio event loop.

音频

用于操作音频及其元数据的库

  • Audio
    • audioread – Cross-library (GStreamer + Core Audio + MAD + FFmpeg) audio decoding.
    • dejavu – Audio fingerprinting and recognition.
    • kapre – Keras Audio Preprocessors
    • librosa – Python library for audio and music analysis
    • matchering – A library for automated reference audio mastering.
    • mingus – An advanced music theory and notation package with MIDI file and playback support.
    • pyAudioAnalysis – Audio feature extraction, classification, segmentation and applications.
    • pydub – Manipulate audio with a simple and easy high level interface.
    • TimeSide – Open web audio processing framework.
  • Metadata
    • beets – A music library manager and MusicBrainz tagger.
    • eyeD3 – A tool for working with audio files, specifically MP3 files containing ID3 metadata.
    • mutagen – A Python module to handle audio metadata.
    • tinytag – A library for reading music meta data of MP3, OGG, FLAC and Wave files.

身份验证

用于实现身份验证方案的库

  • OAuth
    • authlib – JavaScript Object Signing and Encryption draft implementation.
    • django-allauth – Authentication app for Django that “just works.”
    • django-oauth-toolkit – OAuth 2 goodies for Django.
    • oauthlib – A generic and thorough implementation of the OAuth request-signing logic.
    • python-oauth2 – A fully tested, abstract interface to creating OAuth clients and servers.
    • python-social-auth – An easy-to-setup social authentication mechanism.
  • JWT
    • pyjwt – JSON Web Token implementation in Python.
    • python-jose – A JOSE implementation in Python.
    • python-jwt – A module for generating and verifying JSON Web Tokens.

构建工具

从源代码编译软件

  • BitBake – A make-like build tool for embedded Linux.
  • buildout – A build system for creating, assembling and deploying applications from multiple parts.
  • PlatformIO – A console tool to build code with different development platforms.
  • pybuilder – A continuous build tool written in pure Python.
  • SCons – A software construction tool.

内置类增强功能

用于增强Python内置类的库

  • attrs – Replacement for __init__, __eq__, __repr__, etc. boilerplate in class definitions.
  • bidict – Efficient, Pythonic bidirectional map data structures and related functionality..
  • Box – Python dictionaries with advanced dot notation access.
  • dataclasses – (Python standard library) Data classes.
  • DottedDict – A library that provides a method of accessing lists and dicts with a dotted path notation.

CMS

内容管理系统

  • django-cms – An Open source enterprise CMS based on the Django.
  • feincms – One of the most advanced Content Management Systems built on Django.
  • indico – A feature-rich event management system, made @ CERN.
  • Kotti – A high-level, Pythonic web application framework built on Pyramid.
  • mezzanine – A powerful, consistent, and flexible content management platform.
  • plone – A CMS built on top of the open source application server Zope.
  • quokka – Flexible, extensible, small CMS powered by Flask and MongoDB.
  • wagtail – A Django content management system.

缓存

用于缓存数据的库

  • beaker – A WSGI middleware for sessions and caching.
  • django-cache-machine – Automatic caching and invalidation for Django models.
  • django-cacheops – A slick ORM cache with automatic granular event-driven invalidation.
  • dogpile.cache – dogpile.cache is next generation replacement for Beaker made by same authors.
  • HermesCache – Python caching library with tag-based invalidation and dogpile effect prevention.
  • pylibmc – A Python wrapper around the libmemcached interface.
  • python-diskcache – SQLite and file backed cache backend with faster lookups than memcached and redis.

ChatOps工具

Chatbot开发库

  • errbot – The easiest and most popular chatbot to implement ChatOps.

代码分析

静电分析工具,链接器和代码质量检查器。另见棒极了-静电-分析

  • Code Analysis
    • coala – Language independent and easily extendable code analysis application.
    • code2flow – Turn your Python and JavaScript code into DOT flowcharts.
    • prospector – A tool to analyse Python code.
    • pycallgraph – A library that visualises the flow (call graph) of your Python application.
    • vulture – A tool for finding and analysing dead Python code.
  • Code Linters
  • Code Formatters
    • black – The uncompromising Python code formatter.
    • isort – A Python utility / library to sort imports.
    • yapf – Yet another Python code formatter from Google.
  • Static Type Checkers, also see awesome-python-typing
    • mypy – Check variable types during compile time.
    • pyre-check – Performant type checking.
    • typeshed – Collection of library stubs for Python, with static types.
  • Static Type Annotations Generators
    • MonkeyType – A system for Python that generates static type annotations by collecting runtime types.
    • pyannotate – Auto-generate PEP-484 annotations.
    • pytype – Pytype checks and infers types for Python code – without requiring type annotations.

命令行界面开发

用于构建命令行应用程序的库

  • Command-line Application Development
    • cement – CLI Application Framework for Python.
    • click – A package for creating beautiful command line interfaces in a composable way.
    • cliff – A framework for creating command-line programs with multi-level commands.
    • docopt – Pythonic command line arguments parser.
    • python-fire – A library for creating command line interfaces from absolutely any Python object.
    • python-prompt-toolkit – A library for building powerful interactive command lines.
  • Terminal Rendering
    • alive-progress – A new kind of Progress Bar, with real-time throughput, eta and very cool animations.
    • asciimatics – A package to create full-screen text UIs (from interactive forms to ASCII animations).
    • bashplotlib – Making basic plots in the terminal.
    • colorama – Cross-platform colored terminal text.
    • rich – Python library for rich text and beautiful formatting in the terminal. Also provides a great RichHandler log handler.
    • tqdm – Fast, extensible progress bar for loops and CLI.

命令行工具

基于CLI的实用工具,可提高工作效率

  • Productivity Tools
    • copier – A library and command-line utility for rendering projects templates.
    • cookiecutter – A command-line utility that creates projects from cookiecutters (project templates).
    • doitlive – A tool for live presentations in the terminal.
    • howdoi – Instant coding answers via the command line.
    • Invoke – A tool for managing shell-oriented subprocesses and organizing executable Python code into CLI-invokable tasks.
    • PathPicker – Select files out of bash output.
    • percol – Adds flavor of interactive selection to the traditional pipe concept on UNIX.
    • thefuck – Correcting your previous console command.
    • tmuxp – A tmux session manager.
    • try – A dead simple CLI to try out python packages – it’s never been easier.
  • CLI Enhancements
    • httpie – A command line HTTP client, a user-friendly cURL replacement.
    • iredis – Redis CLI with autocompletion and syntax highlighting.
    • kube-shell – An integrated shell for working with the Kubernetes CLI.
    • litecli – SQLite CLI with autocompletion and syntax highlighting.
    • mycli – MySQL CLI with autocompletion and syntax highlighting.
    • pgcli – PostgreSQL CLI with autocompletion and syntax highlighting.
    • saws – A Supercharged aws-cli.

兼容性

用于从Python 2迁移到3的库

  • python-future – The missing compatibility layer between Python 2 and Python 3.
  • modernize – Modernizes Python code for eventual Python 3 migration.
  • six – Python 2 and 3 compatibility utilities.

计算机视觉

计算机视觉图书馆

  • EasyOCR – Ready-to-use OCR with 40+ languages supported.
  • Face Recognition – Simple facial recognition library.
  • Kornia – Open Source Differentiable Computer Vision Library for PyTorch.
  • OpenCV – Open Source Computer Vision Library.
  • pytesseract – A wrapper for Google Tesseract OCR.
  • SimpleCV – An open source framework for building computer vision applications.
  • tesserocr – Another simple, Pillow-friendly, wrapper around the tesseract-ocr API for OCR.

并发性和并行性

用于并发和并行执行的库。也请参见AWOWE-Asyncio

  • concurrent.futures – (Python standard library) A high-level interface for asynchronously executing callables.
  • eventlet – Asynchronous framework with WSGI support.
  • gevent – A coroutine-based Python networking library that uses greenlet.
  • multiprocessing – (Python standard library) Process-based parallelism.
  • scoop – Scalable Concurrent Operations in Python.
  • uvloop – Ultra fast implementation of asyncio event loop on top of libuv.

配置

用于存储和解析配置选项的库

  • configobj – INI file parser with validation.
  • configparser – (Python standard library) INI file parser.
  • hydra – Hydra is a framework for elegantly configuring complex applications.
  • profig – Config from multiple formats with value conversion.
  • python-decouple – Strict separation of settings from code.

密码学

  • cryptography – A package designed to expose cryptographic primitives and recipes to Python developers.
  • paramiko – The leading native Python SSHv2 protocol library.
  • passlib – Secure password storage/hashing library, very high level.
  • pynacl – Python binding to the Networking and Cryptography (NaCl) library.

数据分析

用于数据分析的库

  • AWS Data Wrangler – Pandas on AWS.
  • Blaze – NumPy and Pandas interface to Big Data.
  • Open Mining – Business Intelligence (BI) in Pandas interface.
  • Optimus – Agile Data Science Workflows made easy with PySpark.
  • Orange – Data mining, data visualization, analysis and machine learning through visual programming or scripts.
  • Pandas – A library providing high-performance, easy-to-use data structures and data analysis tools.

数据验证

用于验证数据的库。在许多情况下用于表单

  • Cerberus – A lightweight and extensible data validation library.
  • colander – Validating and deserializing data obtained via XML, JSON, an HTML form post.
  • jsonschema – An implementation of JSON Schema for Python.
  • schema – A library for validating Python data structures.
  • Schematics – Data Structure Validation.
  • valideer – Lightweight extensible data validation and adaptation library.
  • voluptuous – A Python data validation library.

数据可视化

用于可视化数据的库。另请参阅awawed-javascript

  • Altair – Declarative statistical visualization library for Python.
  • Bokeh – Interactive Web Plotting for Python.
  • bqplot – Interactive Plotting Library for the Jupyter Notebook
  • Cartopy – A cartographic python library with matplotlib support
  • Dash – Built on top of Flask, React and Plotly aimed at analytical web applications.
  • diagrams – Diagram as Code.
  • Matplotlib – A Python 2D plotting library.
  • plotnine – A grammar of graphics for Python based on ggplot2.
  • Pygal – A Python SVG Charts Creator.
  • PyGraphviz – Python interface to Graphviz.
  • PyQtGraph – Interactive and realtime 2D/3D/Image plotting and science/engineering widgets.
  • Seaborn – Statistical data visualization using Matplotlib.
  • VisPy – High-performance scientific visualization based on OpenGL.

数据库

在Python中实现的数据库

  • pickleDB – A simple and lightweight key-value store for Python.
  • tinydb – A tiny, document-oriented database.
  • ZODB – A native object database for Python. A key-value and object graph database.

数据库驱动程序

用于连接和操作数据库的库

  • MySQL – awesome-mysql
  • PostgreSQL – awesome-postgres
    • psycopg2 – The most popular PostgreSQL adapter for Python.
    • queries – A wrapper of the psycopg2 library for interacting with PostgreSQL.
  • SQlite – awesome-sqlite
    • sqlite3 – (Python standard library) SQlite interface compliant with DB-API 2.0
    • SuperSQLite – A supercharged SQLite library built on top of apsw.
  • Other Relational Databases
    • pymssql – A simple database interface to Microsoft SQL Server.
    • clickhouse-driver – Python driver with native interface for ClickHouse.
  • NoSQL Databases
    • cassandra-driver – The Python Driver for Apache Cassandra.
    • happybase – A developer-friendly library for Apache HBase.
    • kafka-python – The Python client for Apache Kafka.
    • py2neo – A client library and toolkit for working with Neo4j.
    • pymongo – The official Python client for MongoDB.
    • redis-py – The Python client for Redis.
  • Asynchronous Clients
    • motor – The async Python driver for MongoDB.

日期和时间

用于处理日期和时间的库

  • Arrow – A Python library that offers a sensible and human-friendly approach to creating, manipulating, formatting and converting dates, times and timestamps.
  • Chronyk – A Python 3 library for parsing human-written times and dates.
  • dateutil – Extensions to the standard Python datetime module.
  • delorean – A library for clearing up the inconvenient truths that arise dealing with datetimes.
  • maya – Datetimes for Humans.
  • moment – A Python library for dealing with dates/times. Inspired by Moment.js.
  • Pendulum – Python datetimes made easy.
  • PyTime – An easy-to-use Python module which aims to operate date/time/datetime by string.
  • pytz – World timezone definitions, modern and historical. Brings the tz database into Python.
  • when.py – Providing user-friendly functions to help perform common date and time actions.

调试工具

用于调试代码的库

  • pdb-like Debugger
    • ipdb – IPython-enabled pdb.
    • pdb++ – Another drop-in replacement for pdb.
    • pudb – A full-screen, console-based Python debugger.
    • wdb – An improbable web debugger through WebSockets.
  • Tracing
    • lptracestrace for Python programs.
    • manhole – Debugging UNIX socket connections and present the stacktraces for all threads and an interactive prompt.
    • pyringe – Debugger capable of attaching to and injecting code into Python processes.
    • python-hunter – A flexible code tracing toolkit.
  • Profiler
    • line_profiler – Line-by-line profiling.
    • memory_profiler – Monitor Memory usage of Python code.
    • py-spy – A sampling profiler for Python programs. Written in Rust.
    • pyflame – A ptracing profiler For Python.
    • vprof – Visual Python profiler.
  • Others
    • django-debug-toolbar – Display various debug information for Django.
    • django-devserver – A drop-in replacement for Django’s runserver.
    • flask-debugtoolbar – A port of the django-debug-toolbar to flask.
    • icecream – Inspect variables, expressions, and program execution with a single, simple function call.
    • pyelftools – Parsing and analyzing ELF files and DWARF debugging information.

深度学习

神经网络和深度学习的框架。另请参阅令人敬畏的深度学习

  • caffe – A fast open framework for deep learning..
  • keras – A high-level neural networks library and capable of running on top of either TensorFlow or Theano.
  • mxnet – A deep learning framework designed for both efficiency and flexibility.
  • pytorch – Tensors and Dynamic neural networks in Python with strong GPU acceleration.
  • SerpentAI – Game agent framework. Use any video game as a deep learning sandbox.
  • tensorflow – The most popular Deep Learning framework created by Google.
  • Theano – A library for fast numerical computation.

DevOps工具

适用于DevOps的软件和库

  • Configuration Management
    • ansible – A radically simple IT automation platform.
    • cloudinit – A multi-distribution package that handles early initialization of a cloud instance.
    • OpenStack – Open source software for building private and public clouds.
    • pyinfra – A versatile CLI tools and python libraries to automate infrastructure.
    • saltstack – Infrastructure automation and management system.
  • SSH-style Deployment
    • cuisine – Chef-like functionality for Fabric.
    • fabric – A simple, Pythonic tool for remote execution and deployment.
    • fabtools – Tools for writing awesome Fabric files.
  • Process Management
    • honcho – A Python clone of Foreman, for managing Procfile-based applications.
    • supervisor – Supervisor process control system for UNIX.
  • Monitoring
    • psutil – A cross-platform process and system utilities module.
  • Backup
    • BorgBackup – A deduplicating archiver with compression and encryption.
  • Others

分布式计算

分布式计算的框架和库

  • Batch Processing
    • dask – A flexible parallel computing library for analytic computing.
    • luigi – A module that helps you build complex pipelines of batch jobs.
    • mrjob – Run MapReduce jobs on Hadoop or Amazon Web Services.
    • PySparkApache Spark Python API.
    • Ray – A system for parallel and distributed Python that unifies the machine learning ecosystem.
  • Stream Processing

分布

为发行版创建打包的可执行文件的库

  • dh-virtualenv – Build and distribute a virtualenv as a Debian package.
  • Nuitka – Compile scripts, modules, packages to an executable or extension module.
  • py2app – Freezes Python scripts (Mac OS X).
  • py2exe – Freezes Python scripts (Windows).
  • pyarmor – A tool used to obfuscate python scripts, bind obfuscated scripts to fixed machine or expire obfuscated scripts.
  • PyInstaller – Converts Python programs into stand-alone executables (cross-platform).
  • pynsist – A tool to build Windows installers, installers bundle Python itself.
  • shiv – A command line utility for building fully self-contained zipapps (PEP 441), but with all their dependencies included.

文档

用于生成项目文档的库

  • sphinx – Python Documentation generator.
  • pdoc – Epydoc replacement to auto generate API documentation for Python libraries.
  • pycco – The literate-programming-style documentation generator.

下载器

用于下载的库

  • akshare – A financial data interface library, built for human beings!
  • s3cmd – A command line tool for managing Amazon S3 and CloudFront.
  • s4cmd – Super S3 command line tool, good for higher performance.
  • you-get – A YouTube/Youku/Niconico video downloader written in Python 3.
  • youtube-dl – A small command-line program to download videos from YouTube.

电子商务

电子商务和支付的框架和库

  • alipay – Unofficial Alipay API for Python.
  • Cartridge – A shopping cart app built using the Mezzanine.
  • django-oscar – An open-source e-commerce framework for Django.
  • django-shop – A Django based shop system.
  • forex-python – Foreign exchange rates, Bitcoin price index and currency conversion.
  • merchant – A Django app to accept payments from various payment processors.
  • moneyMoney class with optional CLDR-backed locale-aware formatting and an extensible currency exchange.
  • python-currencies – Display money format and its filthy currencies.
  • saleor – An e-commerce storefront for Django.
  • shoop – An open source E-Commerce platform based on Django.

编辑器插件和IDE

  • Emacs
    • elpy – Emacs Python Development Environment.
  • Sublime Text
    • anaconda – Anaconda turns your Sublime Text 3 in a full featured Python development IDE.
    • SublimeJEDI – A Sublime Text plugin to the awesome auto-complete library Jedi.
  • Vim
    • jedi-vim – Vim bindings for the Jedi auto-completion library for Python.
    • python-mode – An all in one plugin for turning Vim into a Python IDE.
    • YouCompleteMe – Includes Jedi-based completion engine for Python.
  • Visual Studio
    • PTVS – Python Tools for Visual Studio.
  • Visual Studio Code
    • Python – The official VSCode extension with rich support for Python.
  • IDE
    • PyCharm – Commercial Python IDE by JetBrains. Has free community edition available.
    • spyder – Open Source Python IDE.

电子邮件

用于发送和解析电子邮件的库

  • Mail Servers
    • modoboa – A mail hosting and management platform including a modern Web UI.
    • salmon – A Python Mail Server.
  • Clients
    • imbox – Python IMAP for Humans.
    • yagmail – Yet another Gmail/SMTP client.
  • Others
    • flanker – An email address and Mime parsing library.
    • mailer – High-performance extensible mail delivery framework.

企业应用程序集成

用于在企业环境中进行系统集成的平台和工具

  • Zato – ESB, SOA, REST, APIs and Cloud Integrations in Python.

环境管理

用于Python版本和虚拟环境管理的库

  • pyenv – Simple Python version management.
  • virtualenv – A tool to create isolated Python environments.

文件

用于文件操作和MIME类型检测的库

  • mimetypes – (Python standard library) Map filenames to MIME types.
  • path.py – A module wrapper for os.path.
  • pathlib – (Python standard library) An cross-platform, object-oriented path library.
  • PyFilesystem2 – Python’s filesystem abstraction layer.
  • python-magic – A Python interface to the libmagic file type identification library.
  • Unipath – An object-oriented approach to file/directory operations.
  • watchdog – API and shell utilities to monitor file system events.

外来函数接口

用于提供外来函数接口的库

  • cffi – Foreign Function Interface for Python calling C code.
  • ctypes – (Python standard library) Foreign Function Interface for Python calling C code.
  • PyCUDA – A Python wrapper for Nvidia’s CUDA API.
  • SWIG – Simplified Wrapper and Interface Generator.

表格

用于处理表单的库

  • Deform – Python HTML form generation library influenced by the formish form generation library.
  • django-bootstrap3 – Bootstrap 3 integration with Django.
  • django-bootstrap4 – Bootstrap 4 integration with Django.
  • django-crispy-forms – A Django app which lets you create beautiful forms in a very elegant and DRY way.
  • django-remote-forms – A platform independent Django form serializer.
  • WTForms – A flexible forms validation and rendering library.

函数式程序设计

使用Python进行函数式编程

  • Coconut – A variant of Python built for simple, elegant, Pythonic functional programming.
  • CyToolz – Cython implementation of Toolz: High performance functional utilities.
  • fn.py – Functional programming in Python: implementation of missing features to enjoy FP.
  • funcy – A fancy and practical functional tools.
  • more-itertools – More routines for operating on iterables, beyond itertools.
  • returns – A set of type-safe monads, transformers, and composition utilities.
  • Toolz – A collection of functional utilities for iterators, functions, and dictionaries.

GUI开发

用于使用图形用户界面应用程序的库

  • curses – Built-in wrapper for ncurses used to create terminal GUI applications.
  • Eel – A library for making simple Electron-like offline HTML/JS GUI apps.
  • enaml – Creating beautiful user-interfaces with Declarative Syntax like QML.
  • Flexx – Flexx is a pure Python toolkit for creating GUI’s, that uses web technology for its rendering.
  • Gooey – Turn command line programs into a full GUI application with one line.
  • kivy – A library for creating NUI applications, running on Windows, Linux, Mac OS X, Android and iOS.
  • pyglet – A cross-platform windowing and multimedia library for Python.
  • PyGObject – Python Bindings for GLib/GObject/GIO/GTK+ (GTK+3).
  • PyQt – Python bindings for the Qt cross-platform application and UI framework.
  • PySimpleGUI – Wrapper for tkinter, Qt, WxPython and Remi.
  • pywebview – A lightweight cross-platform native wrapper around a webview component.
  • Tkinter – Tkinter is Python’s de-facto standard GUI package.
  • Toga – A Python native, OS native GUI toolkit.
  • urwid – A library for creating terminal GUI applications with strong support for widgets, events, rich colors, etc.
  • wxPython – A blending of the wxWidgets C++ class library with the Python.
  • DearPyGui – A Simple GPU accelerated Python GUI framework

图形QL

用于使用GraphQL的库

  • graphene – GraphQL framework for Python.
  • tartiflette-aiohttp – An aiohttp-based wrapper for Tartiflette to expose GraphQL APIs over HTTP.
  • tartiflette-asgi – ASGI support for the Tartiflette GraphQL engine.
  • tartiflette – SDL-first GraphQL engine implementation for Python 3.6+ and asyncio.

游戏开发

超棒的游戏开发库

  • Arcade – Arcade is a modern Python framework for crafting games with compelling graphics and sound.
  • Cocos2d – cocos2d is a framework for building 2D games, demos, and other graphical/interactive applications.
  • Harfang3D – Python framework for 3D, VR and game development.
  • Panda3D – 3D game engine developed by Disney.
  • Pygame – Pygame is a set of Python modules designed for writing games.
  • PyOgre – Python bindings for the Ogre 3D render engine, can be used for games, simulations, anything 3D.
  • PyOpenGL – Python ctypes bindings for OpenGL and it’s related APIs.
  • PySDL2 – A ctypes based wrapper for the SDL2 library.
  • RenPy – A Visual Novel engine.

地理位置

用于对地址进行地理编码以及处理纬度和经度的库

  • django-countries – A Django app that provides a country field for models and forms.
  • GeoDjango – A world-class geographic web framework.
  • GeoIP – Python API for MaxMind GeoIP Legacy Database.
  • geojson – Python bindings and utilities for GeoJSON.
  • geopy – Python Geocoding Toolbox.

HTML操作

用于处理HTML和XML的库

  • BeautifulSoup – Providing Pythonic idioms for iterating, searching, and modifying HTML or XML.
  • bleach – A whitelist-based HTML sanitization and text linkification library.
  • cssutils – A CSS library for Python.
  • html5lib – A standards-compliant library for parsing and serializing HTML documents and fragments.
  • lxml – A very fast, easy-to-use and versatile library for handling HTML and XML.
  • MarkupSafe – Implements a XML/HTML/XHTML Markup safe string for Python.
  • pyquery – A jQuery-like library for parsing HTML.
  • untangle – Converts XML documents to Python objects for easy access.
  • WeasyPrint – A visual rendering engine for HTML and CSS that can export to PDF.
  • xmldataset – Simple XML Parsing.
  • xmltodict – Working with XML feel like you are working with JSON.

HTTP客户端

用于使用HTTP的库

  • grequests – requests + gevent for asynchronous HTTP requests.
  • httplib2 – Comprehensive HTTP client library.
  • httpx – A next generation HTTP client for Python.
  • requests – HTTP Requests for Humans.
  • treq – Python requests like API built on top of Twisted’s HTTP client.
  • urllib3 – A HTTP library with thread-safe connection pooling, file post support, sanity friendly.

硬件

用于硬件编程的库

  • ino – Command line toolkit for working with Arduino.
  • keyboard – Hook and simulate global keyboard events on Windows and Linux.
  • mouse – Hook and simulate global mouse events on Windows and Linux.
  • Pingo – Pingo provides a uniform API to program devices like the Raspberry Pi, pcDuino, Intel Galileo, etc.
  • PyUserInput – A module for cross-platform control of the mouse and keyboard.
  • scapy – A brilliant packet manipulation library.

图像处理

用于操作图像的库

  • hmap – Image histogram remapping.
  • imgSeek – A project for searching a collection of images using visual similarity.
  • nude.py – Nudity detection.
  • pagan – Retro identicon (Avatar) generation based on input string and hash.
  • pillow – Pillow is the friendly PIL fork.
  • python-barcode – Create barcodes in Python with no extra dependencies.
  • pygram – Instagram-like image filters.
  • PyMatting – A library for alpha matting.
  • python-qrcode – A pure Python QR Code generator.
  • pywal – A tool that generates color schemes from images.
  • pyvips – A fast image processing library with low memory needs.
  • Quads – Computer art based on quadtrees.
  • scikit-image – A Python library for (scientific) image processing.
  • thumbor – A smart imaging service. It enables on-demand crop, re-sizing and flipping of images.
  • wand – Python bindings for MagickWand, C API for ImageMagick.

实施方案

Python的实现

  • CLPython – Implementation of the Python programming language written in Common Lisp.
  • CPythonDefault, most widely used implementation of the Python programming language written in C.
  • Cython – Optimizing Static Compiler for Python.
  • Grumpy – More compiler than interpreter as more powerful CPython2.7 replacement (alpha).
  • IronPython – Implementation of the Python programming language written in C#.
  • Jython – Implementation of Python programming language written in Java for the JVM.
  • MicroPython – A lean and efficient Python programming language implementation.
  • Numba – Python JIT compiler to LLVM aimed at scientific Python.
  • PeachPy – x86-64 assembler embedded in Python.
  • Pyjion – A JIT for Python based upon CoreCLR.
  • PyPy – A very fast and compliant implementation of the Python language.
  • Pyston – A Python implementation using JIT techniques.
  • Stackless Python – An enhanced version of the Python programming language.

交互式口译器

交互式Python解释器(REPL)

国际化

用于使用I18n的库

  • Babel – An internationalization library for Python.
  • PyICU – A wrapper of International Components for Unicode C++ library (ICU).

作业调度器

用于调度作业的库

  • Airflow – Airflow is a platform to programmatically author, schedule and monitor workflows.
  • APScheduler – A light but powerful in-process task scheduler that lets you schedule functions.
  • django-schedule – A calendaring app for Django.
  • doit – A task runner and build tool.
  • gunnery – Multipurpose task execution tool for distributed systems with web-based interface.
  • Joblib – A set of tools to provide lightweight pipelining in Python.
  • Plan – Writing crontab file in Python like a charm.
  • Prefect – A modern workflow orchestration framework that makes it easy to build, schedule and monitor robust data pipelines.
  • schedule – Python job scheduling for humans.
  • Spiff – A powerful workflow engine implemented in pure Python.
  • TaskFlow – A Python library that helps to make task execution easy, consistent and reliable.

日志记录

用于生成和使用日志的库

  • logbook – Logging replacement for Python.
  • logging – (Python standard library) Logging facility for Python.
  • loguru – Library which aims to bring enjoyable logging in Python.
  • sentry-python – Sentry SDK for Python.
  • structlog – Structured logging made easy.

机器学习

机器学习库。另见令人敬畏的机器学习

  • gym – A toolkit for developing and comparing reinforcement learning algorithms.
  • H2O – Open Source Fast Scalable Machine Learning Platform.
  • Metrics – Machine learning evaluation metrics.
  • NuPIC – Numenta Platform for Intelligent Computing.
  • scikit-learn – The most popular Python library for Machine Learning.
  • Spark MLApache Spark‘s scalable Machine Learning library.
  • vowpal_porpoise – A lightweight Python wrapper for Vowpal Wabbit.
  • xgboost – A scalable, portable, and distributed gradient boosting library.
  • MindsDB – MindsDB is an open source AI layer for existing databases that allows you to effortlessly develop, train and deploy state-of-the-art machine learning models using standard queries.

Microsoft Windows

Microsoft Windows上的Python编程

  • Python(x,y) – Scientific-applications-oriented Python Distribution based on Qt and Spyder.
  • pythonlibs – Unofficial Windows binaries for Python extension packages.
  • PythonNet – Python Integration with the .NET Common Language Runtime (CLR).
  • PyWin32 – Python Extensions for Windows.
  • WinPython – Portable development environment for Windows 7/8.

杂项

不属于上述类别的有用的库或工具

  • blinker – A fast Python in-process signal/event dispatching system.
  • boltons – A set of pure-Python utilities.
  • itsdangerous – Various helpers to pass trusted data to untrusted environments.
  • magenta – A tool to generate music and art using artificial intelligence.
  • pluginbase – A simple but flexible plugin system for Python.
  • tryton – A general purpose business framework.

自然语言处理

用于处理人类语言的库

  • General
    • gensim – Topic Modeling for Humans.
    • langid.py – Stand-alone language identification system.
    • nltk – A leading platform for building Python programs to work with human language data.
    • pattern – A web mining module.
    • polyglot – Natural language pipeline supporting hundreds of languages.
    • pytext – A natural language modeling framework based on PyTorch.
    • PyTorch-NLP – A toolkit enabling rapid deep learning NLP prototyping for research.
    • spacy – A library for industrial-strength natural language processing in Python and Cython.
    • Stanza – The Stanford NLP Group’s official Python library, supporting 60+ languages.
  • Chinese
    • funNLP – A collection of tools and datasets for Chinese NLP.
    • jieba – The most popular Chinese text segmentation library.
    • pkuseg-python – A toolkit for Chinese word segmentation in various domains.
    • snownlp – A library for processing Chinese text.

网络虚拟化

虚拟网络和SDN(软件定义网络)的工具和库

  • mininet – A popular network emulator and API written in Python.
  • napalm – Cross-vendor API to manipulate network devices.
  • pox – A Python-based SDN control applications, such as OpenFlow SDN controllers.

新闻提要

用于构建用户活动的库

ORM

实现对象关系映射或数据映射技术的库

  • Relational Databases
    • Django Models – The Django ORM.
    • SQLAlchemy – The Python SQL Toolkit and Object Relational Mapper.
    • dataset – Store Python dicts in a database – works with SQLite, MySQL, and PostgreSQL.
    • orator – The Orator ORM provides a simple yet beautiful ActiveRecord implementation.
    • orm – An async ORM.
    • peewee – A small, expressive ORM.
    • pony – ORM that provides a generator-oriented interface to SQL.
    • pydal – A pure Python Database Abstraction Layer.
  • NoSQL Databases
    • hot-redis – Rich Python data types for Redis.
    • mongoengine – A Python Object-Document-Mapper for working with MongoDB.
    • PynamoDB – A Pythonic interface for Amazon DynamoDB.
    • redisco – A Python Library for Simple Models and Containers Persisted in Redis.

套餐管理

用于包和依赖项管理的库

  • pip – The package installer for Python.
    • pip-tools – A set of tools to keep your pinned Python dependencies fresh.
    • PyPI
  • conda – Cross-platform, Python-agnostic binary package manager.
  • poetry – Python dependency management and packaging made easy.

包资料档案库

本地PyPI存储库服务器和代理

  • bandersnatch – PyPI mirroring tool provided by Python Packaging Authority (PyPA).
  • devpi – PyPI server and packaging/testing/release tool.
  • localshop – Local PyPI server (custom packages and auto-mirroring of pypi).
  • warehouse – Next generation Python Package Repository (PyPI).

渗透试验

渗透测试的框架和工具

  • fsociety – A Penetration testing framework.
  • setoolkit – A toolkit for social engineering.
  • sqlmap – Automatic SQL injection and database takeover tool.

权限

允许或拒绝用户访问数据或功能的库

  • django-guardian – Implementation of per object permissions for Django 1.2+
  • django-rules – A tiny but powerful app providing object-level permissions to Django, without requiring a database.

流程

用于启动操作系统进程并与其通信的库

推荐系统

用于构建推荐系统的库

  • annoy – Approximate Nearest Neighbors in C++/Python optimized for memory usage.
  • fastFM – A library for Factorization Machines.
  • implicit – A fast Python implementation of collaborative filtering for implicit datasets.
  • libffm – A library for Field-aware Factorization Machine (FFM).
  • lightfm – A Python implementation of a number of popular recommendation algorithms.
  • spotlight – Deep recommender models using PyTorch.
  • Surprise – A scikit for building and analyzing recommender systems.
  • tensorrec – A Recommendation Engine Framework in TensorFlow.

重构

Python的重构工具和库

  • Bicycle Repair Man – Bicycle Repair Man, a refactoring tool for Python.
  • Bowler – Safe code refactoring for modern Python.
  • Rope – Rope is a python refactoring library.

RESTful API

用于构建REST风格API的库

  • Django
  • Flask
    • eve – REST API framework powered by Flask, MongoDB and good intentions.
    • flask-api – Browsable Web APIs for Flask.
    • flask-restful – Quickly building REST APIs for Flask.
  • Pyramid
    • cornice – A RESTful framework for Pyramid.
  • Framework agnostic
    • apistar – A smart Web API framework, designed for Python 3.
    • falcon – A high-performance framework for building cloud APIs and web app backends.
    • fastapi – A modern, fast, web framework for building APIs with Python 3.6+ based on standard Python type hints.
    • hug – A Python 3 framework for cleanly exposing APIs.
    • sandman2 – Automated REST APIs for existing database-driven systems.
    • sanic – A Python 3.6+ web server and web framework that’s written to go fast.
    • vibora – Fast, efficient and asynchronous Web framework inspired by Flask.

机器人学

机器人图书馆

  • PythonRobotics – This is a compilation of various robotics algorithms with visualizations.
  • rospy – This is a library for ROS (Robot Operating System).

RPC服务器

与RPC兼容的服务器

  • RPyC (Remote Python Call) – A transparent and symmetric RPC library for Python
  • zeroRPC – zerorpc is a flexible RPC implementation based on ZeroMQ and MessagePack.

科学

用于科学计算的库。另请参阅面向科学家的Python

  • astropy – A community Python library for Astronomy.
  • bcbio-nextgen – Providing best-practice pipelines for fully automated high throughput sequencing analysis.
  • bccb – Collection of useful code related to biological analysis.
  • Biopython – Biopython is a set of freely available tools for biological computation.
  • cclib – A library for parsing and interpreting the results of computational chemistry packages.
  • Colour – Implementing a comprehensive number of colour theory transformations and algorithms.
  • Karate Club – Unsupervised machine learning toolbox for graph structured data.
  • NetworkX – A high-productivity software for complex networks.
  • NIPY – A collection of neuroimaging toolkits.
  • NumPy – A fundamental package for scientific computing with Python.
  • ObsPy – A Python toolbox for seismology.
  • Open Babel – A chemical toolbox designed to speak the many languages of chemical data.
  • PyDy – Short for Python Dynamics, used to assist with workflow in the modeling of dynamic motion.
  • PyMC – Markov Chain Monte Carlo sampling toolkit.
  • QuTiP – Quantum Toolbox in Python.
  • RDKit – Cheminformatics and Machine Learning Software.
  • SciPy – A Python-based ecosystem of open-source software for mathematics, science, and engineering.
  • SimPy – A process-based discrete-event simulation framework.
  • statsmodels – Statistical modeling and econometrics in Python.
  • SymPy – A Python library for symbolic mathematics.
  • Zipline – A Pythonic algorithmic trading library.

搜索

用于对数据进行索引和执行搜索查询的库和软件

序列化

用于序列化复杂数据类型的库

无服务器框架

用于开发无服务器Python代码的框架

  • python-lambda – A toolkit for developing and deploying Python code in AWS Lambda.
  • Zappa – A tool for deploying WSGI applications on AWS Lambda and API Gateway.

基于Python的Shell

  • xonsh – A Python-powered, cross-platform, Unix-gazing shell language and command prompt.

特定格式处理

用于解析和操作特定文本格式的库

  • General
    • tablib – A module for Tabular Datasets in XLS, CSV, JSON, YAML.
  • Office
    • docxtpl – Editing a docx document by jinja2 template
    • openpyxl – A library for reading and writing Excel 2010 xlsx/xlsm/xltx/xltm files.
    • pyexcel – Providing one API for reading, manipulating and writing csv, ods, xls, xlsx and xlsm files.
    • python-docx – Reads, queries and modifies Microsoft Word 2007/2008 docx files.
    • python-pptx – Python library for creating and updating PowerPoint (.pptx) files.
    • unoconv – Convert between any document format supported by LibreOffice/OpenOffice.
    • XlsxWriter – A Python module for creating Excel .xlsx files.
    • xlwings – A BSD-licensed library that makes it easy to call Python from Excel and vice versa.
    • xlwt / xlrd – Writing and reading data and formatting information from Excel files.
  • PDF
    • PDFMiner – A tool for extracting information from PDF documents.
    • PyPDF2 – A library capable of splitting, merging and transforming PDF pages.
    • ReportLab – Allowing Rapid creation of rich PDF documents.
  • Markdown
    • Mistune – Fastest and full featured pure Python parsers of Markdown.
    • Python-Markdown – A Python implementation of John Gruber’s Markdown.
  • YAML
    • PyYAML – YAML implementations for Python.
  • CSV
    • csvkit – Utilities for converting to and working with CSV.
  • Archive
    • unp – A command line tool that can unpack archives easily.

静电网站生成器

静电网站生成器是一个软件,它接受一些文本+模板作为输入,并在输出上生成Html文件

  • lektor – An easy to use static CMS and blog engine.
  • mkdocs – Markdown friendly documentation generator.
  • makesite – Simple, lightweight, and magic-free static site/blog generator (< 130 lines).
  • nikola – A static website and blog generator.
  • pelican – Static site generator that supports Markdown and reST syntax.

加标签

用于标记项目的库

任务队列

用于处理任务队列的库

  • celery – An asynchronous task queue/job queue based on distributed message passing.
  • dramatiq – A fast and reliable background task processing library for Python 3.
  • huey – Little multi-threaded task queue.
  • mrq – A distributed worker task queue in Python using Redis & gevent.
  • rq – Simple job queues for Python.

模板引擎

用于模板化和词法分析的库和工具

  • Genshi – Python templating toolkit for generation of web-aware output.
  • Jinja2 – A modern and designer friendly templating language.
  • Mako – Hyperfast and lightweight templating for the Python platform.

测试

用于测试代码库和生成测试数据的库

  • Testing Frameworks
    • hypothesis – Hypothesis is an advanced Quickcheck style property based testing library.
    • nose2 – The successor to nose, based on `unittest2.
    • pytest – A mature full-featured Python testing tool.
    • Robot Framework – A generic test automation framework.
    • unittest – (Python standard library) Unit testing framework.
  • Test Runners
    • green – A clean, colorful test runner.
    • mamba – The definitive testing tool for Python. Born under the banner of BDD.
    • tox – Auto builds and tests distributions in multiple Python versions
  • GUI / Web Testing
    • locust – Scalable user load testing tool written in Python.
    • PyAutoGUI – PyAutoGUI is a cross-platform GUI automation Python module for human beings.
    • Schemathesis – A tool for automatic property-based testing of web applications built with Open API / Swagger specifications.
    • Selenium – Python bindings for Selenium WebDriver.
    • sixpack – A language-agnostic A/B Testing framework.
    • splinter – Open source tool for testing web applications.
  • Mock
    • doublex – Powerful test doubles framework for Python.
    • freezegun – Travel through time by mocking the datetime module.
    • httmock – A mocking library for requests for Python 2.6+ and 3.2+.
    • httpretty – HTTP request mock tool for Python.
    • mock – (Python standard library) A mocking and patching library.
    • mocket – A socket mock framework with gevent/asyncio/SSL support.
    • responses – A utility library for mocking out the requests Python library.
    • VCR.py – Record and replay HTTP interactions on your tests.
  • Object Factories
    • factory_boy – A test fixtures replacement for Python.
    • mixer – Another fixtures replacement. Supports Django, Flask, SQLAlchemy, Peewee and etc.
    • model_mommy – Creating random fixtures for testing in Django.
  • Code Coverage
    • coverage – Code coverage measurement.
  • Fake Data
    • fake2db – Fake database generator.
    • faker – A Python package that generates fake data.
    • mimesis – is a Python library that help you generate fake data.
    • radar – Generate random datetime / time.

文本处理

用于解析和操作纯文本的库

  • General
    • chardet – Python 2/3 compatible character encoding detector.
    • difflib – (Python standard library) Helpers for computing deltas.
    • ftfy – Makes Unicode text less broken and more consistent automagically.
    • fuzzywuzzy – Fuzzy String Matching.
    • Levenshtein – Fast computation of Levenshtein distance and string similarity.
    • pangu.py – Paranoid text spacing.
    • pyfiglet – An implementation of figlet written in Python.
    • pypinyin – Convert Chinese hanzi (漢字) to pinyin (拼音).
    • textdistance – Compute distance between sequences with 30+ algorithms.
    • unidecode – ASCII transliterations of Unicode text.
  • Slugify
    • awesome-slugify – A Python slugify library that can preserve unicode.
    • python-slugify – A Python slugify library that translates unicode to ASCII.
    • unicode-slugify – A slugifier that generates unicode slugs with Django as a dependency.
  • Unique identifiers
    • hashids – Implementation of hashids in Python.
    • shortuuid – A generator library for concise, unambiguous and URL-safe UUIDs.
  • Parser
    • ply – Implementation of lex and yacc parsing tools for Python.
    • pygments – A generic syntax highlighter.
    • pyparsing – A general purpose framework for generating parsers.
    • python-nameparser – Parsing human names into their individual components.
    • python-phonenumbers – Parsing, formatting, storing and validating international phone numbers.
    • python-user-agents – Browser user agent parser.
    • sqlparse – A non-validating SQL parser.

第三方接口

用于访问第三方服务API的库。另请参阅Python API包装器和库列表

URL操作

用于解析URL的库

  • furl – A small Python library that makes parsing and manipulating URLs easy.
  • purl – A simple, immutable URL class with a clean API for interrogation and manipulation.
  • pyshorteners – A pure Python URL shortening lib.
  • webargs – A friendly library for parsing HTTP request arguments with built-in support for popular web frameworks.

视频

用于操作视频和GIF的库

  • moviepy – A module for script-based movie editing with many formats, including animated GIFs.
  • scikit-video – Video processing routines for SciPy.
  • vidgear – Most Powerful multi-threaded Video Processing framework.

Web资产管理

用于管理、压缩和缩小网站资产的工具

  • django-compressor – Compresses linked and inline JavaScript or CSS into a single cached file.
  • django-pipeline – An asset packaging library for Django.
  • django-storages – A collection of custom storage back ends for Django.
  • fanstatic – Packages, optimizes, and serves static file dependencies as Python packages.
  • fileconveyor – A daemon to detect and sync files to CDNs, S3 and FTP.
  • flask-assets – Helps you integrate webassets into your Flask app.
  • webassets – Bundles, optimizes, and manages unique cache-busting URLs for static resources.

Web内容提取

用于提取Web内容的库

  • html2text – Convert HTML to Markdown-formatted text.
  • lassie – Web Content Retrieval for Humans.
  • micawber – A small library for extracting rich content from URLs.
  • newspaper – News extraction, article extraction and content curation in Python.
  • python-readability – Fast Python port of arc90’s readability tool.
  • requests-html – Pythonic HTML Parsing for Humans.
  • sumy – A module for automatic summarization of text documents and HTML pages.
  • textract – Extract text from any document, Word, PowerPoint, PDFs, etc.
  • toapi – Every web site provides APIs.

网络爬行

用于自动执行Web抓取的库

  • cola – A distributed crawling framework.
  • feedparser – Universal feed parser.
  • grab – Site scraping framework.
  • MechanicalSoup – A Python library for automating interaction with websites.
  • portia – Visual scraping for Scrapy.
  • pyspider – A powerful spider system.
  • robobrowser – A simple, Pythonic library for browsing the web without a standalone web browser.
  • scrapy – A fast high-level screen scraping and web crawling framework.

Web框架

传统的全栈Web框架。另请参阅REST风格的API

WebSocket

用于使用WebSocket的库

  • autobahn-python – WebSocket & WAMP for Python on Twisted and asyncio.
  • channels – Developer-friendly asynchrony for Django.
  • websockets – A library for building WebSocket servers and clients with a focus on correctness and simplicity.

WSGI服务器

与WSGI兼容的Web服务器

  • bjoern – Asynchronous, very fast and written in C.
  • gunicorn – Pre-forked, ported from Ruby’s Unicorn project.
  • uWSGI – A project aims at developing a full stack for building hosting services, written in C.
  • waitress – Multi-threaded, powers Pyramid.
  • werkzeug – A WSGI utility library for Python that powers Flask and can easily be embedded into your own projects.

Resources

在何处查找学习资源或新的Python库

书籍

网站

时事通讯

播客

Contributing

我们永远欢迎您的贡献!请先看一下投稿指南。

如果我不确定这些库是否很棒,我会保留一些拉取请求,您可以通过向它们添加:+1:来投票支持它们。当票数达到20时,拉取请求将被合并


如果您对这份固执己见的列表有任何疑问,请不要犹豫,请在Twitter上联系我@VintaChen,或者在GitHub上打开一个问题

免费的计算机编程类中文书籍,欢迎投稿

免费的编程中文书籍索引

免费的编程中文书籍索引,欢迎投稿.

如果这个仓库对你有帮助,欢迎stars.

欢迎大家将珍藏已久的经典免费书籍共享出来,您可以:

https://github.com/justjavac/free-programming-books-zh_CN/graphs/contributors:贡献者名单

缩放比例

斯威夫特

返回目录

读书笔记及其它

参与交流

测试相关

目录

编译原理

置顶

函数式概念

操作系统

计算机图形学

智能系统

WEB服务器

分布式系统

版本控制

编译原理

编辑器

函数式概念

NoSQL

计算机图形学

PostgreSQL

网络服务器

MySQL

版本控制

管理和监控

编辑器

项目相关

NoSQL

设计模式

PostgreSQL

Web

MySQL

大数据

管理和监控

编程艺术

项目相关

其它

设计模式

Android

网络

APP

大数据

AWK

编程艺术

C/C++

其它

C#

安卓系统

Clojure

应用程序

CSS/HTML

AWK

Dart

C/C++

Elixir

C#

Erlang

封闭式

Fortran

CSS/HTML

Go

省道

Groovy

灵丹妙药

Haskell

二郎

iOS

Fortran

Java

JavaScript

Kotlin

时髦的

LaTeX

哈斯克尔

LISP

IOS

Lua

Java语言

OCaml

JavaScript

Perl

科特林

PHP

乳胶

Prolog

口齿不清

Python

路亚

R

OCaml

Ruby

Perl

Rust

PHP

Scala

序言

Shell

蟒蛇

Swift

R

读书笔记及其它