python-packaging

Create and distribute Python packages with pyproject.toml configuration.

Updated Aug 23, 2026
One-click install
npx skills add https://github.com/TriNgo0108/z-command --skill python-packaging-tringo0108
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-packaging
Source: https://github.com/TriNgo0108/z-command/tree/main/templates/skills/python-packaging
Command: npx skills add https://github.com/TriNgo0108/z-command --skill python-packaging-tringo0108

SYSTEM DOCUMENTATION & REQUIREMENTS

💡 This Skill includes references (resource) components.

What problem does it solve?

This Skill streamlines the complex process of creating, structuring, and distributing Python packages, making it easier to share your code with the world.

Core Features & Use Cases

  • Project Structure: Guides you through recommended directory layouts (src layout, flat layout).
  • Configuration: Demonstrates how to configure pyproject.toml for build systems, project metadata, dependencies, and tooling (Black, Ruff, MyPy, Pytest).
  • Building & Publishing: Provides patterns for building distributable packages (wheels, sdists) and publishing them to PyPI or TestPyPI.
  • CLI Tools: Shows how to create command-line interfaces using Click or argparse.
  • Advanced Features: Covers namespace packages, C extensions, and data file inclusion.

Quick Start

Use the python-packaging skill to create a basic pyproject.toml file for a new Python library.

Frequently Asked Questions about python-packaging

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

FAQPage Schema
How do I configure pyproject.toml for a Python package build system?

To configure a Python package build system using pyproject.toml, you define build backend dependencies under the [build-system] table and specify project metadata in the [project] table. This modern standard replaces setup.py for declaring dependencies, tooling, and packaging requirements.

What is the recommended project layout for distributing a Python package?

The recommended project layouts for distributing a Python package are the src layout and the flat layout. Using a src layout separates importable code from configuration files, preventing accidental imports during testing and ensuring clean package distribution.

How do I publish a Python package to PyPI using GitHub Actions?

You can publish a Python package to PyPI using GitHub Actions by creating an automated workflow that builds wheels and sdists, then uploads them using twine. This CI/CD integration ensures consistent testing and automated distribution upon repository commits or releases.

Should I use setuptools, hatchling, flit, or poetry for Python packaging?

Choosing between setuptools, hatchling, flit, and poetry for Python packaging depends on your project complexity. Setuptools offers legacy stability, while hatchling, flit, and poetry provide modern PEP 517/518/621 compliant builds with varying dependency resolution and CLI features.

How do I add a command-line interface to a Python package using Click or argparse?

To add a command-line interface to a Python package, you define entry points in pyproject.toml that map to functions using Click or argparse. This registers executable console scripts when the package is installed, allowing users to run your tool from the terminal.

Can I include C extensions and data files when building a Python wheel?

Yes, you can include C extensions and data files when building a Python wheel by configuring the build backend in pyproject.toml. The packaging process supports advanced features like namespace packages and data file inclusion for complex project requirements.