Deploy streamlit in python src layout app

Hi,

is there a way to run app from an installed python app using src layout installed via pip ?

I tried this :

streamlit run my_python_app

in my pyproject.toml, I have the following entrypoint

[project.scripts]
my_python_app = "streamlit run my_python_app.command_line:main"

command_line.py is the file which launch the streamlit code. If I launch it via this command it works locally :

streamlit run src/my_python_app/command_line.py

Do you know any way to do this ?

Thanks,

Hi @fledref

It seems you want to launch a Streamlit app from another script file.

Here’s a simple solution that you can implement by creating a script.py file:

import subprocess

process = subprocess.Popen(["streamlit", "run", 'streamlit_app.py'])

Then in the command line, you can run python script.py and that should launch your Streamlit app. You can also insert os.path.join() into the input argument if your app file is not in the same folder.

Hope this helps!

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.