I have two different packages with the same name, each with a set of modules and classes with the same names as each other but they are implemented differently. What is the most logical manner to set up my package/module structure?
Right now I’m doing something like:
Common
utilities.py
VersionA
Package
moduleX.py
moduleY.py
VersionB
Package
moduleX.py
moduleY.py
I am requiring that the environment where the modules are being used, just set the path to point to the correct version of “Package”.
On top of it, there is one module that both packages share! “Utilities.py”. Now I am also asking the installer to add the Utilties.py to the path.
This is confusing, and feels like a hack. However, I can’t figure out a better way to do it.
Define a globally accessible env variable which you will use to select the version (VersionA,VersionB). Then, in
Common/__init__.pyput:Now whenever you want to use Package in a file you should be able to do:
and you are good to go.