Skip to content

Commit e1dbdf8

Browse files
committed
Actually we can keep my venvs clean with a global env
1 parent 3d38821 commit e1dbdf8

File tree

2 files changed

+12
-8
lines changed

2 files changed

+12
-8
lines changed

README.md

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -21,15 +21,8 @@ To set up this repo on a new computer, I run the following commands in a Fish sh
2121
$ source .venv/bin/activate.fish
2222
$ pip install -r requirements.txt
2323
```
24-
25-
3. Add some global pip config to [prevent installing anything outside virtual environments](https://blog.glyph.im/2023/08/get-your-mac-python-from-python-dot-org.html#and-always-use-virtual-environments):
26-
27-
```console
28-
$ mkdir -p ~/.pip
29-
$ echo -e "[global]\nrequire-virtualenv = true" > ~/.pip/pip.conf
30-
```
3124
32-
4. Install my Fish config, so Fish knows where to find all these scripts:
25+
3. Install my Fish config, so Fish knows where to find all these scripts:
3326

3427
```console
3528
$ ln -s ~/repos/scripts/config.fish ~/.config/fish/config.fish

config.fish

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,17 @@ set -x fish_function_path ~/repos/scripts/fish_functions $fish_function_path
2222
fish_add_path /Library/Frameworks/Python.framework/Versions/3.12/bin
2323

2424

25+
# This prevents me from installing packages with pip without being
26+
# in a virtualenv first.
27+
#
28+
# This allows me to keep my system Python clean, and install all my
29+
# packages inside virtualenvs.
30+
#
31+
# See https://docs.python-guide.org/dev/pip-virtualenv/#requiring-an-active-virtual-environment-for-pip
32+
#
33+
set -g -x PIP_REQUIRE_VIRTUALENV true
34+
35+
2536
# This tells fish to run a couple of functions as event handlers --
2637
# that is, to run a function when a variable changes or something similar.
2738
# These functions can't be autoloaded.

0 commit comments

Comments
 (0)