Skip to content

Commit 3fefba2

Browse files
committed
chore: 🤖 bootstrap scripts
1 parent 114d3d6 commit 3fefba2

File tree

4 files changed

+82
-2
lines changed

4 files changed

+82
-2
lines changed

README.md

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,10 +6,22 @@ Python 3.12
66

77
## Setting up
88

9+
- Make sure you have Python 3.12 installed on your system.
10+
- Create the virtual environment at `venv` using the following command:
11+
912
```shell
10-
pip install -r requirements.txt
13+
python -m venv venv
1114
```
1215

16+
- Activate the bootstrap script for your shell environmennt:
17+
- PS1: `./bootstrap.ps1`
18+
- Bash: `./bootstrap.sh`
19+
20+
This will install the required dependencies for project development,
21+
activate a pre-commit hook that will format the code using `isort` and
22+
`black`.
23+
24+
1325
## Starting the application
1426

1527
```shell
@@ -30,4 +42,4 @@ Required Notice: © CIB Mango Tree ([https://github.com/CIB-Mango-Tree])
3042

3143
---
3244

33-
By using this software, you agree to the terms and conditions of the PolyForm Noncommercial License 1.0.0.
45+
By using this software, you agree to the terms and conditions of the PolyForm Noncommercial License 1.0.0.

bootstrap.ps1

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
# Check if running in PowerShell
2+
if ($PSVersionTable -eq $null) {
3+
Write-Host "Please run this script in PowerShell."
4+
exit 1
5+
}
6+
7+
# Define the virtual environment and requirements file paths
8+
$repo_root = (Get-Location).Path
9+
$venv_path = Join-Path $repo_root "venv"
10+
$requirements_file = Join-Path $repo_root "requirements-dev.txt"
11+
12+
# Activate the virtual environment
13+
$activate_script = Join-Path $venv_path "Scripts\Activate.ps1"
14+
if (-Not (Test-Path $activate_script)) {
15+
Write-Host "Virtual environment not found. Please ensure it exists at: $venv_path"
16+
exit 1
17+
}
18+
19+
Write-Host "Activating virtual environment..."
20+
. $activate_script
21+
22+
# Install dependencies
23+
if (-Not (Test-Path $requirements_file)) {
24+
Write-Host "requirements-dev.txt not found at: $requirements_file"
25+
exit 1
26+
}
27+
28+
Write-Host "Installing dependencies from requirements-dev.txt..."
29+
pip install -r $requirements_file
30+
31+
# Activate pre-commit hooks
32+
Write-Host "Installing pre-commit hooks..."
33+
pre-commit install
34+
35+
Write-Host "Bootstrap process complete."

bootstrap.sh

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
#!/bin/bash
2+
3+
# Define the virtual environment and requirements file paths
4+
REPO_ROOT=$(pwd)
5+
VENV_PATH="$REPO_ROOT/venv"
6+
REQUIREMENTS_FILE="$REPO_ROOT/requirements-dev.txt"
7+
8+
# Check if virtual environment exists
9+
if [ ! -d "$VENV_PATH" ]; then
10+
echo "Virtual environment not found. Please ensure it exists at: $VENV_PATH"
11+
exit 1
12+
fi
13+
14+
# Activate the virtual environment
15+
echo "Activating virtual environment..."
16+
source "$VENV_PATH/bin/activate"
17+
18+
# Check if requirements-dev.txt exists
19+
if [ ! -f "$REQUIREMENTS_FILE" ]; then
20+
echo "requirements-dev.txt not found at: $REQUIREMENTS_FILE"
21+
exit 1
22+
fi
23+
24+
# Install dependencies
25+
echo "Installing dependencies from requirements-dev.txt..."
26+
pip install -r "$REQUIREMENTS_FILE"
27+
28+
# Activate pre-commit hooks
29+
echo "Installing pre-commit hooks..."
30+
pre-commit install
31+
32+
echo "Bootstrap process complete."

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
-r requirements.txt
22

33
pre_commit==4.0.1
4+
pyarrow-stubs==17.13

0 commit comments

Comments
 (0)