Skip to content

PhoPersonalOrg/uv-launcher

Repository files navigation

uv-launcher

Auto-discover scripts from pyproject.toml and generate platform-specific launcher scripts that use uv run internally.

Installation

Install globally as a UV tool:

uv tool install uv-launcher

Or install from source:

uv sync --all-extras

Usage

List Discovered Scripts

List all scripts found in pyproject.toml:

uv-launcher list

List scripts from a specific project directory:

uv-launcher list --path /path/to/project

Generate Launcher Scripts

Generate platform-specific launcher scripts in a scripts/ directory:

uv-launcher generate

Generate launchers for a specific project:

uv-launcher generate --path /path/to/project

How It Works

  1. Discovery: The tool reads [project.scripts] from pyproject.toml in the current directory (or specified path).

  2. Platform Detection: Automatically detects your platform:

    • Unix/macOS: Generates .sh shell scripts
    • Windows: Generates both .bat batch files and .ps1 PowerShell scripts
  3. Launcher Generation: Creates launcher scripts in a scripts/ directory that:

    • Change to the project root directory
    • Execute the script using uv run <entry_point>
    • Pass through command-line arguments

Example

Given a pyproject.toml with:

[project.scripts]
my-script = "mymodule:main"
another-script = "scripts.run:main"

Running uv-launcher generate will create:

On Unix/macOS:

  • scripts/my-script.sh
  • scripts/another-script.sh

On Windows:

  • scripts/my-script.bat and scripts/my-script.ps1
  • scripts/another-script.bat and scripts/another-script.ps1

You can then run your scripts directly:

# Unix/macOS
./scripts/my-script.sh

# Windows
scripts\my-script.bat
# or
powershell scripts\my-script.ps1

Features

  • ✅ Auto-discovers scripts from [project.scripts] in pyproject.toml
  • ✅ Supports nested script paths (e.g., scripts.run:main)
  • ✅ Cross-platform launcher generation (.sh, .bat, .ps1)
  • ✅ Uses uv run internally for consistent execution
  • ✅ Automatically makes Unix scripts executable
  • ✅ Overwrites existing scripts (no prompts)

Requirements

Test Scripts


uv-launcher generate --path "C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\stream_viewer"
"C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\continuous_video_recorder"
"C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\emotiv-lsl"
"C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\lab-recorder-python"
"C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\PhoLogToLabStreamingLayer"
uv-launcher generate --path "C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\python_xdf_streamer"


uv-launcher generate --path "C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\emotiv-lsl"
uv-launcher generate --path "C:\Users\pho\repos\EmotivEpoc\ACTIVE_DEV\emotiv-lsl"


About

UV tool called `uv-launcher` that builds launchers from `uv-scripts`

Topics

Resources

Stars

Watchers

Forks

Contributors

Languages