• Akasha Peppermint's avatar
    Major project refactoring to resolve import issues: · f57c4fc9
    Akasha Peppermint authored
    This was done due to python being picky about where it loaded modules, so while scripts in submodules would work fine, running a submodule dependency from the parent initiator_set folder would result in ImportErrors. There is no other solution other than messing around with the PYTHONPATH / sys.path etc.
    
    With this change you can have runnable scripts inside the submodules, as as runnable scripts outside the submodules and in other submodules, without having to manually mess around with sys.path in the __init__.py file (granted, for running within submodules you need to have 2 extra lines of code just before you import things from initiator set)
    
    A pip package called repackage helps solve these issues by implementing their own version of a relative import system, which eliminates discrepancies with import with IDE vs command line (IDE manages its own PYTHONPATH)
    
    Pipenv was introduced, we might need it later anyways because of GUI
    
    - Added blank __init__.py to every submodule to let python treat all submodules as packages
    - Blanked out all __init__.py logic, because when importing __init__.py from different locations python does not know which __init__.py file to choose to import
    - Removed any " from __init__.py import * " statements
    - Removed __init__.py from root initiator_set folder (or else python thinks it's a package)
    
    - Added " from repackage import up \n up() " to every test script inside the submodules - this forces python to search modules from the root initiator_set folder and enables runnable code to be located inside packages while having the package code still work outside of it.
    
    - Replaced all import statements to have them all start relative to the initiator_set directory
    - Replaced most wildcard * imports with exact imports. * seems to recursively import.
    
    - Had to change and blank out some file loading logic
    f57c4fc9
To learn more about this project, read the wiki.