Skip to content

Major project refactoring to resolve import issues:

Akasha Peppermint requested to merge akasha_pip into master

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

Merge request reports