Create distributable Python packages with proper project

Python packaging

by wshobson · MIT license · ★ 39,857 on GitHub · updated Sep 21

Python packaging cover

Create distributable Python packages with proper project structure, setup.py/pyproject.toml, and publishing to PyPI. Use when packaging Python libraries, creating CLI tools, or distributing Python code.

---
name: python-packaging
description: Create distributable Python packages with proper project structure, setup.py/pyproject.toml, and publishing to PyPI. Use when packaging Python libraries, creating CLI tools, or distributing Python code.
---

# Python Packaging

Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.

## When to Use This Skill

- Creating Python libraries for distribution
- Building command-line tools with entry points
- Publishing packages to PyPI or private repositories
- Setting up Python project structure
- Creating installable packages with dependencies
- Building wheels and source distributions
- Versioning and releasing Python packages

Overview

Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.

Manual install (npx, ZIP)
Claude Codenpx skills add wshobson/agents --skill python-packaging -g -a claude-code
Claude Code (manual)mkdir -p ~/.claude/skills && curl -sL https://codeload.github.com/wshobson/agents/tar.gz/4236bb91f839 \ | tar -xz -C ~/.claude/skills --strip-components=4 agents-4236bb91f839/plugins/python-development/skills/python-packaging
Windows (PowerShell)New-Item -ItemType Directory -Force "$HOME\.claude\skills" | Out-Null; Invoke-WebRequest "https://m.agentalley.io/zip/2b11bf76aa65dba7903d/python-packaging.zip" -OutFile "$env:TEMP\python-packaging.zip"; Expand-Archive "$env:TEMP\python-packaging.zip" -DestinationPath "$HOME\.claude\skills" -Force
Claude.ai / desktopDownload the ZIP and upload it under Settings → Capabilities → Skills.
Codex, Cursor, other agentsPoint them at SKILL.md. The other files are plain text.

Connects with Agent Alley MCP · agentalley.io/mcp

Files included

  • SKILL.md3.8 KB
  • references/2 files · 13.9 KB
Read the files here
wshobson/4236bb93 files
SKILL.md
Show the full text167 lines

Python Packaging

Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.

When to Use This Skill

  • Creating Python libraries for distribution
  • Building command-line tools with entry points
  • Publishing packages to PyPI or private repositories
  • Setting up Python project structure
  • Creating installable packages with dependencies
  • Building wheels and source distributions
  • Versioning and releasing Python packages
  • Creating namespace packages
  • Implementing package metadata and classifiers

Core Concepts

1. Package Structure
  • Source layout: src/package_name/ (recommended)
  • Flat layout: package_name/ (simpler but less flexible)
  • Package metadata: pyproject.toml, setup.py, or setup.cfg
  • Distribution formats: wheel (.whl) and source distribution (.tar.gz)
2. Modern Packaging Standards
  • PEP 517/518: Build system requirements
  • PEP 621: Metadata in pyproject.toml
  • PEP 660: Editable installs
  • pyproject.toml: Single source of configuration
3. Build Backends
  • setuptools: Traditional, widely used
  • hatchling: Modern, opinionated
  • flit: Lightweight, for pure Python
  • poetry: Dependency management + packaging
4. Distribution
  • PyPI: Python Package Index (public)
  • TestPyPI: Testing before production
  • Private repositories: JFrog, AWS CodeArtifact, etc.

Quick Start

Minimal Package Structure
my-package/
├── pyproject.toml
├── README.md
├── LICENSE
├── src/
│   └── my_package/
│       ├── __init__.py
│       └── module.py
└── tests/
    └── test_module.py
Minimal pyproject.toml
[build-system]
requires = ["setuptools>=61.0"]
build-backend = "setuptools.build_meta"

[project]
name = "my-package"
version = "0.1.0"
description = "A short description"
authors = [{name = "Your Name", email = "[email protected]"}]
readme = "README.md"
requires-python = ">=3.8"
dependencies = [
    "requests>=2.28.0",
]

[project.optional-dependencies]
dev = [
    "pytest>=7.0",
    "black>=22.0",
]

Package Structure Patterns

my-package/
├── pyproject.toml
├── README.md
├── LICENSE
├── .gitignore
├── src/
│   └── my_package/
│       ├── __init__.py
│       ├── core.py
│       ├── utils.py
│       └── py.typed          # For type hints
├── tests/
│   ├── __init__.py
│   ├── test_core.py
│   └── test_utils.py
└── docs/
    └── index.md

Advantages:

  • Prevents accidentally importing from source
  • Cleaner test imports
  • Better isolation

pyproject.toml for source layout:

[tool.setuptools.packages.find]
where = ["src"]
Pattern 2: Flat Layout
my-package/
├── pyproject.toml
├── README.md
├── my_package/
│   ├── __init__.py
│   └── module.py
└── tests/
    └── test_module.py

