Skip to content

Commit ffc4977

Browse files
feat: Add '--no-update' option (#27)
* Use of '--no-update' skips updating pip, setuptools, and wheel after the creation of the virtual environment. This isn't a great idea in general, but it does make environment creation faster. * Update README to note new option. * Add check of '--no-update' to CI.
1 parent e18c52f commit ffc4977

File tree

3 files changed

+25
-2
lines changed

3 files changed

+25
-2
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,3 +127,13 @@ jobs:
127127
- name: Remove venv "${{ matrix.venv-name }}"
128128
run: |
129129
rm -rf ${{ matrix.venv-name }}
130+
131+
- name: Setup default venv with --no-update option
132+
run: |
133+
. cvmfs-venv --no-update
134+
echo "# Python runtime: $(command -v python)"
135+
python --version --version
136+
echo "# python -m pip list"
137+
python -m pip list
138+
echo "# python -m pip list --local"
139+
python -m pip list --local

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,9 @@ Usage: cvmfs-venv [-s|--setup] <virtual environment name>
2828
Options:
2929
-h --help Print this help message
3030
-s --setup String of setup options to be parsed
31+
--no-update After venv creation don't update pip, setuptools, and wheel
32+
to the latest releases. Use of this option is not recommended,
33+
but is faster.
3134

3235
Note: cvmfs-venv extends the Python venv module and so requires Python 3.3+.
3336

cvmfs-venv.sh

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,11 +5,14 @@ export PIP_REQUIRE_VIRTUALENV=true
55

66
_help_options () {
77
cat <<EOF
8-
Usage: cvmfs-venv [-s|--setup] <virtual environment name>
8+
Usage: cvmfs-venv [-s|--setup] [--no-update] <virtual environment name>
99
1010
Options:
1111
-h --help Print this help message
1212
-s --setup String of setup options to be parsed
13+
--no-update After venv creation don't update pip, setuptools, and wheel
14+
to the latest releases. Use of this option is not recommended,
15+
but is faster.
1316
1417
Note: cvmfs-venv extends the Python venv module and so requires Python 3.3+.
1518
@@ -62,6 +65,10 @@ while [ $# -gt 0 ]; do
6265
_setup_command="${2}"
6366
shift 2
6467
;;
68+
--no-update)
69+
_no_update=true
70+
shift
71+
;;
6572
--)
6673
shift
6774
break
@@ -318,10 +325,13 @@ fi
318325

319326
# Get latest pip, setuptools, wheel
320327
# Hide not-real errors from CVMFS by sending to /dev/null
321-
python -m pip --quiet install --upgrade pip setuptools wheel &> /dev/null
328+
if [ -z "${_no_update}" ]; then
329+
python -m pip --quiet install --upgrade pip setuptools wheel &> /dev/null
330+
fi
322331

323332
unset _venv_name
324333

325334
fi # _return_break if statement end
326335

327336
unset _return_break
337+
unset _no_update

0 commit comments

Comments
 (0)