-
Notifications
You must be signed in to change notification settings - Fork 2.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
1302da0
commit 5de5f48
Showing
6 changed files
with
156 additions
and
28 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
@echo off | ||
:: Collection of helper functions to import in other scripts | ||
|
||
:: Function to pause the script until a key is pressed | ||
:space_to_continue | ||
echo Press any key to continue... | ||
pause > nul | ||
goto :eof | ||
|
||
:: Function to print a horizontal line | ||
:print_horizontal_line | ||
echo ------------------------------------------------------------ | ||
goto :eof | ||
|
||
:: Function to print a heading with horizontal lines | ||
:print_heading | ||
call :print_horizontal_line | ||
echo -*- %~1 | ||
call :print_horizontal_line | ||
goto :eof | ||
|
||
:: Function to print a status message | ||
:print_status | ||
echo -*- %~1 | ||
goto :eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
@echo off | ||
setlocal | ||
|
||
set "CURR_DIR=%~dp0" | ||
set "REPO_ROOT=%~dp0.." | ||
set "VENV_DIR=%REPO_ROOT%\phienv" | ||
|
||
call "%CURR_DIR%_utils.bat" | ||
|
||
echo phidata dev setup | ||
echo Creating venv: %VENV_DIR% | ||
|
||
echo Removing existing venv: %VENV_DIR% | ||
rd /s /q "%VENV_DIR%" | ||
|
||
echo Creating python3 venv: %VENV_DIR% | ||
python -m venv "%VENV_DIR%" | ||
|
||
echo Upgrading pip to the latest version | ||
call "%VENV_DIR%\Scripts\python.exe" -m pip install --upgrade pip | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Failed to upgrade pip. Please run the script as Administrator or check your network connection. | ||
exit /b %ERRORLEVEL% | ||
) | ||
|
||
echo Installing base python packages | ||
call "%VENV_DIR%\Scripts\pip" install pip-tools twine build | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Failed to install required packages. Attempting to retry installation... | ||
call "%VENV_DIR%\Scripts\pip" install pip-tools twine build | ||
) | ||
|
||
:: Install workspace | ||
call "%VENV_DIR%\Scripts\activate" | ||
call "%CURR_DIR%install.bat" | ||
|
||
echo Activate using: call %VENV_DIR%\Scripts\activate | ||
|
||
endlocal |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
@echo off | ||
|
||
:: Formats phidata | ||
|
||
:: Usage: | ||
:: .\scripts\format.bat | ||
|
||
set "CURR_DIR=%~dp0" | ||
set "REPO_ROOT=%~dp0.." | ||
|
||
:: Ensure that _utils.bat is correctly located and called | ||
call "%CURR_DIR%\_utils.bat" | ||
|
||
:main | ||
call :print_heading "Formatting phidata" | ||
|
||
call :print_heading "Running: ruff format %REPO_ROOT%" | ||
call "%REPO_ROOT%\phienv\Scripts\ruff" format "%REPO_ROOT%" | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Failed to format with ruff. | ||
goto :eof | ||
) | ||
|
||
call :print_heading "Running: ruff check %REPO_ROOT%" | ||
call "%REPO_ROOT%\phienv\Scripts\ruff" check "%REPO_ROOT%" | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Failed ruff check. | ||
goto :eof | ||
) | ||
|
||
call :print_heading "Running: mypy %REPO_ROOT%" | ||
call "%REPO_ROOT%\phienv\Scripts\mypy" "%REPO_ROOT%" | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Failed mypy check. | ||
goto :eof | ||
) | ||
|
||
call :print_heading "Running: pytest %REPO_ROOT%" | ||
call "%REPO_ROOT%\phienv\Scripts\pytest" "%REPO_ROOT%" | ||
if %ERRORLEVEL% neq 0 ( | ||
echo Failed pytest. | ||
goto :eof | ||
) | ||
|
||
goto :eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
@echo off | ||
:: Install phidata | ||
:: Usage: | ||
:: .\scripts\install.bat | ||
|
||
set "CURR_DIR=%~dp0" | ||
set "REPO_ROOT=%~dp0.." | ||
call "%CURR_DIR%_utils.bat" | ||
|
||
:main | ||
call :print_heading "Installing phidata" | ||
|
||
call :print_heading "Installing requirements.txt" | ||
call "%REPO_ROOT%\phienv\Scripts\pip" install --no-deps -r "%REPO_ROOT%\requirements.txt" | ||
|
||
call :print_heading "Installing phidata with [dev] extras" | ||
call "%REPO_ROOT%\phienv\Scripts\pip" install --editable "%REPO_ROOT%[dev]" | ||
|
||
goto :eof |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,26 +1,19 @@ | ||
#!/bin/bash | ||
@echo off | ||
:: Install phidata | ||
:: Usage: | ||
:: .\scripts\install.bat | ||
|
||
############################################################################ | ||
# | ||
# Install phidata | ||
# Usage: | ||
# ./scripts/install.sh | ||
# | ||
############################################################################ | ||
set "CURR_DIR=%~dp0" | ||
set "REPO_ROOT=%~dp0.." | ||
call "%CURR_DIR%_utils.bat" | ||
|
||
CURR_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" | ||
REPO_ROOT="$( dirname ${CURR_DIR} )" | ||
source ${CURR_DIR}/_utils.sh | ||
:main | ||
call :print_heading "Installing phidata" | ||
|
||
main() { | ||
print_heading "Installing phidata" | ||
call :print_heading "Installing requirements.txt" | ||
call "%REPO_ROOT%\phienv\Scripts\pip" install --no-deps -r "%REPO_ROOT%\requirements.txt" | ||
|
||
print_heading "Installing requirements.txt" | ||
pip install --no-deps \ | ||
-r ${REPO_ROOT}/requirements.txt | ||
call :print_heading "Installing phidata with [dev] extras" | ||
call "%REPO_ROOT%\phienv\Scripts\pip" install --editable "%REPO_ROOT%[dev]" | ||
|
||
print_heading "Installing phidata with [dev] extras" | ||
pip install --editable "${REPO_ROOT}[dev]" | ||
} | ||
|
||
main "$@" | ||
goto :eof |