python-packaging

Automate Python package creation, structuring, and publishing to PyPI.

Updated Dec 10, 2024
One-click install
npx skills add https://github.com/melikhanmutlu/web_ar --skill python-packaging-melikhanmutlu
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-packaging
Source: https://github.com/melikhanmutlu/web_ar/tree/main/skills/python-packaging
Command: npx skills add https://github.com/melikhanmutlu/web_ar --skill python-packaging-melikhanmutlu

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create distributable Python packages with proper project structure, modern packaging configuration (pyproject.toml), and a clear publishing path to PyPI, covering libraries, CLI tools, and distribution workflows.

Core Features & Use Cases

  • Modern packaging setup with pyproject.toml and recommended backends (setuptools, hatchling, or poetry)
  • Structured project layouts (source or flat layouts) and metadata configuration
  • Publishing to PyPI or private repositories, including wheel and sdist formats
  • Versioning, classifiers, and distribution best practices for Python packages
  • Use Case: Scaffold a reusable Python library with a CLI and publish to PyPI

Quick Start

Create a new Python project, configure pyproject.toml, and publish the package to PyPI following the guide.

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 project for PyPI distribution?

Package a Python project for PyPI distribution by configuring pyproject.toml with a build backend like setuptools or hatchling, structuring the project layout, and generating wheel and sdist formats for upload. This ensures valid metadata and a clear publishing path.

What is the best way to structure a Python package with pyproject.toml?

The best way to structure a Python package with pyproject.toml is using either a source layout or flat layout, combined with build-system configuration and metadata. This modern packaging approach replaces setup.py and standardizes project distribution.

Does Python packaging work with both libraries and CLI tools?

Python packaging works with both libraries and CLI tools by configuring pyproject.toml entry points and classifiers. This allows you to scaffold reusable library code and executable command-line interfaces within the same distributable wheel or sdist.

Which build backend should I choose for Python packaging?

Choose a build backend for Python packaging based on your workflow needs: setuptools for legacy compatibility, hatchling for modern simplicity, or poetry for dependency management. Each configures build-system requirements in pyproject.toml to produce wheel and sdist distributions.

Why do I need a valid project layout to publish to PyPI?

You need a valid project layout to publish to PyPI because build backends require correctly structured directories and metadata to compile source files into wheel and sdist formats. Without proper structure, the build-system configuration fails to locate and package modules correctly.

Can I publish a Python package to a private repository instead of PyPI?

You can publish a Python package to a private repository instead of PyPI by configuring your publishing workflow to target alternative indexes. The packaging process generates standard wheel and sdist formats that are compatible with private distribution repositories.