Skip to content

Commit

Permalink
refactor prj (pip scripts)
Browse files Browse the repository at this point in the history
  • Loading branch information
dec1 committed Jun 10, 2024
1 parent 30717b5 commit 48ec493
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 81 deletions.
96 changes: 96 additions & 0 deletions .idea/cody_history.xml

Large diffs are not rendered by default.

25 changes: 0 additions & 25 deletions prj/pip_reqs.txt

This file was deleted.

12 changes: 0 additions & 12 deletions prj/pip_reqs_base.txt

This file was deleted.

6 changes: 3 additions & 3 deletions prj/script/pip_reqs_export.cmd
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
SET "script_dir=%~dp0"
SET "script_dir=%script_dir:~0,-1%"
@echo off
call common.cmd

CALL %script_dir%\venv\Scripts\pip freeze > ..\pip_reqs.txt
CALL %venv_dir%\Scripts\pip freeze > %pip_reqs_dir%\pip_reqs.txt
4 changes: 2 additions & 2 deletions prj/script/pip_reqs_export.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

script_dir=$(dirname "$0")
source common.sh

# persist the exact dependencies (recursively)
$script_dir/venv/bin/pip freeze > $script_dir/../pip_reqs.txt
${venv_dir}/bin/pip freeze > ${pip_reqs_dir}/pip_reqs.txt
25 changes: 8 additions & 17 deletions prj/script/pip_reqs_install.cmd
Original file line number Diff line number Diff line change
@@ -1,21 +1,12 @@
SET "script_dir=%~dp0"
SET "script_dir=%script_dir:~0,-1%"
@echo off
call common.cmd

CALL %script_dir%\venv\Scripts\python -m pip install --upgrade pip
CALl %script_dir%\venv\Scripts\pip install --upgrade setuptools
CALL %venv_dir%\Scripts\python -m pip install --upgrade pip
CALl %venv_dir%\Scripts\pip install --upgrade setuptools


REM Latest
REM ------
REM install (latest versions of) dependencies
REM ------
CAll %script_dir%\venv\Scripts\pip install -r ..\pip_reqs_base.txt
REM 1) install latest (versions of) dependencies
CALL ${venv_dir}/bin/pip install -r ${pip_reqs_dir}/pip_reqs_base.txt

REM Exact
REM ------
REM alternatively, use this instead to install exact (recursive) dependencies previously 'frozen' by
REM previous call to 'pip_reqs_export.sh'
REM
REM recommended for production
REM ------
REM CAll .\venv\Scripts\pip install -r ..\pip_reqs.txt
REM 2) install exact (versions of) dependencies
REM CALL ${venv_dir}/bin/pip install -r ../pip_reqs.txt
23 changes: 10 additions & 13 deletions prj/script/pip_reqs_install.sh
Original file line number Diff line number Diff line change
@@ -1,20 +1,17 @@
#!/bin/bash

script_dir=$(dirname "$0")
source common.sh

$script_dir/venv/bin/python -m pip install --upgrade pip
$script_dir/venv/bin/pip install --upgrade setuptools
${venv_dir}/bin/python -m pip install --upgrade pip
${venv_dir}/bin/pip install --upgrade setuptools


# Latest
# ------
# install (latest versions of) dependencies
$script_dir/venv/bin/pip install -r $script_dir/../pip_reqs_base.txt

# Exact
# ------
# alternatively, use this instead to install exact (recursive) dependencies previously 'frozen' by
# previous call to 'pip_reqs_export.sh'
#
# 1) install latest (versions of) dependencies
${venv_dir}/bin/pip install -r ${pip_reqs_dir}/pip_reqs_base.txt

# 2) install exact (versions of) dependencies
#./venv/bin/pip install -r ../pip_reqs.txt

# eg from previous call to 'pip_reqs_export.sh'
# recommended for production
#./venv/bin/pip install -r ../pip_reqs_base.txt
11 changes: 6 additions & 5 deletions prj/script/venv_create.cmd
Original file line number Diff line number Diff line change
@@ -1,23 +1,24 @@
REM set HTTPS_PROXY= http://10.110.15.6:8080

SET "script_dir=%~dp0"
SET "script_dir=%script_dir:~0,-1%"
@echo off
call common.cmd


CALL python -m venv %script_dir%\venv

echo ".....virtual environment created"

CALL %script_dir%\venv\Scripts\activate
CALL %venv_dir%\Scripts\activate

echo ".....pip reqs installing...."

CALL %script_dir%\pip_reqs_install.cmd

echo ".....pip reqs installed"

CALL %script_dir%\\venv\Scripts\deactivate
CALL %venv_dir%\Scripts\deactivate

echo ".....venv ready"


pause
pause
10 changes: 6 additions & 4 deletions prj/script/venv_create.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
#!/bin/bash

script_dir=$(dirname "$0")
source ./common.sh

python3 -m venv $script_dir/venv

python3 -m venv ${venv_dir}

echo ".....virtual environment created"

source $script_dir/venv/bin/activate
source ${venv_dir}/bin/activate

echo ".....pip reqs installing...."

source $script_dir/pip_reqs_install.sh

source ${script_dir}/pip_reqs_install.sh

echo ".....pip reqs installed"

Expand Down

0 comments on commit 48ec493

Please sign in to comment.