byeproduct
byeproduct
Mmarimo
Created by byeproduct on 11/20/2024 in #help-support
Import function from local module
So you guided me down the right path. I ended up converting my folder local_folder into a package using UV init and adding all dependencies in that folder environment. UV automatically added the package to my marimo environment as a workspace tool. I then used `uv pip install -e local_folder/.' to add my created package to marimo. I restarted marimo and it picked up all my functions. UV really made my life so easy. I didn't have to configure anything else. Plus, now I know how to create python packages 👻
9 replies
Mmarimo
Created by byeproduct on 11/20/2024 in #help-support
Import function from local module
Thanks for the feedback. It's weird. I've got the files that you am trying to import into my notebook running in a sub-folder from the directory I am running marimo from. I checked in the terminal and in the notebook using os.getcwd(), and both return the same folder as the working folder.
I just upgraded to marimo 0.9.20, as I thought it may be a version issue, and it still gives me the missing package error when I try to use: from local_folder.my_python_script import my_function Is there a setting I need to enable? I have the default package manager set to UV and I can see all the installed packages. My notebook seems to see my local import from ... import ... as if it needs to be evaluated as a UV package and then finds that it is not installed. Is there a way to swap out the import resolution to prioritise checking if the folder exists first? I have added init.py to both the current working directory and within the folder itself.
9 replies