diff --git a/activate.ps1 b/activate.ps1 new file mode 100644 index 0000000..32cab48 --- /dev/null +++ b/activate.ps1 @@ -0,0 +1,27 @@ +# Utility command to activate local Python venv +# located at the same folder of the code project + +function activate +{ + $current_folder = Split-Path -Path (Get-Location ).Path -Leaf + $venv_candidates = @('.venv', 'venv', '.env', ".hatch/${current_folder}") + + foreach ($candidate in $venv_candidates) + { + if (Test-Path -Path $candidate -PathType Container) + { + $venv = $candidate + } + } + + $venv = "${venv}/Scripts/Activate.ps1" + + if (Test-Path -Path $venv -PathType Leaf) + { + . $venv + } + else + { + Write-Output 'venv not found' + } +}