python-scripting

89jobrien's avatarfrom 89jobrien

Python scripting with uv and PEP 723 inline dependencies. Use when creating standalone Python scripts with automatic dependency management.

⭐1stars🔀0forks📁View on GitHub🕐Updated Dec 29, 2025

When & Why to Use This Skill

This Claude skill streamlines the creation of standalone Python scripts by leveraging the modern `uv` package manager and PEP 723 inline dependency metadata. It automates environment setup and dependency management, allowing developers to generate portable, self-contained, and reproducible scripts for automation, data processing, and CLI utilities without the manual overhead of virtual environment configuration.

Use Cases

  • One-off Automation Tasks: Rapidly generate scripts for web scraping, file system cleanup, or data conversion that automatically handle their own library requirements.
  • Portable CLI Tool Development: Create robust command-line utilities with built-in argument parsing and version-locked dependencies for consistent execution across different machines.
  • DevOps and System Scripting: Build reproducible maintenance scripts that use PEP 723 to ensure the exact same environment is used every time the script runs.
  • Rapid Prototyping: Quickly test Python logic or third-party libraries in a clean, isolated environment without the friction of manual project initialization.
namepython-scripting
descriptionPython scripting with uv and PEP 723 inline dependencies. Use when creating
authorJoseph OBrien
statusunpublished
updated'2025-12-23'
version1.0.1
tagskill
typeskill

Python Scripting Skill

Creates self-contained Python scripts using uv and PEP 723 inline script metadata.

What This Skill Does

  • Creates standalone Python scripts
  • Uses PEP 723 inline dependencies
  • Sets up argument parsing
  • Handles input/output
  • Configures reproducible builds

When to Use

  • Standalone utility scripts
  • One-off automation tasks
  • Quick data processing
  • CLI tools
  • Scripts that need dependencies

Reference Files

  • references/UV_SCRIPT.template.py - Python script template with PEP 723 metadata

PEP 723 Format

#!/usr/bin/env -S uv run --script
# /// script
# requires-python = ">=3.12"
# dependencies = [
#   "requests",
#   "rich",
# ]
# ///

Running Scripts

uv run script.py [args]

Dependencies install automatically on first run.

Best Practices

  • Use exclude-newer for reproducibility
  • Include docstring with usage examples
  • Use argparse for CLI arguments
  • Return exit codes (0 success, non-zero error)
  • Keep scripts focused on one task