项目摘要

Summaries and links for the most relevant projects in the space of Python installation and packaging.

PyPA 项目

bandersnatch

Issues | GitHub | PyPI

bandersnatch is a PyPI mirroring client designed to efficiently create a complete mirror of the contents of PyPI. Organizations thus save bandwidth and latency on package downloads (especially in the context of automated tests) and to prevent heavily loading PyPI’s Content Delivery Network (CDN).

build

Docs | Issues | GitHub | PyPI

buildPEP 517 兼容的 Python 包构建器。它提供了 CLI 来构建包,以及 Python API。

cibuildwheel

Docs | Issues | GitHub | PyPI | Discussions | Discord #cibuildwheel

cibuildwheel 是 Python 包,用于为大多数 CI 系统上的所有通用平台和 Python 版本构建 wheels。也可以查看 multibuild

distlib

Docs | Issues | GitHub | PyPI

distlib 是一个库,它实现了与 Python 软件的打包和分发有关的低级函数。distlib 实现了几个相关的 PEPs (Python 增强建议标准),对于第三方打包工具的开发者来说非常有用,可以制作和上传二进制和源码 套件,实现互操作性,解决依赖性,管理包资源,以及做其他类似的功能。

与更严格 packaging 项目(下面)不同,后者专门实现了现代 Python 打包互操作性标准,当被要求处理现代互操作性标准之前的遗留包和元数据时,distlib 还试图提供合理的回退行为,这些包和元数据属于与这些标准不兼容的包子集。

flit

Docs | Issues | PyPI

Flit provides a simple way to create and upload pure Python packages and modules to PyPI. It focuses on making the easy things easy for packaging. Flit can generate a configuration file to quickly set up a simple project, build source distributions and wheels, and upload them to PyPI.

Flit 使用 pyproject.toml 来配置项目。Flit 不依赖诸如 setuptools 之类的工具来构建发行版,或者 twine 来上传至 PyPI。Flit 需要 Python 3,但你可以用它来发布 Python 2 的模块,只要它们能在 Python 3 上被导入。

hatch

Docs | GitHub | PyPI

Hatch is a unified command-line tool meant to conveniently manage dependencies and environment isolation for Python developers. Python package developers use Hatch and its build backend Hatchling to configure, version, specify dependencies for, and publish packages to PyPI. Its plugin system allows for easily extending functionality.

packaging

Docs | Issues | GitHub | PyPI

使用 pipsetuptools,用于 Python 打包的核心实用程序。

The core utilities in the packaging library handle version handling, specifiers, markers, requirements, tags, and similar attributes and tasks for Python packages. Most Python users rely on this library without needing to explicitly call it; developers of the other Python packaging, distribution, and installation tools listed here often use its functionality to parse, discover, and otherwise handle dependency attributes.

This project specifically focuses on implementing the modern Python packaging interoperability standards defined at PyPA 规范, and will report errors for sufficiently old legacy packages that are incompatible with those standards. In contrast, the distlib project is a more permissive library that attempts to provide a plausible reading of ambiguous metadata in cases where packaging will instead report on error.

pip

Docs | Issues | GitHub | PyPI

最流行的安装 Python 软件包的工具,也是现代版本的 Python 所包含的工具。

它提供了从 PyPI 和其他 Python 包索引中查找、下载和安装包的基本核心功能,并且可以通过其命令行界面 (CLI) 合并到广泛的开发工作流程中。

Pipenv

Docs | Source | Issues | PyPI

Pipenv is a project that aims to bring the best of all packaging worlds to the Python world. It harnesses Pipfile, pip, and virtualenv into one single toolchain. It can autoimport requirements.txt and also check for CVEs in Pipfile using safety.

Pipenv aims to help users manage environments, dependencies, and imported packages on the command line. It also works well on Windows (which other tools often underserve), makes and checkes file hashes, to ensure compliance with hash-locked dependency specifiers, and eases uninstallation of packages and dependencies.

Pipfile

源码

Pipfile and its sister Pipfile.lock are a higher-level application-centric alternative to pip’s lower-level requirements.txt file.

pipx

Docs | GitHub | PyPI

pipx 是一个安装和运行 Python 命令行应用程序的工具,它不会与系统上安装的其他软件包产生依赖性冲突。

Python 包装用户指南

Docs | Issues | GitHub

本指南!

readme_renderer

GitHub and docs | PyPI

readme_renderer is a library that package developers use to render their user documentation (README) files into HTML from markup languages such as Markdown or reStructuredText. Developers call it on its own or via twine, as part of their release management process, to check that their package descriptions will properly display on PyPI.

setuptools

Docs | Issues | GitHub | PyPI

