3 ms·
Yeah, venv's are a must. And to the article's "forgot to activate the venv" complaint, I highly recommend direnv. On top of activating the venv when (and only
by hannibalhorn 7y ago
Yeah, venv's are a must. And to the article's "forgot to activate the venv" complaint, I highly recommend direnv.
On top of activating the venv when (and only when) you're inside your project directory tree, you can use dotenv for loading all relevant env vars (AWS creds, API keys, etc.,) and add your project's root dir to PYTHONPATH with path_add.
- rmwaite 7y agoThe PIP_REQUIRE_VIRTUALENV environment variable also helps with this.
- yrro 7y agoThank you! Now if only this was documented! Come to think of it, only there was a PIP_DEFAULT_VIRTUALENV_PROJECTDIR variable which would causes pip to look upwards until it found a setup.py file, and then use a .venv directory in that directory by default...
- izietto 7y agoOr usev another version manager: I use asdf https://github.com/asdf-vm/asdf https://github.com/asdf-vm/asdf