py-packaging

Installation
SKILL.md

Python 打包、依賴與發布

目標與邊界

用此 skill 建立可重現、可在乾淨環境安裝、具有正確 metadata 與安全發布流程的 Python 專案。

pyproject.toml 是多種工具共用的設定入口,但不是所有專案唯一會存在的設定檔。不要宣稱 uv、Ruff 或單一 backend「完全取代」所有工具;依專案需求選擇。

執行流程

  1. 分類專案:應用程式、可發布 library、CLI、plugin、native extension 或 workspace。
  2. 盤點現況:setup.py、setup.cfg、pyproject.toml、requirements、lockfile、CI 與發布方式。
  3. 決定相容契約:distribution name、import package、最低 Python、平台、ABI、公開 entry points 與 semantic versioning。
  4. 選擇 backend 與 layout:保留既有可用 backend;新專案依需求選 setuptools、Hatchling、Flit、PDM backend、maturin 等。
  5. 分離 runtime 與 development dependencies:runtime 放 [project.dependencies],開發工具使用 dependency groups 或專案既有機制。
  6. 建立 lock/reproducibility 策略:應用與部署環境鎖定完整解析;library metadata 保留合理相容範圍。
  7. 建置與安裝驗證:在乾淨環境測 sdist、wheel、metadata、entry point 與缺漏資源。
  8. 安全發布:優先 OIDC Trusted Publishing、受保護 environment、不可變 tag 與 provenance。
  9. 記錄遷移與回復:列出舊安裝方式、破壞性 metadata 變更與 rollback。
Installs
2
GitHub Stars
1
First Seen
May 8, 2026