setuptools(包括 easy_install )是对 Python distutils 的增强集合,允许你更容易地构建和发布 Python 套件,特别是那些依赖其他软件包的。

distribute was a fork of setuptools that was merged back into setuptools (in v0.7), thereby making setuptools the primary choice for Python packaging.

trove-classifiers

Issues | GitHub | PyPI

trove-classifiers is the canonical source for classifiers on PyPI, which project maintainers use to systematically describe their projects so that users can better find projects that match their needs on the PyPI.

The trove-classifiers package contains a list of valid classifiers and deprecated classifiers (which are paired with the classifiers that replace them). Use this package to validate classifiers used in packages intended for uploading to PyPI. As this list of classifiers is published as code, you can install and import it, giving you a more convenient workflow compared to referring to the list published on PyPI. The issue tracker for the project hosts discussions on proposed classifiers and requests for new classifiers.

twine

Docs | Issues | GitHub | PyPI

Twine is the primary tool developers use to upload packages to the Python Package Index or other Python package indexes. It is a command-line program that passes program files and metadata to a web API. Developers use it because it’s the official PyPI upload tool, it’s fast and secure, it’s maintained, and it reliably works.

virtualenv

Docs | Issues | GitHub | PyPI

virtualenv is a tool which uses the command-line path environment variable to create isolated Python Virtual Environments, much as venv does. virtualenv provides additional functionality, compared to venv, by supporting Python 2.7 and by providing convenient features for configuring, maintaining, duplicating, and troubleshooting the virtual environments. For more information, see the section on 创建虚拟环境.

Warehouse

Docs | Issues | GitHub

The current codebase powering the Python Package Index (PyPI). It is hosted at pypi.org. The default source for pip downloads.

wheel

Docs | Issues | GitHub | PyPI

Primarily, the wheel project offers the bdist_wheel setuptools extension for creating wheel distributions. Additionally, it offers its own command line utility for creating and installing wheels.

See also auditwheel, a tool that package developers use to check and fix Python packages they are making in the binary wheel format. It provides functionality to discover dependencies, check metadata for compliance, and repair the wheel and metadata to properly link and include external shared libraries in a package.

非 PyPA 项目

buildout

Docs | Issues | PyPI | GitHub

Buildout is a Python-based build system for creating, assembling and deploying applications from multiple parts, some of which may be non-Python-based. It lets you create a buildout configuration and reproduce the same software later.

conda

Docs

conda is the package management tool for Anaconda Python installations. Anaconda Python is a distribution from Anaconda, Inc specifically aimed at the scientific community, and in particular on Windows where the installation of binary extensions is often difficult.

Conda is a completely separate tool from pip, virtualenv and wheel, but provides many of their combined features in terms of package management, virtual environment management and deployment of binary extensions.

Conda 不从 PyPI 安装软件包,只能从官方的 Anaconda 仓库,或 anaconda.org(用户贡献的 conda 软件包的地方),或本地(如内网)的软件包服务器安装。然而,请注意 pip 可以被安装到,并与 conda 并肩工作,以管理 套件 来自 PyPI 的软件包。另外,conda skeleton 是一个使 Python 包可以被 conda 安装的工具,首先从 PyPI 获取它们并修改其元数据。

devpi

Docs | Issues | PyPI

devpi features a powerful PyPI-compatible server and PyPI proxy cache with a complementary command line tool to drive packaging, testing and release activities with Python. devpi also provides a browsable and searchable web interface.

enscons

Source | Issues | PyPI

Enscons is a Python packaging tool based on SCons. It builds pip-compatible source distributions and wheels without using distutils or setuptools, including distributions with C extensions. Enscons has a different architecture and philosophy than distutils. Rather than adding build features to a Python packaging system, enscons adds Python packaging to a general purpose build system. Enscons helps you to build sdists that can be automatically built by pip, and wheels that are independent of enscons.

Hashdist

Docs | GitHub

Hashdist is a library for building non-root software distributions. Hashdist is trying to be “the Debian of choice for cases where Debian technology doesn’t work”. The best way for Pythonistas to think about Hashdist may be a more powerful hybrid of virtualenv and buildout. It is aimed at solving the problem of installing scientific software, and making package distribution stateless, cached, and branchable. It is used by some researchers but has been lacking in maintenance since 2016.

meson-python

Docs | GitHub

meson-python is a build backend that uses the Meson build system. It enables Python package authors to use Meson as the build system for their package. It supports a wide variety of languages, including C, and is able to fill the needs of most complex build configurations.

multibuild

GitHub

Multibuild 是一套 CI 脚本,用于构建和测试 Linux、macOS 和(不太灵活的)Windows 的 Python wheels。也见 cibuildwheel

pdm

Docs | GitHub | PyPI

