python-packaging

Create distributable Python packages with pyproject.toml and publish them to PyPI.

2|Updated Jun 16, 2026
One-click install
npx skills add https://github.com/monang404/lunawave --skill python-packaging-monang404
Or copy as Structured Prompt for Agent▼
Please help me install this Agent Skill.
Skill: python-packaging
Source: https://github.com/monang404/lunawave/tree/main/.agent/skills/python-packaging
Command: npx skills add https://github.com/monang404/lunawave --skill python-packaging-monang404

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? Structuring, building, and publishing Python packages involves many moving parts—pyproject.toml configuration, build backends, versioning, CLI entry points, and PyPI uploads—and mistakes in any step produce broken or uninstallable distributions. ## Core Features & Use Cases - Project Structure Guidance: Set up src-layout or flat-layout packages with correct setuptools package discovery and data file inclusion. - Build & Publish Workflows: Build wheels and source distributions with python -m build, validate with twine, and publish to TestPyPI or PyPI, including GitHub Actions automation. - CLI & Versioning Patterns: Register console scripts via project.scripts, implement Click or argparse CLIs, and manage versions with semantic or git-based (setuptools-scm) schemes. - Use Case: You wrote a utility library and want teammates to install it with pip. Use this Skill to generate a complete pyproject.toml, build the wheel, and publish it to PyPI with an automated release workflow. ## Quick Start Ask the assistant to scaffold a new Python package with a src layout, a complete pyproject.toml, and a CLI entry point ready for publishing to PyPI.

Frequently Asked Questions about python-packaging

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

FAQPage Schema
How do I create a Python package with pyproject.toml?▼

Define a [build-system] table with setuptools as the backend and a [project] table with name, version, description, and dependencies in pyproject.toml. Place your code in a src/package_name directory and configure [tool.setuptools.packages.find] with where = ["src"].

How to publish a Python package to PyPI?▼

Build the distribution with python -m build, verify it with twine check dist/*, then upload with twine upload dist/*. Test first on TestPyPI using twine upload --repository testpypi dist/* and authenticate with an API token.

What is the difference between src layout and flat layout?▼

Src layout places the package under src/package_name, preventing accidental imports from the project root and giving cleaner test isolation. Flat layout puts the package at the repository root, which is simpler but allows importing without installation.

How do I add a command-line script to my Python package?▼

Add a [project.scripts] table in pyproject.toml mapping a command name to a function, such as my-tool = "my_package.cli:main". After installation, the command becomes available in the shell and can be implemented with Click or argparse.

setuptools vs hatchling vs flit for packaging?▼

setuptools is the traditional, widely supported backend with extensive configuration options. hatchling is modern and opinionated, while flit is lightweight and suited to pure-Python packages. All are valid PEP 517 build backends declared in pyproject.toml.

Why does my package fail to include data files after installation?▼

Data files are excluded unless declared in [tool.setuptools.package-data] or MANIFEST.in. Access them at runtime with importlib.resources.files() rather than relative paths, which break once the package is installed.