介绍
https://packaging.python.org/en/latest/overview/
The Packaging Flow
The configuration file
At a minimum, the pyproject.toml
file needs a [build-system]
table specifying your build tool. There are many build tools available, including but not limited to flit, hatch, pdm, poetry, setuptools, trampolim, and whey.
https://setuptools.pypa.io/en/latest/userguide/quickstart.html
[build-system]
requires = ["setuptools", "setuptools-scm"]
build-backend = "setuptools.build_meta"
Build artifacts
python3 -m build --sdist source-tree-directory
python3 -m build --wheel source-tree-directory
Upload to the package distribution service
twine upload dist/package-name-version.tar.gz dist/package-name-version-py3-none-any.whl
Packaging Python libraries and tools
Packaging and distributing projects
Python binary distributions
Not all developers have the right tools or experiences to build these components written in these compiled languages, so Python created the Wheel, a package format designed to ship libraries with compiled artifacts.