Skip to content

Commit

Permalink
Actually we can keep my venvs clean with a global env
Browse files Browse the repository at this point in the history
  • Loading branch information
alexwlchan committed Nov 26, 2023
1 parent 3d38821 commit e1dbdf8
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
9 changes: 1 addition & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,8 @@ To set up this repo on a new computer, I run the following commands in a Fish sh
$ source .venv/bin/activate.fish
$ pip install -r requirements.txt
```

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):

```console
$ mkdir -p ~/.pip
$ echo -e "[global]\nrequire-virtualenv = true" > ~/.pip/pip.conf
```
4. Install my Fish config, so Fish knows where to find all these scripts:
3. Install my Fish config, so Fish knows where to find all these scripts:

```console
$ ln -s ~/repos/scripts/config.fish ~/.config/fish/config.fish
Expand Down
11 changes: 11 additions & 0 deletions config.fish
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,17 @@ set -x fish_function_path ~/repos/scripts/fish_functions $fish_function_path
fish_add_path /Library/Frameworks/Python.framework/Versions/3.12/bin


# This prevents me from installing packages with pip without being
# in a virtualenv first.
#
# This allows me to keep my system Python clean, and install all my
# packages inside virtualenvs.
#
# See https://docs.python-guide.org/dev/pip-virtualenv/#requiring-an-active-virtual-environment-for-pip
#
set -g -x PIP_REQUIRE_VIRTUALENV true


# This tells fish to run a couple of functions as event handlers --
# that is, to run a function when a variable changes or something similar.
# These functions can't be autoloaded.
Expand Down

0 comments on commit e1dbdf8

Please sign in to comment.