Nat TaylorBlog, AI, Product Management & Tinkering

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:

  1. Structure your package as follows in the filesystem
  2. Create a minimal pyproject.toml
  3. 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"

Post Navigation

«
»