Skip to content
Back to skills

Python Packaging

ASecurity

Python package creation and PyPI distribution via pyproject.toml and entry points. Use when publishing a package or setting up build configuration.

  • 342 stars
  • 0 votes
  • 0 copies
  • 2 views
  • Added December 19, 2025
developmentpythongobashtestinggitci/cdperformance

Works with

  • cli

Security analysis

A100/100

Pro scans all 5 files and shows the line behind each finding

Scanned September 20, 2026

npx -y skills add athola/claude-night-market --skill python-packaging --agent claude-code

Installs into .claude/skills of the current project.

Are you the author of Python Packaging?

Add the live security badge to your README. It updates with every re-scan.

Security grade badge for Python Packaging
[![Security: A — Skills Directory](https://www.skillsdirectory.com/api/skills/athola-python-packaging/badge)](https://www.skillsdirectory.com/skills/athola-python-packaging)

More formats (shields.io, HTML) on the badges page. Keep it an A: scan every change in CI with Pro.

Download with Pro
SKILL.md
---
name: python-packaging
description: Python package creation and PyPI distribution via pyproject.toml and entry points. Use when publishing a package or setting up build configuration.
globs: "**/*.py"
alwaysApply: false
category: packaging
tags:
- python
- packaging
- pyproject.toml
- uv
- pip
- pypi
- distribution
tools: []
usage_patterns:
- package-creation
- pypi-publishing
- cli-tool-development
- library-distribution
complexity: beginner
model_hint: fast
estimated_tokens: 200
progressive_loading: true
modules:
- uv-workflow.md
- pyproject-patterns.md
- entry-points.md
- ci-cd-integration.md
---

# Python Packaging

Modern Python packaging with pyproject.toml, uv, and best practices for distribution.

## Quick Start

```bash
# Create new project with uv
uv init my-package
cd my-package

# Add dependencies
uv add requests click

# Build package
uv build

# Publish to PyPI
uv publish
```
**Verification:** Run the command with `--help` flag to verify availability.

## When To Use

- Creating distributable Python libraries
- Building CLI tools
- Publishing to PyPI
- Setting up development environments
- Managing project dependencies

## When NOT To Use

- Testing packages - use python-testing
  instead
- Optimizing package performance - use python-performance
- Testing packages - use python-testing
  instead
- Optimizing package performance - use python-performance

## Core Decisions

### 1. Layout Choice

```yaml
# Source layout (recommended)
src/my_package/
    __init__.py
    module.py

# Flat layout (simple)
my_package/
    __init__.py
    module.py
```
**Verification:** Run the command with `--help` flag to verify availability.

**Source layout benefits:**
- Clear separation of source and tests
- Prevents accidental imports of uninstalled code
- Better for packages with complex structure

### 2. Project Structure

**Minimal Project:**
```
**Verification:** Run `pytest -v` to verify tests pass.
my-project/
├── pyproject.toml
├── README.md
├── src/
│   └── my_package/
│       └── __init__.py
└── tests/
    └── test_init.py
```
**Verification:** Run `pytest -v` to verify tests pass.

**Complete Project:**
```
**Verification:** Run the command with `--help` flag to verify availability.
my-project/
├── pyproject.toml
├── README.md
├── LICENSE
├── .gitignore
├── src/
│   └── my_package/
│       ├── __init__.py
│       ├── cli.py
│       ├── core.py
│       └── utils.py
├── tests/
│   ├── conftest.py
│   └── test_core.py
└── docs/
    └── index.md
```
**Verification:** Run `pytest -v` to verify tests pass.

## Detailed Topics

See modules for detailed information:

- **[uv Workflow](modules/uv-workflow.md)** - Complete uv commands and troubleshooting
- **[pyproject.toml Patterns](modules/pyproject-patterns.md)** - Configuration examples for different package types
- **[Entry Points](modules/entry-points.md)** - Console scripts, GUI scripts, and plugins
- **[CI/CD Integration](modules/ci-cd-integration.md)** - GitHub Actions and automated publishing

## Best Practices

1. **Use source layout** for anything beyond simple packages
2. **Pin direct dependencies** with minimum versions
3. **Use optional dependency groups** for dev/docs/test
4. **Include py.typed** for type hint support
5. **Add detailed README** with usage examples
6. **Use semantic versioning** (MAJOR.MINOR.PATCH)
7. **Test on multiple Python versions** before publishing

## Exit Criteria

- Modern pyproject.toml configuration
- Clear dependency specification
- Proper version management
- Tests included and passing
- Build process reproducible
- Publishing pipeline automated

Files in this skill

  • SKILL.md3 KB
  • modules/ci-cd-integration.md2.1 KB
  • modules/entry-points.md1.7 KB
  • modules/pyproject-patterns.md2.9 KB
  • modules/uv-workflow.md1.4 KB

Attribution

Is this your skill, or is something wrong with this listing? Request removal or report an issue. Author removals are honored within 72 hours.

Comments

Loading comments…

Newsletter

Get the weekly list of safe new skills, and the ones we pulled.