[Tutor] Python project organisation
Phil
phillor9 at gmail.com
Sat Apr 22 19:46:41 EDT 2023
I'm looking suggestions for organising my python projects.
I had, until recently, all of my python projects stored in the one
directory (~/Python), all 298 of them. This has become almost
unmanageable so I split my projects into multiple sub-directories named
Tkinter, Wxpython, etc. and named each project, for example those under
the Tkinter sub-directory, as "tkinter_project_name.py". This is, or
was, better but still not good.
This problem has now come to a head because because my upgraded Linux
distribution now requires the use of virtual environments, otherwise
"pip3 install" fails.
So I created a virtual environment "~/.venv/bleak/bin" named after the
name of the module that I needed to upgrade. It probably should be named
after the project instead. The code for the project is now in that
virtual environment directory which brings me to my question.
Should I create a virtual environment for each project, I don't think
so? If I do, won't that make the PYTHONPATH unwieldy with hundreds of
directories needing to be added to PYTHONPATH? I can see a case where a
project should have it's own environment and that's where a project
includes images that are solely used by that project. At the moment
images and custom classes are all stored under python's global environment.
--
Regards,
Phil
More information about the Tutor
mailing list