From python-library-distribution
Sets up Python library projects with pyproject.toml, uv, ruff, pytest, pre-commit, and GitHub Actions. Use when creating new libraries or modernizing existing projects.
How this skill is triggered — by the user, by Claude, or both
Slash command
/python-library-distribution:project-setupThe summary Claude sees in its skill listing — used to decide when to auto-load this skill
Create a new library with this structure:
Create a new library with this structure:
my-library/
├── src/my_library/
│ ├── __init__.py
│ └── py.typed
├── tests/
├── pyproject.toml
├── Makefile
├── .pre-commit-config.yaml
└── .github/workflows/ci.yml
Use src/ layout to prevent accidental imports of development code.
For complete templates, see:
[build-system]
requires = ["setuptools>=61.0", "wheel"]
build-backend = "setuptools.build_meta"
[project]
name = "my-library"
version = "0.1.0"
description = "What it does"
readme = "README.md"
requires-python = ">=3.10"
license = {text = "MIT"}
dependencies = []
[project.optional-dependencies]
dev = ["pytest>=7.0", "ruff>=0.1", "mypy>=1.0"]
[tool.setuptools.packages.find]
where = ["src"]
# Setup
pip install -e ".[dev]"
pre-commit install
# Daily workflow
ruff check src tests # Lint
ruff format src tests # Format
pytest # Test
mypy src # Type check
| Choice | Recommendation | Why |
|---|---|---|
| Layout | src/ | Catches packaging bugs early |
| Build backend | setuptools | Mature, broad compatibility |
| Linter | ruff | Fast, replaces flake8+isort+black |
| Python range | >=3.10 | Don't pin exact versions |
| Dependencies | Minimal | Move optional deps to extras |
Project Setup:
- [ ] src/ layout with py.typed marker
- [ ] pyproject.toml (not setup.py)
- [ ] Makefile with dev/test/lint/format
- [ ] .pre-commit-config.yaml
- [ ] .github/workflows/ci.yml
- [ ] README.md, LICENSE, CHANGELOG.md
- [ ] .gitignore
Create a new project structure:
python scripts/create_project.py my-library --author "Name"
This skill is based on the Guide to Developing High-Quality Python Libraries by Will McGinnis. See these posts for deeper coverage:
npx claudepluginhub wdm0006/python-skills --plugin python-library-completeProvides index of 12 principle skills for Python package creation, review, modernization including project structure, pyproject.toml, testing, CI/CD, docs, releases. Use when selecting skills or starting projects.
Sets up Python projects with uv for deps/envs, ruff for linting/formatting, ty for types, pytest for testing. Use for new projects, scripts, or migrations from pip/Poetry.
Configures Python projects with modern tooling (uv, ruff, ty). Use when creating projects, writing standalone scripts, or migrating from pip/Poetry/mypy/black.