Skip to content

Commit 11b450c

Browse files
committed
Merge branch 'develop' into feature/mark-sync-deprecated
2 parents 8665832 + cf247bc commit 11b450c

File tree

2 files changed

+9
-4
lines changed

2 files changed

+9
-4
lines changed

CHANGELOG.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,13 @@
22

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

5-
## Minor changes
5+
### Minor changes
66
* `venv sync` command marked as deprecated with removal planned for `v2.0`. Use `venv install <requirements>.lock` instead. [#14](https://github.com/SallingGroup-AI-and-ML/venv-cli/pull/14)
7+
* `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)
78

89
## [v1.3.0](https://github.com/SallingGroup-AI-and-ML/venv-cli/releases/tag/v1.3.0) (2023-10-30)
910

10-
## Major changes
11+
### Major changes
1112
* `venv lock` no longer tries to fill in credentials for packages installed via VCS. This behavior was undocumented and difficult to maintain and ultimately tried to alleviate a shortcoming of the way `pip` handles these credentials. [#11](https://github.com/SallingGroup-AI-and-ML/venv-cli/pull/11)
1213
For users who have credentials as part of URLs in their `requirements.txt` files, there are other ways to handle credentials, e.g. filling them in `requirements.lock` manually, using a `.netrc` file to store the credetials or using a keyring. See https://pip.pypa.io/en/stable/topics/authentication/ for more info.
1314

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)