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
- Distinctive: line 87
When to pin vs range
≈ “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.
Files
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
└── LICENSEWhy 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 changeSee 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 == expectedSee 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
| Avoid | Use Instead |
| Flat layout | src layout |
| setup.py for simple packages | pyproject.toml only |
| Hard-coded version in multiple places | Single source |
source: Python Packaging User Guide
In this repository38 other files it gives its agents.
- Data Engineering Cloud InfrastructureSkill
- data-eng-data-qualitySkill
- data-eng-streaming-patternsSkill
- data-eng-testing-patternsSkill
- data-eng-warehouse-patternsSkill
- DevOps CI/CD PatternsSkill
- devops-docker-patternsSkill
- devops-monitoring-observabilitySkill
- devops-terraform-patternsSkill
- git-advanced-operationsSkill
- git-workflow-patternsSkill
- modern-python-patternsSkill
- python-api-developmentSkill
- python-async-patternsSkill
- python-data-pipelinesSkill
- python-data-wranglingSkill
- python-devops-automationSkill
- python-error-handlingSkill
- python-performanceSkill
- python-testingSkill
- customizing-vectors-rSkill
- designing-oop-rSkill
- developing-packages-rSkill
- metaprogramming-rlangSkill
- optimizing-rSkill
- writing-tidyverse-rSkill
- sql-advanced-featuresSkill
- sql-analytics-patternsSkill
- sql-data-modelingSkill
- SQL Integration PatternsSkill
- sql-query-fundamentalsSkill
- sql-query-optimizationSkill
- sql-transformationsSkill
- API DesignSkill
- webdev-html-css-patternsSkill
- webdev-javascript-fundamentalsSkill
- webdev-react-patternsSkill
- webdev-typescript-patternsSkill
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
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.

