mcpField
P
python-package

python-package

github.com/gkwaDevelopment091 installsUpdated 5d ago
Repository

About python-package

A scaffold skill for developers starting a Python package. It provides baseline project files and guidance for linting, formatting, and exposing the package version through `--version`.

Key features

  1. 01Starter `src` package structure
  2. 02`.python-version` and `pyproject.toml` templates
  3. 03Ruff lint and format guidance
  4. 04Formatting verification command
  5. 05Version flag using `importlib.metadata`

Use cases

  1. 01Starting a new Python package
  2. 02Setting up initial project metadata
  3. 03Checking Python code style before commits

Install

Copy the command and run it in a terminal.

$npx skills add https://github.com/gkwa/volcanicviper --skill python-package

After installing, type/python-packagein Claude Code to confirm it loaded.

Bundled filestile.json

Details

From the project README

Python Package Scaffold

Use this structure as the starting point for a new Python package. Update the description, dependencies, and dev dependencies based on context.

src/<package>/__init__.py:

def main() -> None:
    print("Hello from <package>!")

.python-version:

3.13

pyproject.toml:

[project]
name = "<package>"
version = "0.1.0"
description = "Add your description here"
readme = "README.md"
authors = [
    { name = "Author Name", email = "[email protected]" }
]
requires-python = ">=3.13"
dependencies = []

[project.scripts]
<package> = "<package>:main"

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

[tool.ruff]
preview = true

[tool.ruff.lint]
select = ["F", "E", "W"]
extend-select = ["I"]
extend-safe-fixes = ["F401", "F841"]

Lint and Format

Run both ruff checks before the first commit and again after every later edit to a Python file.

ruff check and ruff format are separate tools, and a project can pass one while failing the other.

uv tool run ruff check /absolute/path/to/<package>
uv tool run ruff format /absolute/path/to/<package>

Confirm with uv tool run ruff format --check /absolute/path/to/<package>, which exits 1 when any file would change.

Run each as its own Bash call.

Show Version

Support --version using importlib.metadata so the version is not duplicated:

import argparse
import importlib.metadata

parser = argparse.ArgumentParser(description="...")
parser.add_argument(
    "--version",
    action="version",
    version=f"%(prog)s {importlib.metadata.version('<package>')}"
)

Comments

Markdown supported