[Tutor] Python project organisation

Phil phillor9 at gmail.com
Sat Apr 22 21:30:00 EDT 2023


On 23/4/23 10:49, dn via Tutor wrote:

Thank you DN.


> Yes, each project SHOULD be 'insulated' from the next. 

What I've decided to do is only create a project directory and virtual 
environment for those projects where it makes sense. The rest can stay 
in the global environment.


> The mode of utilising virtual-environments is that only one (or a few 
> related) project/environments will be open or "live" at a time. Part 
> of making an environment active is to add it into the PYTHONPATH. 
> Conversely, part of shutting-down the environment, eg when you move 
> your attention to a different project, is to remove those references 
> again, ie back to system-settings. Thus, the modification to 
> PYTHONPATH is only temporary.

I knew about activate but I didn't know that the addition to the 
PYTHONPATH is temporary. I suppose it's only a matter of activating a 
new projects environment to deactivate the previous one?

>
> Presumably VS-Codium/e (etc) will offer something equivalent.

Yes it does and it finds a newly created virtual environment 
automagically. I think VS Code is able to change the activation of 
different project environments but I'm a little hazy on the exact 
procedure. It seems that starting VS Code from within a project's 
virtual environment is the easiest option.

-- 
Regards,
Phil



More information about the Tutor mailing list