$120 tested Claude codes · real before/after data · Full tier $15 one-timebuy --sheet=15 →
$Free 40-page Claude guide — setup, 120 prompt codes, MCP servers, AI agents. download --free →
clskills.sh — terminal v2.4 — 2,347 skills indexed● online
[CL]Skills_
PythonintermediateNew

Python Packaging

Share

Package Python library for PyPI distribution

Works with OpenClaude

You are a Python packaging specialist. The user wants to package a Python library for PyPI distribution with proper metadata, dependencies, and build configuration.

What to check first

  • Run python --version to ensure Python 3.7+ is installed
  • Verify build and twine are installed: pip install build twine
  • Check that your project has a src/ or top-level package directory with __init__.py files
  • Confirm you have a README.md and LICENSE file in the project root

Steps

  1. Create a pyproject.toml file in your project root with [build-system], [project], and [tool.setuptools] sections defining name, version, description, authors, and dependencies
  2. Add version = "0.1.0" and description = "Your package description" to the [project] table in pyproject.toml
  3. List all runtime dependencies in dependencies = [...] array and optional dev dependencies in [project.optional-dependencies]
  4. Define package discovery using [tool.setuptools.packages] with find = {} or explicitly list packages with packages = ["your_package"]
  5. Add readme = "README.md", requires-python = ">=3.7", and license = {text = "MIT"} to [project] section
  6. Optional: Create a src/ layout and configure [tool.setuptools] with package-dir = {"" = "src"} for better separation
  7. Run python -m build to generate distribution files (.whl and .tar.gz) in the dist/ directory
  8. Validate your package with twine check dist/* before uploading
  9. For PyPI upload, run twine upload dist/* or twine upload --repository testpypi dist/* for test environment

Code

# pyproject.toml — complete minimal example for PyPI distribution

[build-system]
requires = ["setuptools>=65.0", "wheel"]
build-backend = "setuptools.build_meta"

[project]
name = "my-awesome-package"
version = "0.1.0"
description = "A brief description of your package"
readme = "README.md"
requires-python = ">=3.7"
license = {text = "MIT"}
authors = [
    {name = "Your Name", email = "your.email@example.com"}
]
keywords = ["python", "packaging", "pypi"]
classifiers = [
    "Development Status :: 3 - Alpha",
    "Intended Audience :: Developers",
    "License :: OSI Approved :: MIT License",
    "Programming Language :: Python :: 3",
    "Programming Language :: Python :: 3.7",
    "Programming Language :: Python :: 3.8",
    "Programming Language :: Python :: 3.9",
]
dependencies = [
    "requests

Note: this example was truncated in the source. See the GitHub repo for the latest full version.

Common Pitfalls

  • Treating this skill as a one-shot solution — most workflows need iteration and verification
  • Skipping the verification steps — you don't know it worked until you measure
  • Applying this skill without understanding the underlying problem — read the related docs first

When NOT to Use This Skill

  • When a simpler manual approach would take less than 10 minutes
  • On critical production systems without testing in staging first
  • When you don't have permission or authorization to make these changes

How to Verify It Worked

  • Run the verification steps documented above
  • Compare the output against your expected baseline
  • Check logs for any warnings or errors — silent failures are the worst kind

Production Considerations

  • Test in staging before deploying to production
  • Have a rollback plan — every change should be reversible
  • Monitor the affected systems for at least 24 hours after the change

Quick Info

CategoryPython
Difficultyintermediate
Version1.0.0
AuthorClaude Skills Hub
pythonpypipackaging

Install command:

curl -o ~/.claude/skills/python-packaging.md https://claude-skills-hub.vercel.app/skills/python/python-packaging.md

Related Python Skills

Other Claude Code skills in the same category — free to download.

Want a Python skill personalized to YOUR project?

This is a generic skill that works for everyone. Our AI can generate one tailored to your exact tech stack, naming conventions, folder structure, and coding patterns — with 3x more detail.