42. Packaging with setuptools
setuptools is a widely used library for packaging and distributing Python projects.
Example setup.py
from setuptools import setup, find_packages
setup(
name="mypackage",
version="0.1",
packages=find_packages(),
install_requires=["requests"]
)
Build and install:
python setup.py sdist bdist_wheel
pip install dist/mypackage-0.1-py3-none-any.whl
Wrap-Up
setuptools helps create installable Python packages for distribution.