/ceh-python-library:publish-python-libraryfrom ceh-python-library
Load this skill when packaging, versioning, or publishing a Python library: build backend, src/ layout, wheels, PyPI, the public API in __init__.py / __all__, deprecations, semver. Trigger on a build config or __all__ edit, a changed public signature, or a uv build run.
Ships in ceh-python-library. Installing the plugin adds it to Claude Code.
What the skill costs in Claude's context, stage by stage
Name and description: Claude knows it exists.
SKILL.md joins the conversation and stays.
None: SKILL.md is the whole skill.
A library's outward surface is three things that change together: what the package exports, what
version number that earns, and how it is built and uploaded. The public API decides the version,
and the version decides the release. Done when the wheel and sdist build, uvx twine check passes,
and a TestPyPI install imports the public API.
__init__.py / __all__ and decide the semver level the change
earns.src/ layout, a wheel and an sdist, with py.typed.uv build and uvx twine check dist/*, then stop if the Stop conditions say so.The public API is exactly what __init__.py exports — nothing else is a contract.
# src/your_library/__init__.py
from your_library.core import RetryPolicy, parse_duration
__all__ = ["RetryPolicy", "parse_duration"]
__all__ (and any _leading_underscore name) is private — consumers must not rely on it, and you may change it freely.The public API decides the level: a removed or renamed symbol, a changed signature, or changed behavior consumers depend on is MAJOR, a new symbol or optional parameter is MINOR, anything with no public effect is PATCH. When in doubt, bump the higher level. Never re-use or lower a version.
Never remove or change a public symbol without a deprecation period.
import warnings
def old_name(*args, **kwargs):
warnings.warn(
"old_name() is deprecated; use new_name(). Removed in 3.0.",
DeprecationWarning,
stacklevel=2,
)
return new_name(*args, **kwargs)
DeprecationWarning with the replacement and the removal version.Declare an explicit build backend in pyproject.toml. Default to hatchling; uv_build is fine if the project is uv-native.
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
[project]
name = "your-library"
version = "1.2.0"
description = "One-line summary of what the library does."
readme = "README.md"
requires-python = ">=3.12"
license = "MIT"
authors = [{ name = "...", email = "..." }]
dependencies = [] # minimal — every dependency is imposed on consumers
[project.urls]
Homepage = "https://github.com/owner/your-library"
your-library/
├── pyproject.toml
├── README.md
├── src/
│ └── your_library/
│ ├── __init__.py # defines the public API (see Define the public surface above)
│ └── py.typed # ship type information (PEP 561)
└── tests/
The src/ layout prevents accidentally importing the working tree instead of the installed package —
tests run against the built/installed library, catching missing-data and packaging bugs before release.
Always ship py.typed so consumers get your type hints.
uv build # produces dist/*.whl and dist/*.tar.gz (wheel + sdist)
uvx twine check dist/* # validate metadata before upload
uv publish --publish-url https://test.pypi.org/legacy/ # TestPyPI dry run first
uv publish # then the real PyPI
A library must not pull in application/web-server dependencies (fastapi, uvicorn, asyncpg, web
frameworks). If web behavior is needed, expose a clean API and let the consuming application wire the
transport. Optional integrations go under [project.optional-dependencies], never the base set.
Reply with the version and the semver level it earned, the files in dist/, the result of
twine check, and what was published where. When the run stopped before publishing, give the two
uv publish commands for a person to run.
uv build and twine check, before
uv publish to TestPyPI or PyPI, and report. A published version cannot be taken back or
uploaded again.What SKILL.md sets; muted values are Claude Code's defaults
npx claudepluginhub cheneeheng/ceh-claude-code-library --plugin ceh-python-libraryOther plugins' skills for the same job
3 skills in this plugin
/configure-python-library-envLoad this skill when setting up a Python library's environment or code style: uv dependencies, pyproject.toml, type hints, docstrings, naming, ruff/mypy. Trigger on a pyproject.toml edit or a uv command./write-pytest-library-testsLoad this skill when writing pytest tests for a Python library: unit tests, public-API tests, fixtures, and what to mock versus test for real. Trigger on a test file created or modified.