Simpler but:

  • Can import package without installing
  • Less professional for libraries
Pattern 3: Multi-Package Project
project/
├── pyproject.toml
├── packages/
│   ├── package-a/
│   │   └── src/
│   │       └── package_a/
│   └── package-b/
│       └── src/
│           └── package_b/
└── tests/

Detailed patterns and worked examples

Detailed pattern documentation lives in references/details.md. Read that file when the navigation tier above is insufficient.

1---
2name: python-packaging
3description: Create distributable Python packages with proper project structure, setup.py/pyproject.toml, and publishing to PyPI. Use when packaging Python libraries, creating CLI tools, or distributing Python code.
4---
5 
6# Python Packaging
7 
8Comprehensive guide to creating, structuring, and distributing Python packages using modern packaging tools, pyproject.toml, and publishing to PyPI.
9 
10## When to Use This Skill
11 
12- Creating Python libraries for distribution
13- Building command-line tools with entry points
14- Publishing packages to PyPI or private repositories
15- Setting up Python project structure
16- Creating installable packages with dependencies
17- Building wheels and source distributions
18- Versioning and releasing Python packages
19- Creating namespace packages
20- Implementing package metadata and classifiers
21 
22## Core Concepts
23 
24### 1. Package Structure
25 
26- **Source layout**: `src/package_name/` (recommended)
27- **Flat layout**: `package_name/` (simpler but less flexible)
28- **Package metadata**: pyproject.toml, setup.py, or setup.cfg
29- **Distribution formats**: wheel (.whl) and source distribution (.tar.gz)
30 
31### 2. Modern Packaging Standards
32 
33- **PEP 517/518**: Build system requirements
34- **PEP 621**: Metadata in pyproject.toml
35- **PEP 660**: Editable installs
36- **pyproject.toml**: Single source of configuration
37 
38### 3. Build Backends
39 
40- **setuptools**: Traditional, widely used
41- **hatchling**: Modern, opinionated
42- **flit**: Lightweight, for pure Python
43- **poetry**: Dependency management + packaging
44 
45### 4. Distribution
46 
47- **PyPI**: Python Package Index (public)
48- **TestPyPI**: Testing before production
49- **Private repositories**: JFrog, AWS CodeArtifact, etc.
50 
51## Quick Start
52 
53### Minimal Package Structure
54 
55```
56my-package/
57├── pyproject.toml
58├── README.md
59├── LICENSE
60├── src/
61│ └── my_package/
62│ ├── __init__.py
63│ └── module.py
64└── tests/
65 └── test_module.py
66```
67 
68### Minimal pyproject.toml
69 
70```toml
71[build-system]
72requires = ["setuptools>=61.0"]
73build-backend = "setuptools.build_meta"
74 
75[project]
76name = "my-package"
77version = "0.1.0"
78description = "A short description"
79authors = [{name = "Your Name", email = "[email protected]"}]
80readme = "README.md"
81requires-python = ">=3.8"
82dependencies = [
83 "requests>=2.28.0",
84]
85 
86[project.optional-dependencies]
87dev = [
88 "pytest>=7.0",
89 "black>=22.0",
90]
91```
92 
93## Package Structure Patterns
94 
95### Pattern 1: Source Layout (Recommended)
96 
97```
98my-package/
99├── pyproject.toml
100├── README.md
101├── LICENSE
102├── .gitignore
103├── src/
104│ └── my_package/
105│ ├── __init__.py
106│ ├── core.py
107│ ├── utils.py
108│ └── py.typed # For type hints
109├── tests/
110│ ├── __init__.py
111│ ├── test_core.py
112│ └── test_utils.py
113└── docs/
114 └── index.md
115```
116 
117**Advantages:**
118 
119- Prevents accidentally importing from source
120- Cleaner test imports
121- Better isolation
122 
123**pyproject.toml for source layout:**
124 
125```toml
126[tool.setuptools.packages.find]
127where = ["src"]
128```
129 
130### Pattern 2: Flat Layout
131 
132```
133my-package/
134├── pyproject.toml
135├── README.md
136├── my_package/
137│ ├── __init__.py
138│ └── module.py
139└── tests/
140 └── test_module.py
141```
142 
143**Simpler but:**
144 
145- Can import package without installing
146- Less professional for libraries
147 
148### Pattern 3: Multi-Package Project
149 
150```
151project/
152├── pyproject.toml
153├── packages/
154│ ├── package-a/
155│ │ └── src/
156│ │ └── package_a/
157│ └── package-b/
158│ └── src/
159│ └── package_b/
160└── tests/
161```
162 
163## Detailed patterns and worked examples
164 
165Detailed pattern documentation lives in `references/details.md`. Read that file when the navigation tier above is insufficient.
166 
167 
View all files on GitHub →

Details

