Running Streamlit based app as a package (

Viewed 217

Apologies is this question is not clear enough - let me know and I can provide further details.

I've packaged up a Streamlit based app for a personal project. I've successfully deployed it on TestPyPi. I can install the package on a new environment/ machine - however am unsure how to actually 'run' (or launch) it there?

All of the pre-reqs are installing correctly using the following....

pip install --index-url https://test.pypi.org/simple/ --extra-index-url https://pypi.org/simple interactive-charts-testJan2022b

However once installed if I use >>> from interactive_charts import run_me (which is a .py file that contains the following:)

import sys
from streamlit import cli as stcli

sys.argv = ["streamlit", "run", "basic_app_4.py"]
sys.exit(stcli.main())

The following is returned...

Usage: streamlit run [OPTIONS] TARGET [ARGS]...

Error: Invalid value: File does not exist: basic_app_4.py

Incidentally, I've included a hello_world.py file, which simply prints "Hello world". This works expected i.e. from interactive_charts import hello_world

I guess this is something to do with the relative path of where the package is installed locally i.e. where thebasioc_app_4.py is physically located; and how that's represented in the sys.argv variable? (as when I navigate to where hello_world.py is located in the terminal and then execute the command it works correctly.

I'm just not sure how I can tell it to use the physical location of the installed folder on the local users' machine?

Any ideas or work arounds would be gratefully received.

Any and all suggestions are welcome. TIA

0 Answers
Related