I am developing using nbdev
and when I build my library from the notebooks I find that the following code in the notebook (which I have needed to use as a work-a-round)
try:
from appname.datapipe import load_and_cache_raw_walk_data, calc_walk_stats
except:
from datapipe import load_and_cache_raw_walk_data, calc_walk_stats
gets converted to (note the DOT in the try version):
try:
from .datapipe import load_and_cache_raw_walk_data, calc_walk_stats
except:
from datapipe import load_and_cache_raw_walk_data, calc_walk_stats
this allows my app to function in both the notebook and app environments (in my case I am writing a Streamlit.io app). Otherwise I just have to edit the .py file each time to remove the dot to make the code work. This seems like an undesirable “hack” - any thoughts on a better approach?
If I leave the dot there I get the error:
ImportError: attempted relative import with no known parent package