Xpersona
P

python-packaging

CLAWHUB · Unverified

Python package creation and PyPI distribution via pyproject.toml and entry points Skill: python-packaging Owner: athola Summary: Python package creation and PyPI distribution via pyproject.toml and entry points Tags: latest:1.9.19 Version history: v1.9.19 | 2026-08-26T13:17:55.161Z | user Release v1.9.19 v1.9.17 | 2026-07-30T05:38:14.377Z | user Release v1.9.17 v1.9.16 | 2026-07-14T19:54:57.384Z | user Release v1.9.16 v1.9.14 | 2026-06-30T18:03:26.118Z | user Release v1.9.14 v1.9.13 | 2026-06-27T1

62
Rank
84
Safety
1.7k
Downloads

About

What it does, and when to use it.

Capability contract not published. No trust telemetry is available yet. 1.7K downloads reported by the source. Last updated 10/10/2026.

Avoid when

  • Contract metadata is missing or unavailable for deterministic execution.

Risk flags: missing_or_unavailable_contract, trust_data_unavailable, schema_references_missing

Install and run

Setup complexity: low.

clawhub skill install s17emme0e2m3cpf7k2jvp3a84984b8z9:nm-parseltongue-python-packaging
  1. Setup complexity is classified as HIGH. You must provision dedicated cloud infrastructure or an isolated VM. Do not run this directly on your local workstation.
  2. Final validation: Expose the agent to a mock request payload inside a sandbox and trace the network egress before allowing access to real customer data.

Contract: missing

curl -s "https://www.xpersona.co/api/v1/agents/clawhub-athola-nm-parseltongue-python-packaging/snapshot"

Run-check

$0.02 USD

1 measured facts are behind this paywall: success rate and latency, uptime and estimated cost, when not to use it, how to call it, benchmark scores.

Agents pay $0.02 in USDC. A card payment is $0.50, the smallest a card allows.

Documentation

CLAWHUB

146,152 characters of source documentation, loaded on request.

Extracted files

5 files captured from the source.

SKILL.md

---
name: python-packaging
description: |
  Python package creation and PyPI distribution via pyproject.toml and entry points
version: 1.9.8
triggers:
  - python
  - packaging
  - pyproject.toml
  - uv
  - pip
  - pypi
  - distribution
  - publishing a package or setting up build configuration
metadata: {"openclaw": {"homepage": "https://github.com/athola/claude-night-market/tree/master/plugins/parseltongue", "emoji": "\ud83e\udd9e"}}
source: claude-night-market
source_plugin: parseltongue
---

