Here I leave you a simple procedure to use an IDE (in particular CodeRunner, but for the record that I have nothing to do with it. I use it because it is very comfortable and practical, although this method probably also works in other IDEs) to execute streamlit.
- I install Anaconda Navigator and create a new virtual environment on it. I use Anaconda because in addition to allowing me to create virtual environments comfortably, it also allows me to install streamlit or other packages such as turicreate or keras.
- I start a Mac Terminal from the new Anaconda environment and install streamlit using pip, as indicated on the official page.
- I check that the installation works.
- Now, I open CodeRunner, and in its “Preferences…” I duplicate, in the languages section, Python3 renaming it Streamlit.
- In that new language, in the “Run command” section, I type:
(line 1) eval " (conda shell.bash hook) (line 2) conda activate <virtualenv> (line 3) eval " (streamlit run $ filename)
NOTE: Please remove the (line N) when entering the statements. They are only indicative that there are three lines of code.
6. From now on you can make scripts in python3 that run streamlit and see the result in Safari.
I hope it is useful.