Module 9: Packaging & Distribution

Sharing your code and managing dependencies professionally.

9.1 Dependency Management

Tools like pip, virtualenv, and modern alternatives like Poetry and Pipenv help manage project dependencies and environments.

9.2 Creating Packages

Structuring your project for distribution. Understanding setup.py and pyproject.toml.

9.3 Publishing to PyPI

The process of building wheels and source distributions and uploading them to the Python Package Index (PyPI).

9.4 Dockerizing Python Apps

Best practices for creating Docker images for Python applications. Multi-stage builds to reduce image size.

FROM python:3.9-slim
WORKDIR /app
COPY requirements.txt .
RUN pip install -r requirements.txt
COPY . .
CMD ["python", "app.py"]

🎯 Practical Exercise

Create a pyproject.toml for a sample project and build a distributable wheel file.