Virtual Environment Best Practices - Creating and Naming


#1

Hey All

I’m just curious about if there are established best practices on creating and naming virtual environments. I’ve done a ton of googling and redditing and options and opinions seem to be all over the place.

Let’s assume you’re starting a new project today and you’re using the latest and greatest of everything. Python 3.7+, pip3, venv, etc…

1 - Where do you create your virtual environment? Recently, I’ve been creating them in the root directory of the project. I know I’ve seen and read that some people have a dedicated directory on their machine that contains all virtual environments for all of their projects. Is this a better approach?

2 - What do you name your virtual environment? Recently, I’ve been naming my virtual environment the same name as my root project directory. Sometimes I love it and sometimes it bothers me that you see 2 directories back to back with the same name. I do like when it’s activated in the terminal though, as your certain you’re working in the correct environment. I’ve been bouncing back and forth between Python projects a lot recently, so being certain I’m using the right environment has been nice.

3 - Is this the preferred way to create a virtual environment nowadays?