Python project structure and lib files
satya - 2/6/2024, 10:51:04 PM
Use this for now
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
satya - 2/6/2024, 10:53:41 PM
Then you import as follows
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()
satya - 2/6/2024, 10:54:27 PM
Key format
from baselib import fileutils as fileutils
from baselib import baselog as log
satya - 2/6/2024, 10:55:52 PM
The import means
The import here means;
from <pkg-x> import <file> as x