uv-script

Create standalone Python scripts with uv shebang and PEP 723 metadata.

1|Updated Aug 3, 2023
One-click install
npx skills add https://github.com/ebal5/dotfiles-chezmoi --skill uv-script
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: uv-script
Source: https://github.com/ebal5/dotfiles-chezmoi/tree/main/dot_claude/skills/uv-script
Command: npx skills add https://github.com/ebal5/dotfiles-chezmoi --skill uv-script

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve?

Create standalone Python scripts using the uv shebang with PEP 723 inline metadata, enabling dependency management without a full project setup.

Core Features & Use Cases

  • Single-file scripts: Use a uv shebang to run as a standalone script with inline metadata.
  • Inline metadata: Declare dependencies and required Python version in metadata.
  • No project scaffold: Ideal for small utilities and one-off tools.

Quick Start

Create a new file at dot_scripts/executable_<name> following the template, mark it executable, and run it directly after applying chezmoi.

Frequently Asked Questions about uv-script

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I create a standalone Python script without setting up a full project?

Use uv with a shebang and PEP 723 inline metadata. Add `#!/usr/bin/env uv run --script` at the top of your Python file, declare dependencies and Python version in a metadata block, define a main() function, and run the script directly. uv handles dependency installation automatically.

What is PEP 723 inline metadata and how does it work?

PEP 723 inline metadata is a TOML block embedded in Python scripts that declares dependencies and required Python versions without a separate requirements file. uv parses this metadata block to install and manage dependencies when running the script with the uv shebang.

Can I use uv to run single-file Python tools with dependencies?

Yes. Use the uv shebang with inline PEP 723 metadata to declare dependencies directly in your script file. This approach works for CLIs, utilities, and prototypes that need dependency management without a project scaffold.

Do I need to install dependencies separately for uv scripts?

No. uv automatically resolves and installs dependencies declared in the inline metadata block when you run the script with the uv shebang. No separate dependency installation step is required.

What's the correct way to structure a uv script entry point?

Define a main() function that returns an exit code, add the uv shebang at the top, include a PEP 723 metadata block declaring requires-python and dependencies, and follow conventional Python packaging practices for proper error handling.