python-packaging

Packages and publishes Python projects to PyPI using pyproject.toml and build backends.

1|2|Updated Nov 25, 2017
One-click install
npx skills add https://github.com/asarchami/dotfiles --skill python-packaging-asarchami
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: python-packaging
Source: https://github.com/asarchami/dotfiles/tree/main/dot_config/opencode/skills/python/packaging
Command: npx skills add https://github.com/asarchami/dotfiles --skill python-packaging-asarchami

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It removes the guesswork from packaging and distributing Python projects by providing ready-to-use pyproject.toml configurations, build commands, and PyPI publishing workflows. ## Core Features & Use Cases - pyproject.toml Configuration: Provides complete templates for build systems, project metadata, dependencies, and CLI entry points. - Build and Validation: Covers building distributions with python -m build and validating them with twine check. - PyPI Publishing: Includes TestPyPI testing, token-based uploads, and GitHub Actions trusted publishing workflows. - Use Case: You have a finished Python library and need to publish it to PyPI. Use this Skill to configure pyproject.toml, build the wheel, validate it, and set up automated publishing on GitHub releases. ## Quick Start Help me configure pyproject.toml and publish my Python package to PyPI using trusted publishing.

Frequently Asked Questions about python-packaging

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

FAQPage Schema
How do I publish a Python package to PyPI?

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

What should go in pyproject.toml for a Python package?

Include a build-system table with setuptools and wheel, plus a project table with name, version, description, readme, requires-python, license, and dependencies. Add optional-dependencies for extras and project.scripts for CLI entry points.

Should I pin exact versions in Python package dependencies?

No, use minimum version constraints like requests>=2.28 instead of exact pins like requests==2.28.1. Exact pins cause dependency conflicts for downstream users, while minimum bounds allow compatible updates.

How do I set up trusted publishing to PyPI with GitHub Actions?

Create a workflow triggered on release publication with id-token: write permission, build the package, then use pypa/gh-action-pypi-publish. This publishes without storing API tokens as secrets.

Why does my PyPI upload fail validation?

Uploads fail when pyproject.toml is invalid, the README is missing or malformed, or the version already exists on PyPI. Run twine check dist/* locally to catch metadata errors before uploading.