Files
dotfiles/.config/opencode/skills/python-development/SKILL.md
alex wiesner cb208a73c4 changes
2026-03-13 13:28:20 +00:00

1.9 KiB

name, description, permalink
name description permalink
python-development Python ecosystem defaults and workflows using uv for packaging and ruff for linting/formatting opencode-config/skills/python-development/skill

Python Development

Load this skill when a repo or lane involves Python code (presence of pyproject.toml, setup.py, requirements*.txt, or .py files as primary source).

Defaults

Concern Tool Notes
Package/venv management uv Replaces pip, pip-tools, and virtualenv
Linting + formatting ruff Replaces flake8, isort, black
Test runner pytest Unless repo already uses another runner
Type checking pyright or mypy Use whichever the repo already configures

Core Workflow

  1. Bootstrapuv sync (or uv pip install -e ".[dev]") to create/refresh the venv.
  2. Lintruff check . then ruff format --check . before committing.
  3. Testpytest with the repo's existing config. Follow TDD default policy.
  4. Add dependenciesuv add <pkg> (runtime) or uv add --dev <pkg> (dev). Do not edit pyproject.toml dependency arrays by hand.
  5. Lockuv lock after dependency changes.

Conventions

  • Prefer pyproject.toml over setup.py/setup.cfg for new projects.
  • Keep ruff config in pyproject.toml under [tool.ruff].
  • Use uv run <cmd> to execute tools inside the managed venv without activating it.
  • Pin Python version via .python-version or pyproject.toml requires-python.

Docker Integration

When the repo runs Python inside Docker, install dependencies with uv pip install inside the container. Mount a named volume for the uv cache to speed up rebuilds.

Red Flags

  • Using pip install directly instead of uv.
  • Running black or isort when ruff is configured.
  • Missing uv.lock after dependency changes.
  • Editing dependency arrays in pyproject.toml by hand instead of using uv add.