Python Packaging
Published on .
Recently I needed to make a little toy Python library pip install-able, which I expected to be very intimidating, but is actually quite simple. The simplest path I found is:
- Structure your package as follows in the filesystem
- Create a minimal
pyproject.toml
- Run
python -m build
That’s it. Now to install, run pip install dist/mypackage-0.0.1-py3-none-any.whl
├── mypackage
│ └── __init__.py
├── pyproject.toml
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"
[project]
name = "mypackage"
version = "0.0.1"