python-packaging

Package Python libraries into wheels and sdists for PyPI publishing.

Updated Jan 20, 2026
One-click install
npx skills add https://github.com/ollieb89/ugro --skill python-packaging-ollieb89
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-packaging
Source: https://github.com/ollieb89/ugro/tree/main/.windsurf/skills/python-packaging
Command: npx skills add https://github.com/ollieb89/ugro --skill python-packaging-ollieb89

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Packaging Python libraries and CLI tools into distributable formats (wheels and sdists) is error-prone and time-consuming without a clean project recipe. This Skill provides a best-practices blueprint to create, structure, and publish Python packages that are ready for distribution.

Core Features & Use Cases

  • Modern packaging standards: pyproject.toml driven builds with PEP 517/518 support.
  • Flexible project layouts: supports source layout (src/) and flat layouts for libraries.
  • Publish workflows: ready-to-use publishing to PyPI or private indices, including wheel and sdist distributions.
  • CLI tool packaging: creates entry points and executable scripts for command-line tools.
  • Real-world scenario: a library author packages a small utility with a CLI and publishes it to PyPI.

Quick Start

  1. Create a pyproject.toml and project structure (src/my_package/ with init.py).
  2. Build the distributions locally: python -m build
  3. Publish to PyPI (or TestPyPI) using twine: twine upload dist/*

Frequently Asked Questions about python-packaging

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I package a Python library for distribution?

Package Python libraries by creating a pyproject.toml file with PEP 517/518 standards, organizing code in src/my_package/, and running python -m build to generate wheel and sdist distributions ready for PyPI or private indexes.

What's the difference between wheel and sdist distributions?

Wheels are pre-built binary distributions that install faster without compilation, while sdists are source distributions containing all project files. Both formats are generated during packaging and published together for maximum compatibility.

How do I publish a Python package to PyPI?

Publish packages to PyPI using twine by running twine upload dist/* after building distributions locally. Twine handles authentication and uploads wheel and sdist files to PyPI or private indexes securely.

Can I package Python CLI tools with entry points?

Yes, pyproject.toml supports defining entry points that create executable scripts for command-line tools. This allows users to call your CLI tool directly from the terminal after installing your package.

Do I need to use src/ layout for my Python project?

The src/ layout is a best practice for library packaging that prevents accidental imports of uninstalled code, but pyproject.toml and modern build standards also support flat layouts depending on your project structure preferences.

What's the purpose of pyproject.toml in Python packaging?

pyproject.toml is the modern configuration file that centralizes project metadata, build system requirements, and dependencies according to PEP 517/518 standards, replacing legacy setup.py for most packaging workflows.