Skip to content

Commit

Permalink
chore(retspy): update helper scripts
Browse files Browse the repository at this point in the history
  • Loading branch information
wvenialbo committed Sep 13, 2024
1 parent fe45347 commit 3542cb0
Show file tree
Hide file tree
Showing 6 changed files with 96 additions and 6 deletions.
34 changes: 30 additions & 4 deletions scripts/build.ps1
Original file line number Diff line number Diff line change
@@ -1,11 +1,37 @@
##
## Build the package for deployment
## Build the project
##

# Activate the environment
# To build a single executable:
# .\build.ps1 -UseOneFile
#
# To build with separate files:
# .\build.ps1

param (
[switch]$UseOneFile
)

# Activate the virtual environment

& ./.venv/Scripts/Activate.ps1

# Build the package
# Install/Update the `pyinstaller` tool package

pip install pyinstaller --upgrade

# Set the PyInstaller option based on user choice

if ($UseOneFile) {

# Build the application as a single executable

pyinstaller --onefile --name cbrpy cbrpy.py

} else {

# Build the application with separate files

pyinstaller --onedir --name cbrpy cbrpy.py

python -m build -n # --wheel
}
4 changes: 4 additions & 0 deletions scripts/deps.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ $project = 'retspy_radar'

& ./.venv/Scripts/Activate.ps1

# Install/Update the `findpydeps` tool package

pip install findpydeps --upgrade

# Get the list of installed packages >> 'installed.txt'

$installed_pkgs = 'installed.txt'
Expand Down
4 changes: 2 additions & 2 deletions scripts/install.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
$venv = '.venv'

If (-not (Test-Path -Path $venv)) {
python -m venv $venv
python -m venv $venv --copies
}

# Activate the environment
Expand All @@ -16,7 +16,7 @@ If (-not (Test-Path -Path $venv)) {

# Install development time packages, if any

$packages = 'build', 'findpydeps', 'wheel', 'jupyterlab' # for prototyping
$packages = 'jupyterlab' # for prototyping

Foreach ($package in $packages) {
pip install $package --upgrade
Expand Down
18 changes: 18 additions & 0 deletions scripts/model.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
##
## Generate model schema files
##

# Activate the environment

& ./.venv/Scripts/Activate.ps1

# Install/Update the `datamodel-code-generator` tool package

pip install datamodel-code-generator --upgrade

# Generate schema files

$schema = ./schema
$models = ./models

datamodel-codegen --input $schema --output $models --field-constraints --input-file-type jsonschema --target-python-version 3.12 --output-model-type pydantic_v2.BaseModel
41 changes: 41 additions & 0 deletions scripts/pack.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
##
## Build the package for deployment
##

# To build a wheel:
# .\pack.ps1 -Wheel
#
# To build a .tar.gz:
# .\build.ps1

param (
[switch]$Wheel
)

# Activate the environment

& ./.venv/Scripts/Activate.ps1

# Build the package based on user choice

if ($Wheel) {

# Install/Update the `build` and `wheel` tools packages

pip install build wheel --upgrade

# Build the package as a wheel

python -m build -n --wheel

} else {

# Install/Update the `build` tool package

pip install build --upgrade

# Build the package as a .tar.gz

python -m build -n

}
1 change: 1 addition & 0 deletions scripts/run.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
./dist/retspy-radar.exe --help

0 comments on commit 3542cb0

Please sign in to comment.