> **Night Market Skill** — ported from [claude-night-market/parseltongue](https://github.com/athola/claude-night-market/tree/master/plugins/parseltongue). For the full experience with agents, hooks, and commands, install the Claude Code plugin.


## Table of Contents

- [Quick Start](#quick-start)
- [When to Use](#when-to-use)
- [Core Decisions](#core-decisions)
- [1. Layout Choice](#1-layout-choice)
- [2. Project Structure](#2-project-structure)
- [Detailed Topics](#detailed-topics)
- [Best Practices](#best-practices)
- [Exit Criteria](#exit-criteria)


# Python Packaging

Modern Python packaging with pyproject.toml, uv, and best practices for distribution.

## Quick Start

```bash
# Create new project with uv
uv init my-package
cd my-package

# Add dependencies
uv add requests click

# Build package
uv build

# Publish to PyPI
uv publish
```
**Verification:** Run the command with `--help` flag to verify availability.

## When To Use

- Creating distributable Python libraries
- Building CLI tools
- Publishing to PyPI
- Setting up development environments
- Managing project dependencies

## When NOT To Use

- Testing packages - use python-testing
  instead
- Optimizing package performance - use python-performance
- Testing packages - use python-testing
  instead
- Optimizing package performance - use python-performance

## Core Decisions

### 1. Layout Choice

```yaml
# Source layout (recommended)
src/my_package/
    __init__.py
    module.py

# Flat layout (simple)
my_package/
    __init__.py
    module.py
```
**Verification:** Run the command with `--help` flag to verify availability.

**Source layout benefits:**
- Clear separation of source and tests
- Prevents accidental imports of uninstalled code
- Better for packages with complex structure

### 2. Project Structure

**Minimal Project:**
```
**Verification:** Run `pytest -v` to verify tests pass.
my-project/
├── pyproject.toml
├── README.md
├── src/
│   └── my_package/
│       └── __init__.py
└── tests/
    └── test_init.py
```
**Verification:** Run `pytest -v` to verify tests pass.

**Complete Project:**
```
**Verification:** Run the command with `--help` flag to verify availability.
my-project/
├── pyproject.toml
├── README.md
├── LICENSE
├── .gitignore
├── src/
│   └── my_package/
│       ├── __init__.py
│       ├── cli.py
│       ├── core.py
│       └── utils.py
├── tests/
│   ├── conftest.py
│   └── test_core.py
└── docs/
    └── index.md
```
**Verification:** Run `pytest -v` to verify tests pas

_meta.json

{
  "ownerId": "kn7d107jg9jv602h9ytsegydq184a42s",
  "slug": "nm-parseltongue-python-packaging",
  "version": "1.9.19",
  "publishedAt": 1787750275161
}

modules/ci-cd-integration.md

---
name: ci-cd-integration
description: GitHub Actions workflows and automated publishing pipelines
parent_skill: python-packaging
estimated_tokens: 150
dependencies: []
---

# 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

modules/entry-points.md

---
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

modules/pyproject-patterns.md

---
name: pyproject-patterns
description: pyproject.toml configuration patterns and examples for different package types
parent_skill: python-packaging
estimated_tokens: 350
dependencies: []
---

# pyproject.toml Patterns

Configuration patterns for different Python package types.

## Build Backend Choice

```toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"
```

**Options:**
- **hatchling**: Modern, fast, minimal config
- **setuptools**: Traditional, widely supported
- **flit**: Simple, pure Python packages
- **poetry-core**: Poetry ecosystem integration

## Package Type Matrix

| Type | Layout | Backend | Use Case |
|------|--------|---------|----------|
| Simple Library | Flat | flit | Pure Python, few deps |
| Complex Library | Source | hatchling | Mixed deps, tests |
| CLI Tool | Source | hatchling | Entry points needed |
| Data Science | Source | setuptools | Heavy deps, compiled |

## Simple Package

```toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-package"
version = "0.1.0"
description = "A simple Python package"
readme = "README.md"
requires-python = ">=3.9"
license = "MIT"
authors = [
    { name = "Your Name", email = "you@example.com" }
]
dependencies = [
    "requests>=2.0.0",
]
```

## CLI Package

```toml
[build-system]
requires = ["hatchling"]
build-backend = "hatchling.build"

[project]
name = "my-cli"
version = "0.1.0"
description = "A CLI tool"
requires-python = ">=3.9"
dependencies = [
    "click>=8.0.0",
    "rich>=13.0.0",
]

[project.scripts]
my-cli = "my_cli.main:cli"
```

## Development Package

```toml
[project]
name = "my-package"
version = "0.1.0"
dependencies = ["requests>=2.0.0"]

[project.optional-dependencies]
dev = [
    "pytest>=7.0.0",
    "pytest-cov>=4.0.0",
    "ruff>=0.1.0",
    "mypy>=1.0.0",
]
docs = [
    "mkdocs>=1.5.0",
    "mkdocs-material>=9.0.0",
]

[tool.pytest.ini_options]
testpaths = ["tests"]
addopts = ["-v", "--cov=src"]

[tool.ruff]
line-length = 100
target-version = "py39"

[tool.mypy]
python_version = "3.9"
strict = true
```

## Advanced Patterns

### Namespace Packages
```toml
[project]
name = "mycompany-core"

[tool.hatch.build.targets.wheel]
packages = ["src/mycompany"]
```

### Conditional Dependencies
```toml
[project]
dependencies = [
    "requests>=2.0.0",
    "typing-extensions>=4.0; python_version < '3.11'",
]

[project.optional-dependencies]
gpu = ["torch", "cuda-python"]
cpu = ["numpy", "scipy"]
```

### Dynamic Version
```toml
[project]
dynamic = ["version"]

[tool.hatch.version]
path = "src/my_package/__init__.py"
```

```python
# src/my_package/__init__.py
__version__ = "0.1.0"
```

## Anti-Patterns to Avoid

```python
# Don't: Complex setup.py with file reading
setup(
    version=open("version.txt").read(),
    install_requires=open("requirements.txt").readlines(),
)

# Do: Simple pyproject.toml
[project]
version = "0.1.0"
dependencies = ["requests>=2.0.0"]
```

Sponsored

Ads related to python-packaging and adjacent AI workflows.