Say I have three projects A, B and C in my home directory, all written mainly in Python:
.
├── project_A
│ ├── data
│ ├── plot
│ ├── result
│ └── run.py
├── project_B
│ ├── data
│ ├── plot
│ ├── result
│ └── run.py
└── project_C
├── data
├── plot
├── result
└── run.py
They all have a similar structures: data
, result
and plot
are all directories that contain various scripts.
My question is, if I were to export the paths for each of the projects into PYTHONPATH
like:
export PYTHONPATH=${HOME}/project_A
export PYTHONPATH=${HOME}/project_B:${PYTHONPATH}
export PYTHONPATH=${HOME}/project_C:${PYTHONPATH}
then there will be conflicts/confusions, because all three projects have data
, plot
as well as result
, when I do from data.script import function
, I am not sure if am importing from project A, B or C.
Given that the three projects are independent, can I do the following:
export PYTHONPATH=${HOME}
and in project A, for example, I imagine that I can safely do:
from project_A.data.script import function
Will anything unexpected happen when I put my home directory into PYTHONPATH
?
Is there anything I need to be careful with?
Is this a good practice at all?
If not, what should I be doing instead?
Thanks!