
Python Packaging
Wire GitHub Actions with uv to test, lint, type-check, build, and publish Python packages to PyPI on release.
Install
npx skills add https://github.com/athola/claude-night-market --skill python-packagingWhat is this skill?
- Copy-paste publish workflow on `release: published` with `uv build` and `uv publish`
- Matrix test job across Python 3.9–3.12 using `astral-sh/setup-uv`
- Combined CI pipeline: pytest with coverage, Ruff, and mypy on push/PR
- Child module of python-packaging focused on GitHub Actions only
- Secrets pattern via `UV_PUBLISH_TOKEN` / `PYPI_TOKEN`
Adoption & trust: 1 installs on skills.sh; 304 GitHub stars; 3/3 security scanners passed (skills.sh audits); trending (+100% hot-view momentum).
Recommended Skills
Azure Kubernetesmicrosoft/azure-skills
Github Actions Docsxixu-me/skills
Deploy To Vercelvercel-labs/agent-skills
Vercel Cli With Tokensvercel-labs/agent-skills
Turborepovercel/turborepo
Docker Expertsickn33/antigravity-awesome-skills
Journey fit
Primary fit
Publishing and release automation is the canonical ship moment for a packaged library, even though workflows are authored during build. Launch under ship covers tagged releases, PyPI publish, and CI gates that must pass before artifacts go public.
Common Questions / FAQ
Is Python Packaging safe to install?
skills.sh reports 3 of 3 security scanners passed. Review the Security Audits panel on this page before installing in production.
SKILL.md
READMESKILL.md - Python Packaging
# CI/CD Integration Automated testing, building, and publishing workflows. ## GitHub Actions Publishing ```yaml # .github/workflows/publish.yml name: Publish on: release: types: [published] jobs: publish: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v4 - run: uv build - run: uv publish env: UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} ``` ## Testing Workflow ```yaml # .github/workflows/test.yml name: Test on: [push, pull_request] jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v4 - run: uv sync --all-extras - run: uv run pytest ``` ## Complete CI/CD Pipeline ```yaml # .github/workflows/ci.yml name: CI on: push: branches: [main] pull_request: branches: [main] release: types: [published] jobs: test: runs-on: ubuntu-latest strategy: matrix: python-version: ["3.9", "3.10", "3.11", "3.12"] steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v4 - run: uv sync --all-extras - run: uv run pytest --cov - run: uv run ruff check - run: uv run mypy src publish: if: github.event_name == 'release' needs: test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - uses: astral-sh/setup-uv@v4 - run: uv build - run: uv publish env: UV_PUBLISH_TOKEN: ${{ secrets.PYPI_TOKEN }} ``` ## Best Practices 1. **Test before publish** - Always run tests in CI before publishing 2. **Matrix testing** - Test on multiple Python versions 3. **Use trusted actions** - Official actions from astral-sh, actions org 4. **Secure tokens** - Store PyPI tokens as GitHub secrets 5. **Version tags** - Trigger releases from git tags 6. **Test on TestPyPI** - Verify packages before production publish --- name: entry-points description: Console scripts, GUI scripts, and plugin entry points configuration parent_skill: python-packaging estimated_tokens: 180 dependencies: [] --- # Entry Points Configure console scripts, GUI applications, and plugin systems. ## Console Scripts ```toml [project.scripts] my-cli = "my_package.cli:main" my-other-cmd = "my_package.other:run" ``` ```python # src/my_package/cli.py import click @click.command() @click.option("--name", default="World") def main(name: str): click.echo(f"Hello, {name}!") if __name__ == "__main__": main() ``` ## GUI Scripts ```toml [project.gui-scripts] my-gui = "my_package.gui:main" ``` GUI scripts are similar to console scripts but on Windows they don't open a console window. ## Plugin Entry Points ```toml [project.entry-points."myapp.plugins"] plugin1 = "my_package.plugins:Plugin1" plugin2 = "my_package.plugins:Plugin2" ``` ```python # src/my_package/plugins.py class Plugin1: def activate(self): print("Plugin 1 activated") class Plugin2: def activate(self): print("Plugin 2 activated") ``` ### Discovering Plugins ```python # Application code to discover plugins from importlib.metadata import entry_points def load_plugins(): plugins = entry_points(group="myapp.plugins") for plugin in plugins: plugin_class = plugin.load() instance = plugin_class() instance.activate() ``` ## Best Practices 1. **Keep entry points simple** - Minimal logic in entry point functions 2. **Use click/argparse** - Proper argument parsing for CLI tools 3. **Handle errors gracefully** - Exit codes and error messages 4. **Support --help** - Document all CLI options 5. **Test entry points** - Verify they work when installed --- name: pyproject-patterns description: pyp