Skip to content

Commit 52037f9

Browse files
tenpercentclaude
andcommitted
Auto-install uv for zero-configuration dependency management
- Automatically install uv if not found in container - Eliminates manual dependency setup - No fallback to python3 + manual jinja2 installation needed - First run installs uv (~5 seconds), subsequent runs use cached version - Update documentation to reflect automatic installation Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 13655f2 commit 52037f9

2 files changed

Lines changed: 23 additions & 43 deletions

File tree

.claude/skills/ck-build-analysis

Lines changed: 15 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -166,29 +166,23 @@ echo "Generating analysis report..."
166166
docker cp "${SCRIPT_DIR}/analyze_build_trace.py" "${CONTAINER_NAME}:/tmp/analyze_build_trace.py"
167167
docker cp "${SCRIPT_DIR}/templates" "${CONTAINER_NAME}:/tmp/ck_build_analysis_templates"
168168

169-
# Check if uv is available and use it for PEP 723 dependency management
170-
# Check both PATH and common install locations
171-
if docker exec "${CONTAINER_NAME}" bash -c "command -v uv >/dev/null 2>&1 || test -x \$HOME/.local/bin/uv"; then
172-
echo "Using uv run for automatic dependency management..."
173-
# Ensure uv is in PATH (handles ~/.local/bin installation)
174-
docker exec "${CONTAINER_NAME}" bash -c "export PATH=\"\$HOME/.local/bin:\$PATH\" && uv run --no-project /tmp/analyze_build_trace.py \
175-
${TRACE_FILE} \
176-
/workspace/${OUTPUT_FILE} \
177-
${TARGET} \
178-
${GRANULARITY} \
179-
${BUILD_TIME} \
180-
/tmp/ck_build_analysis_templates"
181-
else
182-
echo "uv not found, using python3 (requires python3-jinja2 pre-installed)..."
183-
docker exec "${CONTAINER_NAME}" python3 /tmp/analyze_build_trace.py \
184-
"${TRACE_FILE}" \
185-
"/workspace/${OUTPUT_FILE}" \
186-
"${TARGET}" \
187-
"${GRANULARITY}" \
188-
"${BUILD_TIME}" \
189-
"/tmp/ck_build_analysis_templates"
169+
# Check if uv is available, install if needed, and use for PEP 723 dependency management
170+
if ! docker exec "${CONTAINER_NAME}" bash -c "command -v uv >/dev/null 2>&1 || test -x \$HOME/.local/bin/uv"; then
171+
echo "uv not found, installing..."
172+
docker exec "${CONTAINER_NAME}" bash -c "curl -LsSf https://astral.sh/uv/install.sh | sh" >/dev/null 2>&1
173+
echo "uv installed successfully"
190174
fi
191175

176+
echo "Using uv run for automatic dependency management..."
177+
# Ensure uv is in PATH (handles ~/.local/bin installation)
178+
docker exec "${CONTAINER_NAME}" bash -c "export PATH=\"\$HOME/.local/bin:\$PATH\" && uv run --no-project /tmp/analyze_build_trace.py \
179+
${TRACE_FILE} \
180+
/workspace/${OUTPUT_FILE} \
181+
${TARGET} \
182+
${GRANULARITY} \
183+
${BUILD_TIME} \
184+
/tmp/ck_build_analysis_templates"
185+
192186
# Copy report back to host
193187
docker cp "${CONTAINER_NAME}:/workspace/${OUTPUT_FILE}" "${PROJECT_ROOT}/${OUTPUT_FILE}"
194188

.claude/skills/ck-build-analysis.md

Lines changed: 8 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -126,29 +126,18 @@ The analysis script (`analyze_build_trace.py`) is PEP 723 compliant with inline
126126
# ///
127127
```
128128

129-
**The skill automatically uses `uv run` if available**, which provides:
129+
**The skill automatically installs and uses `uv`**, which provides:
130130
- ✅ Zero-configuration dependency management
131131
- ✅ Automatic installation of jinja2 from PEP 723 metadata
132132
- ✅ Isolated dependency environment (no system pollution)
133133
- ✅ Fast caching for subsequent runs
134134

135-
### Installation Options
135+
**No manual setup required!** The first time you run the skill, it will:
136+
1. Detect if `uv` is installed in the container
137+
2. If not, automatically install it (takes ~5 seconds)
138+
3. Use `uv run` to execute the analysis with auto-managed dependencies
136139

137-
**Option 1: Install uv (Recommended)**
138-
```bash
139-
# Install uv in the Docker container (one-time setup)
140-
docker exec ck_<container_name> bash -c "curl -LsSf https://astral.sh/uv/install.sh | sh"
141-
```
142-
143-
After installing `uv`, the skill will automatically use it for dependency management.
144-
145-
**Option 2: Use system python3 + jinja2**
146-
```bash
147-
# If uv is not available, install jinja2 manually
148-
docker exec ck_<container_name> apt-get install -y python3-jinja2
149-
```
150-
151-
The skill automatically detects which method is available and uses the appropriate one.
140+
On subsequent runs, `uv` will already be available and dependencies will be cached.
152141

153142
### Components
154143

@@ -161,12 +150,9 @@ The skill automatically detects which method is available and uses the appropria
161150
The Python script can also be run independently:
162151

163152
```bash
164-
# With uv (recommended - auto-installs dependencies)
153+
# With uv (recommended - auto-installs dependencies from PEP 723 metadata)
165154
uv run .claude/skills/analyze_build_trace.py trace.json report.md target 100 22 templates/
166155

167-
# With pipx (alternative - auto-installs dependencies)
156+
# With pipx (alternative - also auto-installs dependencies)
168157
pipx run .claude/skills/analyze_build_trace.py trace.json report.md target 100 22 templates/
169-
170-
# With python3 (requires jinja2 pre-installed)
171-
python3 .claude/skills/analyze_build_trace.py trace.json report.md target 100 22 templates/
172158
```

0 commit comments

Comments
 (0)