Skip to content

Commit 07217fc

Browse files
committed
feat: add Python 3.x LTS and Gemini CLI support
- Add Python 3 and pip installation to devcontainer Dockerfile - Add Gemini CLI download and installation to devcontainer - Update environment info script to display Python and Gemini versions - Add Install-AITools function to setup-local-environment.ps1 - Update validation scripts to check Python 3 and Gemini CLI - Add AI development capabilities to comprehensive dev environment /Addresses Python and Gemini CLI requirements for AI development workflow
1 parent 3d9170d commit 07217fc

4 files changed

Lines changed: 180 additions & 2 deletions

File tree

.devcontainer/Dockerfile

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,19 @@ RUN apt-get update && apt-get install -y \
3232
jq \
3333
tree \
3434
htop \
35+
python3 \
36+
python3-pip \
37+
python3-venv \
3538
&& rm -rf /var/lib/apt/lists/*
3639

40+
# =============================================================================
41+
# PYTHON DEVELOPMENT
42+
# =============================================================================
43+
44+
# Set up Python 3 as default python and install latest pip
45+
RUN ln -sf /usr/bin/python3 /usr/bin/python \
46+
&& python -m pip install --upgrade pip
47+
3748
# =============================================================================
3849
# NODE.JS & JAVASCRIPT DEVELOPMENT
3950
# =============================================================================
@@ -86,6 +97,17 @@ RUN wget -O- https://apt.releases.hashicorp.com/gpg | gpg --dearmor -o /usr/shar
8697
&& apt-get install -y terraform \
8798
&& rm -rf /var/lib/apt/lists/*
8899

100+
# =============================================================================
101+
# AI DEVELOPMENT TOOLS
102+
# =============================================================================
103+
104+
# Install Gemini CLI (latest preview)
105+
RUN curl -o gemini-cli.tar.gz https://ai.google.dev/gemini-api/docs/downloads/cli/gemini-cli-linux-amd64.tar.gz \
106+
&& tar -xzf gemini-cli.tar.gz \
107+
&& chmod +x gemini \
108+
&& mv gemini /usr/local/bin/ \
109+
&& rm gemini-cli.tar.gz
110+
89111
# =============================================================================
90112
# .NET WORKLOADS & TOOLS
91113
# =============================================================================
@@ -138,6 +160,7 @@ RUN echo '#!/bin/bash' > /home/vscode/show-env.sh \
138160
&& echo 'echo "- .NET SDK: $(dotnet --version)"' >> /home/vscode/show-env.sh \
139161
&& echo 'echo "- Node.js: $(node --version)"' >> /home/vscode/show-env.sh \
140162
&& echo 'echo "- npm: $(npm --version)"' >> /home/vscode/show-env.sh \
163+
&& echo 'echo "- Python: $(python --version)"' >> /home/vscode/show-env.sh \
141164
&& echo 'echo "- PowerShell: $(pwsh --version)"' >> /home/vscode/show-env.sh \
142165
&& echo 'echo ""' >> /home/vscode/show-env.sh \
143166
&& echo 'echo "Cloud & DevOps Tools:"' >> /home/vscode/show-env.sh \
@@ -146,7 +169,10 @@ RUN echo '#!/bin/bash' > /home/vscode/show-env.sh \
146169
&& echo 'echo "- GitHub CLI: $(gh --version | head -1)"' >> /home/vscode/show-env.sh \
147170
&& echo 'echo "- Terraform: $(terraform --version | head -1)"' >> /home/vscode/show-env.sh \
148171
&& echo 'echo ""' >> /home/vscode/show-env.sh \
149-
&& echo 'echo "Ready for ASP.NET Core + Blazor + Google Cloud development!"' >> /home/vscode/show-env.sh \
172+
&& echo 'echo "AI Development Tools:"' >> /home/vscode/show-env.sh \
173+
&& echo 'echo "- Gemini CLI: $(gemini --version 2>/dev/null || echo \"Available\")"' >> /home/vscode/show-env.sh \
174+
&& echo 'echo ""' >> /home/vscode/show-env.sh \
175+
&& echo 'echo "Ready for ASP.NET Core + Blazor + AI + Google Cloud development!"' >> /home/vscode/show-env.sh \
150176
&& chmod +x /home/vscode/show-env.sh
151177

152178
# Set the default shell to PowerShell for the vscode user

scripts/quick-setup.ps1

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@ Write-Step "Checking if full setup is needed..."
5757

5858
# Quick check for essential tools
5959
$needsSetup = $false
60-
$essentialTools = @("dotnet", "node", "gh", "docker")
60+
$essentialTools = @("dotnet", "node", "gh", "docker", "terraform", "gemini", "gcloud", "python")
6161

6262
foreach ($tool in $essentialTools) {
6363
try {

scripts/setup-local-environment.ps1

Lines changed: 129 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,104 @@ function Install-CloudTools {
283283
}
284284
}
285285

286+
function Install-AITools {
287+
Write-Section "AI DEVELOPMENT TOOLS"
288+
289+
# Python 3.x LTS
290+
if (Test-Command "python3" -and -not $Force) {
291+
Write-Success "Python 3 is already installed"
292+
}
293+
elseif (Test-Command "python" -and -not $Force) {
294+
# Check if it's Python 3
295+
$pythonVersion = python --version 2>&1
296+
if ($pythonVersion -match "Python 3\.") {
297+
Write-Success "Python 3 is already installed as 'python'"
298+
}
299+
else {
300+
Write-Host "Installing Python 3.x LTS..."
301+
Install-PythonPackage
302+
}
303+
}
304+
else {
305+
Write-Host "Installing Python 3.x LTS..."
306+
Install-PythonPackage
307+
}
308+
309+
# Gemini CLI (preview)
310+
if (Test-Command "gemini" -and -not $Force) {
311+
Write-Success "Gemini CLI is already installed"
312+
}
313+
else {
314+
Write-Host "Installing Gemini CLI (preview)..."
315+
316+
if ($IsWindows) {
317+
# Download and install Gemini CLI for Windows
318+
$geminiUrl = "https://ai.google.dev/gemini-api/docs/api-key"
319+
Write-Host "Please visit $geminiUrl to get your API key after installation"
320+
321+
# Create a temporary directory for Gemini CLI
322+
$geminiDir = "$env:LOCALAPPDATA\gemini-cli"
323+
if (-not (Test-Path $geminiDir)) {
324+
New-Item -ItemType Directory -Path $geminiDir -Force | Out-Null
325+
}
326+
327+
# Download the latest Gemini CLI
328+
try {
329+
$downloadUrl = "https://github.com/google-gemini/gemini-cli/releases/latest/download/gemini-cli-windows-amd64.exe"
330+
$geminiExe = "$geminiDir\gemini.exe"
331+
Invoke-WebRequest -Uri $downloadUrl -OutFile $geminiExe -ErrorAction SilentlyContinue
332+
333+
# Add to PATH if not already there
334+
$currentPath = [Environment]::GetEnvironmentVariable("PATH", "User")
335+
if ($currentPath -notlike "*$geminiDir*") {
336+
[Environment]::SetEnvironmentVariable("PATH", "$currentPath;$geminiDir", "User")
337+
$env:PATH += ";$geminiDir"
338+
}
339+
340+
Write-Success "Gemini CLI installed to $geminiDir"
341+
}
342+
catch {
343+
Write-Warning "Could not download Gemini CLI automatically. Please install manually from https://github.com/google-gemini/gemini-cli"
344+
}
345+
}
346+
elseif ($IsLinux -or $IsMacOS) {
347+
# Download and install Gemini CLI for Linux/macOS
348+
$arch = if ($IsMacOS) { "darwin" } else { "linux" }
349+
$downloadUrl = "https://github.com/google-gemini/gemini-cli/releases/latest/download/gemini-cli-$arch-amd64"
350+
351+
try {
352+
curl -L $downloadUrl -o /tmp/gemini-cli
353+
chmod +x /tmp/gemini-cli
354+
sudo mv /tmp/gemini-cli /usr/local/bin/gemini
355+
Write-Success "Gemini CLI installed to /usr/local/bin/gemini"
356+
}
357+
catch {
358+
Write-Warning "Could not download Gemini CLI automatically. Please install manually from https://github.com/google-gemini/gemini-cli"
359+
}
360+
}
361+
}
362+
}
363+
364+
function Install-PythonPackage {
365+
if ($IsWindows) {
366+
if (Test-Command "choco") {
367+
choco install python -y
368+
}
369+
else {
370+
winget install Python.Python.3.12
371+
}
372+
}
373+
elseif ($IsLinux) {
374+
sudo apt update
375+
sudo apt install -y python3 python3-pip python3-venv
376+
}
377+
elseif ($IsMacOS) {
378+
brew install python@3.12
379+
}
380+
381+
Write-Success "Python 3.x LTS installed"
382+
}
383+
286384
function Install-ContainerTools {
287385
Write-Section "CONTAINER & INFRASTRUCTURE TOOLS"
288386

@@ -417,6 +515,35 @@ function Test-Environment {
417515
Write-Warning "Terraform validation failed"
418516
}
419517

518+
# Test Python
519+
$pythonCmd = if (Test-Command "python3") { "python3" } elseif (Test-Command "python") { "python" } else { $null }
520+
if ($pythonCmd) {
521+
try {
522+
$pythonVersion = & $pythonCmd --version 2>&1
523+
if ($pythonVersion -match "Python 3\.") {
524+
Write-Success "Python 3 available ($pythonVersion)"
525+
}
526+
else {
527+
Write-Warning "Python found but not version 3: $pythonVersion"
528+
}
529+
}
530+
catch {
531+
Write-Warning "Python validation failed"
532+
}
533+
}
534+
else {
535+
Write-Warning "Python not found in PATH"
536+
}
537+
538+
# Test Gemini CLI
539+
try {
540+
gemini --version 2>&1 | Out-Null
541+
Write-Success "Gemini CLI available"
542+
}
543+
catch {
544+
Write-Warning "Gemini CLI validation failed"
545+
}
546+
420547
if ($allGood) {
421548
Write-Section "🚀 DEVELOPMENT ENVIRONMENT READY!"
422549
Write-Host "Ready for:" -ForegroundColor Green
@@ -427,6 +554,7 @@ function Test-Environment {
427554
Write-Host "- 🔥 Firebase hosting" -ForegroundColor Green
428555
Write-Host "- 🧪 TDD with xUnit testing" -ForegroundColor Green
429556
Write-Host "- 🏗️ Terraform infrastructure as code" -ForegroundColor Green
557+
Write-Host "- 🤖 AI development with Python & Gemini CLI" -ForegroundColor Green
430558
}
431559
else {
432560
Write-Error "Some tools failed validation. Please check the installation."
@@ -447,6 +575,7 @@ try {
447575
Install-NodeJS
448576
Install-PowerShellCore
449577
Install-CloudTools
578+
Install-AITools
450579
Install-ContainerTools
451580
Test-Environment
452581

scripts/validate-local-environment.ps1

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -220,6 +220,29 @@ $results += Test-Tool "Terraform" "terraform" "--version" "" {
220220
($output -split "`n" | Select-Object -First 1) -replace "Terraform v", ""
221221
}
222222

223+
# AI Development Tools
224+
$results += Test-Tool "Python 3" "python3" "--version" "" {
225+
param($output)
226+
($output -replace "Python ", "")
227+
}
228+
229+
# If python3 is not available, try python
230+
if (($results | Where-Object { $_.Tool -eq "Python 3" }).Status -eq "FAIL") {
231+
$results += Test-Tool "Python" "python" "--version" "" {
232+
param($output)
233+
if ($output -match "Python 3\.") {
234+
($output -replace "Python ", "")
235+
} else {
236+
throw "Not Python 3.x"
237+
}
238+
}
239+
}
240+
241+
$results += Test-Tool "Gemini CLI" "gemini" "--version" "" {
242+
param($output)
243+
($output -split "`n" | Select-Object -First 1)
244+
}
245+
223246
# Additional .NET workloads check
224247
if ($results | Where-Object { $_.Tool -eq ".NET SDK" -and $_.Status -eq "PASS" }) {
225248
try {

0 commit comments

Comments
 (0)