Src layout for deployment

Hello! I am attempting to get a streamlit app deployed to the community cloud. Here is the repo. I receive the following error: ModuleNotFoundError: No module named 'life4'. This makes sense - in the src layout, I need to install the current project (uv pip install -e .) so that the paths can resolve.

Is there a way I can tell streamlit to do the same? Or perhaps I need to modify my pyproject.toml? Worst case, I can modify sys.path or edit my project layout, but I’d prefer not to.

Environment:

  • streamlit==1.41.1
  • python==3.11.7

Hi!
Ill clone the repo and try the imports
In the meantime are you familiar with File organization for your Community Cloud app - Streamlit Docs?

Hmm, its definitely not in the structure of the imports… I was able to get it to return some test functions that I added to the ddr and a20 libraries
I am running streamlit run app.py from the top level domain

I even got it to deploy on community cloud be commenting out the stuff I cant access and such
https://ks9t9udgtkverysqesvymc.streamlit.app/
Here is the deployed code - GitHub - 444B/life4-dashboard: Dynamically determine and visualize Life4 requirements

Do you think perhaps the error came from streamlit community cloud not being able to access the module but maybe from the a20 and ddr libraries not being able to access each other?

That might be the case if you are able to get it to work on your laptop in edit mode but I think in an external production setting the __init__.py files need to be bulletproof

So sorry @444B ! I modified the code after posting. I edited sys.path to add src to the python path (see top of: app.py). After doing so, all of the life4 imports are able to work successfully, and the app was able to deploy. I thought there might be a “better” solution, but given this is only a one-liner, I’m content with it for now.

Thank you for looking into!

1 Like

Ah no worries and good luck with your training / competition! I had no idea that DDR had such a vibrant and competitive supporting ecosystem. I guess you learn something new every day :slight_smile:

1 Like