Python project structure and lib files


Here is how you construct a directory structure

****************************
Main files
****************************
main.py
app.py

****************************
Library files
****************************
baselib  
  __init__.py (empty file)
  baselog.py
  fileutils.py 
customllms
   __init__.py
   llm1.py # you can use baselibs here
   llm2.py 

****************************
For this to work
****************************
1. YOu have to have the __init__.py in the sub directory
2. PYTHONPATH=.

The later one is the env variable
It must be set

from baselib import fileutils as fileutils
from baselib import baselog as log

def localTest():
    log.ph1("Starting local test")
    s = fileutils.getTempDataRoot()
    log.dprint(s)
    log.dprint ("End local test")

if __name__ == '__main__':
    localTest()

from baselib import fileutils as fileutils
from baselib import baselog as log

The import here means;
 
from <pkg-x> import <file> as x