Skip to content

Commit 568b0bc

Browse files
ryan-williamsclaude
andcommitted
Add deps-extras input for installing pyproject.toml extras groups
Passes through to `uv pip install --system -e '.[extras]'`. Alternative to per-project `requirements.txt` when deps are already declared as optional-dependency groups in `pyproject.toml`. 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 62506bc commit 568b0bc

File tree

2 files changed

+63
-1
lines changed

2 files changed

+63
-1
lines changed

.github/workflows/pulumi.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,10 @@ on:
2525
description: 'Directory containing pyproject.toml or requirements.txt (defaults to working-directory)'
2626
required: false
2727
type: string
28+
deps-extras:
29+
description: 'Comma-separated pyproject.toml extras to install (e.g. "gha,dev")'
30+
required: false
31+
type: string
2832
python-version:
2933
description: 'Python version to use'
3034
required: false
@@ -102,11 +106,16 @@ jobs:
102106
- name: Install dependencies
103107
env:
104108
DEPS_DIR: ${{ inputs.deps-directory || inputs.working-directory }}
109+
DEPS_EXTRAS: ${{ inputs.deps-extras }}
105110
WORK_DIR: ${{ inputs.working-directory }}
106111
working-directory: ${{ inputs.deps-directory || inputs.working-directory }}
107112
run: |
108113
if [ -f pyproject.toml ]; then
109-
uv pip install --system -e .
114+
if [ -n "$DEPS_EXTRAS" ]; then
115+
uv pip install --system -e ".[$DEPS_EXTRAS]"
116+
else
117+
uv pip install --system -e .
118+
fi
110119
elif [ -f requirements.txt ]; then
111120
uv pip install --system -r requirements.txt
112121
fi

specs/done/project-deps.md

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# Per-project dependency installation
2+
3+
## Problem
4+
5+
The reusable workflow installs dependencies from `deps-directory` (shared deps like `pulumi-aws`), but some Pulumi projects need additional packages (e.g. `oa-ci-gha` needs `pulumi-gcp`). Currently there's no way for a project to declare its own extra deps.
6+
7+
## Current behavior
8+
9+
The "Install dependencies" step runs in `deps-directory` (falling back to `working-directory`):
10+
11+
```bash
12+
if [ -f pyproject.toml ]; then
13+
uv pip install --system -e .
14+
elif [ -f requirements.txt ]; then
15+
uv pip install --system -r requirements.txt
16+
fi
17+
```
18+
19+
This installs the shared deps but ignores any project-specific requirements.
20+
21+
## Proposed change
22+
23+
After installing shared deps, also check `working-directory` for a `requirements.txt`:
24+
25+
```bash
26+
# Install shared deps (from deps-directory)
27+
if [ -f pyproject.toml ]; then
28+
uv pip install --system -e .
29+
elif [ -f requirements.txt ]; then
30+
uv pip install --system -r requirements.txt
31+
fi
32+
33+
# Install project-specific deps (from working-directory, if different)
34+
if [ "$DEPS_DIR" != "$WORK_DIR" ] && [ -f "$WORK_DIR/requirements.txt" ]; then
35+
uv pip install --system -r "$WORK_DIR/requirements.txt"
36+
fi
37+
```
38+
39+
The `!= WORK_DIR` guard avoids double-installing when `deps-directory` and `working-directory` are the same (or when `deps-directory` is unset and defaults to `working-directory`).
40+
41+
## Caller usage
42+
43+
In `Open-Athena/ops`, `aws/oa-ci-gha/requirements.txt` would contain:
44+
45+
```
46+
pulumi-gcp>=7.0.0,<8.0.0
47+
```
48+
49+
No changes needed to the caller workflow — the reusable workflow picks it up automatically.
50+
51+
## Scope
52+
53+
This is a one-line addition to the "Install dependencies" step. No new inputs required.

0 commit comments

Comments
 (0)