Updated
Sep 21, 2026
License
MIT
Stars on the repo
★ 39,857
Checked
Source
wshobson/agents ↗
Creator
wshobson · 179 listings
View creator

Similar skills

See all →
SkillExtract text, tables, metadataXberg Document Extractionxberg-io/xberg · by xberg-ioExtract text, tables, metadata, and images from 107 document formats (PDF, Office, images, HTML, email, archives, academic) using Xberg. Use when writing code that calls Xberg APIs in Python, Node.js/TypeScript, Rust, or CLI. Covers installation, extraction (sync/async), configuration (OCR, chunking, output format), batch processing, error handling, and plugins.★ 9.4k GitHub starsSkillMove code from one implementation to another functionCode migrationkucherenko/jscpd · by kucherenkoMove code from one implementation to another function by function, tests first and code second, and check two implementations of one app for parity, with jscpd --compare as the progress measure and a coverage map binding each function to its tests. Use when porting a library or app to another language or framework (Java to Kotlin, JavaScript to Rust, a Python library to TypeScript, an iOS app to Android), when asked what is left to port, or when comparing the Android and iOS versions of an app.★ 6.3k GitHub starsSkillManages Ahrefs API usage in Python using ahrefs-pythonOpenClaudia/openclaudia-skills · by OpenClaudiaManages Ahrefs API usage in Python using `ahrefs-python` library. Use when working with SEO / marketing related tasks or with data including backlinks, keywords, domain ratings, organic traffic, site audits, rank tracking, and brand monitoring. Covers `ahrefs-python` usage including AhrefsClient / AsyncAhrefsClient, typed request/response models, error handling, and all API sections.★ 705 GitHub starsMCPDocx LLM translatoradeudealfluence/adeu · by dealfluenceDocx ↔ LLM translator. Projects .docx office files to Markdown for editing. Projects edits back to OOXML as tracked changes (redlines). Python and Node.js implementations.★ 165 GitHub starsSkillCreate an Amazon-compliant white-background main imageAmazon White-Background Main Image · 亚马逊白底主图xianyu110/ecommerce-image-skills · by xianyu110Create an Amazon-compliant white-background main image (pure #FFFFFF background, product fills ≥85% of the frame, no text, props or watermark) from a product photo with GPT Image 2.5, then verify it with a Python check script. Use for Amazon/Walmart/eBay main images, 白底图, 白底主图, hero image, listing main photo.★ 92 GitHub starsMCPOfficial monorepo of SDKs, CLISendmux sdkSendmux/sendmux-sdk · by SendmuxOfficial monorepo of SDKs, CLI, and MCP servers for Sendmux email APIs across TypeScript, Python, Go, PHP, Rust, and Ruby.★ 65 GitHub stars

More from wshobson

SkillMaster C/.NET backend development patterns for buildingwshobson/agents · by wshobsonMaster C#/.NET backend development patterns for building robust APIs, MCP servers, and enterprise applications. Covers async/await, dependency injection, Entity Framework Core, Dapper, configuration, caching, and testing with xUnit. Use when developing .NET backends, reviewing C# code, or designing API architectures.★ 39.9k GitHub starsSkillImplement WCAG 2.2 compliant interfaces with mobileAccessibility compliancewshobson/agents · by wshobsonImplement WCAG 2.2 compliant interfaces with mobile accessibility, inclusive design patterns, and assistive technology support. Use when auditing accessibility, implementing ARIA patterns, building for screen readers, or ensuring inclusive user experiences.★ 39.9k GitHub starsSkillMaster Material Design 3 and Jetpack Compose patternsAndroid Mobile Designwshobson/agents · by wshobsonMaster Material Design 3 and Jetpack Compose patterns for building native Android apps. Use when designing Android interfaces, implementing Compose UI, or following Google's Material Design guidelines.★ 39.9k GitHub starsSkillMigrate from AngularJS to Angular using hybrid modeAngular migrationwshobson/agents · by wshobsonMigrate from AngularJS to Angular using hybrid mode, incremental component rewriting, and dependency injection updates. Use when upgrading AngularJS applications, planning framework migrations, or modernizing legacy Angular code.★ 39.9k GitHub starsSkillUnderstand anti-reversing, obfuscationAnti reversing techniqueswshobson/agents · by wshobsonUnderstand anti-reversing, obfuscation, and protection techniques encountered during software analysis. Use this skill when analyzing malware evasion techniques, when implementing anti-debugging protections for CTF challenges, when reverse engineering packed binaries, or when building security research tools that need to detect virtualized environments.★ 39.9k GitHub starsSkillBuild production Apache Airflow DAGs with best practicesApache Airflow DAG Patternswshobson/agents · by wshobsonBuild production Apache Airflow DAGs with best practices for operators, sensors, testing, and deployment. Use when creating data pipelines, orchestrating workflows, or scheduling batch jobs.★ 39.9k GitHub stars