PDM 是一个现代的 Python 软件包管理器,支持 PEP 582。它以类似于 npm 的方式安装和管理软件包,完全不需要创建一个 virtual environment。它还使用 pyproject.toml 来存储项目元数据,如 PEP 621 所定义。

pex

文档 | GitHub | PyPI

pex 既是一个库,也是生成 .pex (Python EXecutable) 文件的工具,是符合 virtualenv 精神的独立的 Python 环境。.pex 文件只是精心构建的压缩文件,带有 #!/usr/bin/env python 和特殊的 __main__.py,旨在使 Python 应用程序的部署像 cp 一样简单。

pip-tools

Docs | GitHub | PyPI

pip-tools 是一套针对 Python 系统管理员和发布经理的工具,他们特别希望保持他们的构建是确定的,同时又能保持与新版本的依赖关系的更新。用户可以通过哈希值指定他们依赖的特定版本,方便地从他们程序的其他部分的信息中制作一个正确格式的需求列表,更新所有的依赖(这是 pip 目前不提供的功能),并为程序创建服从的约束层。

piwheels

Website | Docs | GitHub

piwheels is a website, and software underpinning it, that fetches source code distribution packages from PyPI and compiles them into binary wheels that are optimized for installation onto Raspberry Pi computers. Raspberry Pi OS pre-configures pip to use piwheels.org as an additional index to PyPI.

poetry

Docs | GitHub | PyPI

poetry 是一个命令行工具,用于处理依赖性安装和隔离,以及 Python 包的构建和打包。它使用 pyproject.toml,并且不依赖 pip 中的解析器功能,而是提供自己的依赖性解析器。它试图通过本地缓存依赖关系的元数据来加速用户的安装和依赖关系的解决。

pypiserver

Docs | GitHub | PyPI

pypiserver 是一个简约的应用程序,作为组织内的私有 Python 包索引,实现了一个简单的 API 和浏览器界面。您可以使用标准的上传工具上传私有软件包,用户可以使用 pip 下载和安装它们,而不用公开发布。使用 pypiserver 的组织通常既从 pypiserver 也从 PyPI 下载软件包。

PyScaffold

Docs | GitHub | PyPI

PyScaffold is a project generator for bootstrapping Python packages, ready to be shared on PyPI and installable via pip. It relies on a set of sane default configurations for established tools (such as setuptools, pytest and Sphinx) to provide a productive environment so developers can start coding right away. PyScaffold can also be used with existing projects to make packaging easier.

scikit-build

Docs | GitHub | PyPI

Scikit-build is an improved build system generator for CPython C/C++/Fortran/Cython extensions that integrates with setuptools, wheel and pip. It internally uses cmake (available on PyPI) to provide better support for additional compilers, build systems, cross compilation, and locating dependencies and their associated build requirements. To speed up and parallelize the build of large projects, the user can install ninja (also available on PyPI).

shiv

文档 | GitHub | PyPI

shiv 是一个命令行工具,用于构建完全自包含的 Python zipapps,如 PEP 441 中所述,但包含了所有的依赖。它的主要目标是使分发 Python 应用程序和命令行工具变得快速和简单。

Spack

Docs | GitHub | Paper | Slides

A flexible package manager designed to support multiple versions, configurations, platforms, and compilers. Spack is like Homebrew, but packages are written in Python and parameterized to allow easy swapping of compilers, library versions, build options, etc. Arbitrarily many versions of packages can coexist on the same system. Spack was designed for rapidly building high performance scientific applications on clusters and supercomputers.

Spack 不在 PyPI 中(目前),但它不需要安装,从 GitHub 克隆后可以立即使用。

zest.releaser

文档 | GitHub | PyPI

zest.releaser is a Python package release tool providing an abstraction layer on top of twine. Python developers use zest.releaser to automate incrementing package version numbers, updating changelogs, tagging releases in source control, and uploading new packages to PyPI.

Standard Library Projects

ensurepip

Docs | Issues

A package in the Python Standard Library that provides support for bootstrapping pip into an existing Python installation or virtual environment. In most cases, end users won’t use this module, but rather it will be used during the build of the Python distribution.

distutils

Docs | Issues

The original Python packaging system, added to the standard library in Python 2.0.

Due to the challenges of maintaining a packaging system where feature updates are tightly coupled to language runtime updates, direct usage of distutils is now actively discouraged, with setuptools being the preferred replacement. setuptools not only provides features that plain distutils doesn’t offer (such as dependency declarations and entry point declarations), it also provides a consistent build interface and feature set across all supported Python versions.

venv

Docs | Issues

Python 标准库中的一个包(从 Python 3.3 开始),用于创建 Virtual Environments。 更多信息,请参见 创建虚拟环境 一节。