diff --git a/env.ps1 b/env.ps1 new file mode 100644 index 0000000..b8a7802 --- /dev/null +++ b/env.ps1 @@ -0,0 +1,33 @@ +# SPDX-License-Identifier: LGPL-2.1-only +# Copyright 2022 Jookia + +Function Activate { .\venv\Scripts\Activate.ps1 } + +Function Die { + Param ( $Message ) + Remove-Item -Recurse venv + Write-Output $Message + Exit 1 +} + +Function Setup { + Write-Output "No venv found, creating..." + python -m venv venv || Die "Unable to create venv" + Write-Output "Activating venv..." + Activate + Write-Output "Updating pip..." + pip -q install -U pip || Die "Unable to update pip" + Write-Output "Installing requirements..." + pip -q install -r requirements.txt || Die "Unable to install requirements" + New-Item venv\.stamp | Out-Null + Write-Output "All done!" +} + +If (Test-Path -Path venv\.stamp) { Activate } Else { Setup } + +Function Global:tidy { black src tests } +Function Global:lint { flake8 src tests } +Function Global:test { pytest -q -n auto --hypothesis-profile=dev } +Function Global:test_ci { pytest -q -n auto --hypothesis-profile=ci } +Function Global:test_long { pytest -q -n auto --hypothesis-profile=long } +Function Global:check { tidy && lint && test }