Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 13 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -367,6 +367,19 @@ The feature will be automatically discovered and available for use in configurat

## Development

- Install [Astral UV](https://docs.astral.sh/uv/)
- Setup dev environment and install dependencies:

```powershell
.\setup-venv.ps1
```

- Linting & formatting
- Use `uv run ruff check .` and `uv run ruff format .` Add checks to CI as required.
- Use `uv run mypy .`

To create a new release, you must be on the `develop` branch, and call `invoke create_release`

### Project Structure

```
Expand Down Expand Up @@ -395,14 +408,6 @@ generator/
3. The feature will be automatically discovered and registered
4. Run `--generate_documentation` to update docs

### Code validation

You can use `ruff` with `ruff check .` and `mypy` with `mypy .` to validate that the code is correct before submitting.

### Code Formatting

You can use `ruff format .` to automatically reformat the code.

## License

MIT License - see LICENSE file for details.
Expand Down
81 changes: 2 additions & 79 deletions setup-env.ps1
Original file line number Diff line number Diff line change
@@ -1,80 +1,3 @@
# PowerShell script to set up Python virtual environment and install requirements
# Usage: .\setup-env.ps1
uv sync --python 3.12 --link-mode=copy --extra dev

param(
[string]$VenvName = ".venv",
[string]$PyProjectFile = "pyproject.toml",
[switch]$Force
)

Write-Host "Setting up Python virtual environment..." -ForegroundColor Green

# Check if Python is installed
try {
$pythonVersion = python --version 2>&1
Write-Host "Found Python: $pythonVersion" -ForegroundColor Yellow
} catch {
Write-Host "Error: Python is not installed or not in PATH" -ForegroundColor Red
exit 1
}

# Check if requirements.txt exists
if (!(Test-Path $PyProjectFile)) {
Write-Host "Warning: $PyProjectFile not found in current directory" -ForegroundColor Yellow
$response = Read-Host "Continue without installing requirements? (y/n)"
if ($response -ne "y" -and $response -ne "Y") {
exit 1
}
}

# Remove existing virtual environment if Force flag is used
if ($Force -and (Test-Path $VenvName)) {
Write-Host "Removing existing virtual environment..." -ForegroundColor Yellow
Remove-Item -Recurse -Force $VenvName
}

# Create virtual environment if it doesn't exist
if (!(Test-Path $VenvName)) {
Write-Host "Creating virtual environment '$VenvName'..." -ForegroundColor Yellow
python -m venv $VenvName

if ($LASTEXITCODE -ne 0) {
Write-Host "Error: Failed to create virtual environment" -ForegroundColor Red
exit 1
}
Write-Host "Virtual environment created successfully!" -ForegroundColor Green
} else {
Write-Host "Virtual environment '$VenvName' already exists" -ForegroundColor Yellow
}

# Activate virtual environment
Write-Host "Activating virtual environment..." -ForegroundColor Yellow
& ".\$VenvName\Scripts\Activate.ps1"

if ($LASTEXITCODE -ne 0) {
Write-Host "Error: Failed to activate virtual environment" -ForegroundColor Red
exit 1
}

# Upgrade pip
Write-Host "Upgrading pip..." -ForegroundColor Yellow
python -m pip install --upgrade pip

# Install requirements if file exists
if (Test-Path $PyProjectFile) {
Write-Host "Installing packages from $PyProjectFile..." -ForegroundColor Yellow
pip install -e .[dev]

if ($LASTEXITCODE -eq 0) {
Write-Host "All packages installed successfully!" -ForegroundColor Green
} else {
Write-Host "Error: Some packages failed to install" -ForegroundColor Red
}
} else {
Write-Host "Skipping package installation - no requirements file found" -ForegroundColor Yellow
}

Write-Host "`nSetup complete!" -ForegroundColor Green
Write-Host "Virtual environment is now active." -ForegroundColor Green
Write-Host "To deactivate later, run: deactivate" -ForegroundColor Cyan
Write-Host "To activate again, run: .\$VenvName\Scripts\Activate.ps1" -ForegroundColor Cyan
. .\.venv\Scripts\Activate.ps1
Loading
Loading