Aller au contenu
Skillpedia
API et serveurs (backend)40k · #7352

python-pypi-package-builder

Ce qu’il fait

Ce guide vous aide à créer, tester et publier des bibliothèques Python sur PyPI (la « marketplace » des paquets Python). Il couvre toutes les étapes, de l'organisation du code à la version finale, pour que votre paquet fonctionne bien et soit facile à utiliser par d'autres développeurs.

Quand l’utiliser

  • ✓Lorsque vous voulez créer votre première bibliothèque Python à partager.
  • ✓Lorsque vous devez publier un paquet Python sur PyPI.
  • ✓Pour organiser et tester un projet Python existant.

Lien du skill

https://github.com/github/awesome-copilot/blob/main/skills/python-pypi-package-builder/SKILL.md

Copiez-le et collez-le dans votre IA (Claude, ChatGPT ou Cursor) en lui demandant de suivre les instructions.

Comment l’utiliser

Le plus simple : copiez le message et collez-le dans votre IA. Elle lit le skill et suit les instructions.

Message prêt à coller

Utilise ce skill pour m’aider : https://github.com/github/awesome-copilot/blob/main/skills/python-pypi-package-builder/SKILL.md Lis le fichier SKILL.md de ce lien et suis ses instructions pour ma tâche.
Envie que votre IA trouve seule des skills comme celui-ci ?Installez le MCP gratuit de Skillpedia : une ligne, et elle cherche parmi 15 000+ skills avant chaque tâche.Installer en 1 minute →

Exemple de demande à votre IA

“Comment créer et publier une bibliothèque Python nommée « my_utility » ?”

5 nouveaux skills par semaine. 1 minute de lecture.

Comment ça marche

Le guide vous aide à choisir la meilleure façon d'organiser votre code, ainsi que les outils adaptés pour construire, tester et publier votre paquet. Il explique aussi comment gérer les versions de votre paquet et utiliser des fonctionnalités modernes comme les « type hints » (indications de type).

Contenu technique (SKILL.md original)

Texte original de l’auteur, en anglais, directement depuis GitHub.

Python PyPI Package Builder Skill

A complete, battle-tested guide for building, testing, linting, versioning, typing, and publishing a production-grade Python library to PyPI — from first commit to community-ready release.

AI Agent Instruction: Read this entire file before writing a single line of code or creating any file. Every decision — layout, backend, versioning strategy, patterns, CI — has a decision rule here. Follow the decision trees in order. This skill applies to any Python package type (utility, SDK, CLI, plugin, data library). Do not skip sections.


Quick Navigation

Section in this file What it covers
1. Skill Trigger When to load this skill
2. Package Type Decision Identify what you are building
3. Folder Structure Decision src/ vs flat vs monorepo
4. Build Backend Decision setuptools / hatchling / flit / poetry
5. PyPA Packaging Flow The canonical publish pipeline
6. Project Structure Templates Full layouts for every option
7. Versioning Strategy PEP 440, semver, dynamic vs static
Reference file What it covers
references/pyproject-toml.md All four backend templates, setuptools_scm, py.typed, tool configs
references/library-patterns.md OOP/SOLID, type hints, core class design, factory, protocols, CLI
references/testing-quality.md conftest.py, unit/backend/async tests, ruff/mypy/pre-commit
references/ci-publishing.md ci.yml, publish.yml, Trusted Publishing, TestPyPI, CHANGELOG, release checklist
references/community-docs.md README, docstrings, CONTRIBUTING, SECURITY, anti-patterns, master checklist
references/architecture-patterns.md Backend system (plugin/strategy), config layer, transport layer, CLI, backend injection
references/versioning-strategy.md PEP 440, SemVer, pre-release, setuptools_scm deep-dive, flit static, decision engine
references/release-governance.md Branch strategy, branch protection, OIDC, tag author validation, prevent invalid tags
references/tooling-ruff.md Ruff-only setup (replaces black/isort), mypy config, pre-commit, asyncio_mode=auto

Scaffold script: run python skills/python-pypi-package-builder/scripts/scaffold.py --name your-package-name to generate the entire directory layout, stub files, and pyproject.toml in one command.


1. Skill Trigger

Load this skill whenever the user wants to:

  • Create, scaffold, or publish a Python package or library to PyPI
  • Build a pip-installable SDK, utility, CLI tool, or framework extension
  • Set up pyproject.toml, linting, mypy, pre-commit, or GitHub Actions for a Python project
  • Understand versioning (setuptools_scm, PEP 440, semver, static versioning)
  • Understand PyPA specs: py.typed, MANIFEST.in, RECORD, classifiers
  • Publish to PyPI using Trusted Publishing (OIDC) or API tokens
  • Refactor an existing package to follow modern Python packaging standards
  • Add type hints, protocols, ABCs, or dataclasses to a Python library
  • Apply OOP/SOLID design patterns to a Python package
  • Choose between build backends (setuptools, hatchling, flit, poetry)

Also trigger for phrases like: "build a Python SDK", "publish my library", "set up PyPI CI", "create a pip package", "how do I publish to PyPI", "pyproject.toml help", "PEP 561 typed", "setuptools_scm version", "semver Python", "PEP 440", "git tag release", "Trusted Publishing".


2. Package Type Decision

Identify what the user is building before writing any code. Each type has distinct patterns.

Decision Table

Type Core Pattern Entry Point Key Deps Example Packages
Utility library Module of pure functions + helpers Import API only Minimal arrow, humanize, boltons, more-itertools
API client / SDK Class with methods, auth, retry logic Import API only httpx or requests boto3, stripe-python, openai
CLI tool Command functions + argument parser [project.scripts] or [project.entry-points] click or typer black, ruff, httpie, rich

…

Questions fréquentes

Qu'est-ce que PyPI ?

PyPI signifie Python Package Index. C'est un dépôt en ligne où les développeurs Python publient et partagent des bibliothèques (paquets) que d'autres peuvent installer et utiliser dans leurs projets.

Qu'est-ce que les « build backends » (setuptools, hatchling, flit, poetry) ?

Ce sont différents outils que Python utilise pour empaqueter votre code, en le transformant dans un format qui peut être installé avec pip et publié sur PyPI. Chacun a ses avantages.

Qu'est-ce que les « type hints » ?

Les « type hints » sont des annotations que vous ajoutez à votre code Python pour indiquer le type de données qu'une variable ou une fonction attend ou renvoie. Cela aide à repérer les erreurs plus tôt et rend le code plus facile à comprendre.

Détails

Description originale de l’auteur

End-to-end skill for building, testing, linting, versioning, and publishing a production-grade Python library to PyPI. Covers all four build backends (setuptools+setuptools_scm, hatchling, flit, poetry), PEP 440 versioning, semantic versioning, dynamic git-tag versioning, OOP/SOLID design, type hints (PEP 484/526/544/561), Trusted Publishing (OIDC), and the full PyPA packaging flow. Use for: creat

repo: github/awesome-copilot

Popularité

Étoiles GitHub
40k
Position au classement
#7352
Licence
MIT
Mis à jour
15/10/2026

Ce skill vous est-il utile ?

0

Connectez-vous pour voter.

Commentaires

  • …

Autres skills de ce dépôt

Skills similaires