Remove packages when syncing (#135)

`pip-sync` will now uninstall any packages that aren't necessary.

Closes https://github.com/astral-sh/puffin/issues/128.
This commit is contained in:
Charlie Marsh 2023-10-19 00:14:20 -04:00 committed by GitHub
parent 41ece4184b
commit bd01fb490e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 215 additions and 132 deletions

View file

@ -17,18 +17,18 @@ TARGET=${1}
###
hyperfine --runs 20 --warmup 3 \
--prepare "virtualenv --clear .venv" \
"./target/release/puffin pip-sync ${TARGET} --ignore-installed --no-cache" \
"./target/release/puffin pip-sync ${TARGET} --no-cache" \
--prepare "rm -rf /tmp/site-packages" \
"pip install -r ${TARGET} --target /tmp/site-packages --ignore-installed --no-cache-dir --no-deps"
"pip install -r ${TARGET} --target /tmp/site-packages --no-cache-dir --no-deps"
###
# Installation with a warm cache, similar to blowing away and re-creating a virtual environment.
###
hyperfine --runs 20 --warmup 3 \
--prepare "virtualenv --clear .venv" \
"./target/release/puffin pip-sync ${TARGET} --ignore-installed" \
"./target/release/puffin pip-sync ${TARGET}" \
--prepare "rm -rf /tmp/site-packages" \
"pip install -r ${TARGET} --target /tmp/site-packages --ignore-installed --no-deps"
"pip install -r ${TARGET} --target /tmp/site-packages --no-deps"
###
# Installation with all dependencies already installed (no-op).