Skip to content

Commit cf247bc

Browse files
authored
Clear environment before running pip install (#12)
2 parents 1202c6f + 88294a8 commit cf247bc

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22

33
## [Unreleased](https://github.com/SallingGroup-AI-and-ML/venv-cli/tree/develop)
44

5+
### Minor changes
6+
* `venv install` now runs `venv clear` before installation. This ensures that the enrivonment doesn't end up with orphaned packages after making changes to `requirements.txt`. [#9](https://github.com/SallingGroup-AI-and-ML/venv-cli/issues/9)
7+
58
## [v1.3.0](https://github.com/SallingGroup-AI-and-ML/venv-cli/releases/tag/v1.3.0) (2023-10-30)
69

710
## Major changes

src/venv-cli/venv.sh

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -167,8 +167,8 @@ venv::install() {
167167
if venv::_check_if_help_requested "$1"; then
168168
echo "venv install [<requirements file>] [--skip-lock] [<install args>]"
169169
echo
170-
echo "Install requirements from <requirements file>, like 'requirements.txt'"
171-
echo "or 'requirements.lock'."
170+
echo "Clear the environment, then install requirements from <requirements file>,"
171+
echo "like 'requirements.txt' or 'requirements.lock'."
172172
echo "Installed packages are then locked into the corresponding .lock-file,"
173173
echo "e.g. 'venv install requirements.txt' will lock packages into 'requirements.lock'."
174174
echo "This step is skipped if '--skip-lock' is specified, or when installing"
@@ -211,6 +211,10 @@ venv::install() {
211211
shift
212212
fi
213213

214+
# Clear the environment before running pip install to avoid orphaned packages
215+
# https://github.com/SallingGroup-AI-and-ML/venv-cli/issues/9
216+
venv::clear
217+
214218
venv::color_echo "${_green}" "Installing requirements from ${requirements_file}"
215219
if ! pip install --require-virtualenv --use-pep517 -r "${requirements_file}" "$@"; then
216220
return "${_fail}"

0 commit comments

Comments
 (0)