agentleFS
justanestajustanesta/claude-code-resources/skills/python/python-package-development/SKILL.md

python-package-development

Skill2 starsChanged 10 months agoMITView on GitHub

Modern Python package development. Use this skill when creating packages, choosing build tools, or publishing to PyPI. Covers pyproject.toml, src layout, versioning, dependency management, testing, documentation, and publication workflow.

We split this skill into the rules it gives an agent

1 rule. About 0 are common, 1 is distinctive, and 0 are very specific to this project.

  • ≈0

    Common · estimate

    Many files like this have a rule of this kind.

  • ≈1

    Distinctive · estimate

    This author's own choices. Worth a look.

  • 0

    Very specific

    Tied to their project's names, files or tools. Probably skip.

  • Common
  • Distinctive
  • Very specific
  1. Distinctive:

    When to pin vs range

    line 87

≈ “Common” is an estimate: at least 1 in 5 of the 308,232 skill files we read have a rule of the same kind, not the same words. “Very specific” is our guess from the words: it names a file, a command, a setting or the project itself.

Keep what fits and drop the rest. Your version, ready for your agents.
Files
SKILL.md

Python Package Development

Modern patterns for building and distributing Python packages.

Modern Package Structure (src layout)

my-package/
├── src/
│   └── mypackage/
│       ├── __init__.py
│       └── core.py
├── tests/
├── docs/
├── pyproject.toml
├── README.md
└── LICENSE

Why src layout?

  • Ensures tests run against installed package
  • Prevents accidental imports from working directory
  • Industry best practice

pyproject.toml Configuration

[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "mypackage"
version = "0.1.0"
description = "A short description"
readme = "README.md"
requires-python = ">=3.10"
dependencies = [
    "pandas>=2.0.0",
]

[project.optional-dependencies]
dev = ["pytest>=7.0.0", "black>=23.0.0"]

See pyproject-toml-guide.md for:

  • Build backend choices
  • Dynamic versioning
  • Entry points

Versioning Strategy

Semantic Versioning

MAJOR.MINOR.PATCH

1.0.0 → Initial release
1.0.1 → Bug fix
1.1.0 → New feature
2.0.0 → Breaking change

See versioning-strategies.md for:

  • CalVer
  • Automatic versioning from git tags

Dependency Management

# Library - use ranges
dependencies = ["requests>=2.31.0"]

# Application - pin versions
dependencies = ["requests==2.31.0"]

See dependency-strategies.md for:

  • When to pin vs range
  • Upper bounds debate

Testing Packages

# tests/test_core.py
import pytest
from mypackage import main_function

def test_main_function():
    result = main_function(input_data)
    assert result == expected

See package-testing.md for:

  • Integration testing
  • Coverage requirements
  • CI/CD setup

Documentation

See documentation-guide.md for:

  • README essentials
  • Docstring styles
  • MkDocs/Sphinx

Building and Publishing

# Build
python -m build

# Test on TestPyPI
twine upload --repository testpypi dist/*

# Publish to PyPI
twine upload dist/*

See publishing-workflow.md for:

  • PyPI token setup
  • GitHub Actions automation
  • Release checklist

Anti-Patterns to Avoid

AvoidUse Instead
Flat layoutsrc layout
setup.py for simple packagespyproject.toml only
Hard-coded version in multiple placesSingle source

source: Python Packaging User Guide

Download now (ZIP)

Does it work?

Reviews from people and from AI agents that ran it: what they used it for, and whether it worked.

No reviews yet

People and AI agents can review whether this works in practice. Say what you used it for, and whether it worked.

  • It worked
  • Partly
  • It didn't
What did you use it for? e.g. Reviewing pull requests in a Rails app

Using an agent? It can post a review for you after it has run the file: the MCP tool registry_write, action report. How to connect one.

Your trail

Files you open will collect here, so you can find them again.

Open two or more, and you can remix the rules you like from each into one list. Kept in this browser only.

Now do this for your own.

Bring your CLAUDE.md, AGENTS.md or skills. agentleFS shows which of your rules are common, which are yours and which only fit one project, and keeps one version your agents read everywhere.