What is this?

https://s3-us-west-2.amazonaws.com/secure.notion-static.com/70fbc483-4a75-4275-ae63-418825feaf58/adrian-layout.jpg

Horizontal Layout adds a few new tools to Streamlit to make it easier for you to lay out your app! Here's what's coming:

  1. st.beta_container: A single block that permits multiple Streamlit elements
  2. st.beta_columns: Lay out multiple containers of the same width, side-by-side
  3. with column1: st.write("hi!"): Syntax sugar to specify where an element should go
  4. st.beta_expander: Expand/collapse widget, wrapping a single container

(BTW, more layout features will be coming to Streamlit — this is just the first phase!)

Get the beta

TLDR: pip install the nightly build

  1. [OPTIONAL] Set up Pipenv, so that you don't overwrite your normal Streamlit installation

    $ pip install pipenv
    $ pipenv shell
    
  2. Get the latest nightly build

    $ pip install streamlit-nightly
    
  3. Run Streamlit with the new features!

    $ streamlit run my_app.py
    
    # Here's an example you can use:
    $ streamlit run <https://raw.githubusercontent.com/akrolsmir/married-dinosaurs/master/app.py>
    

Deploy to S4A

TLDR: Add streamlit-nightly to your requirements.txt

  1. Create a requirements.txt file in your S4A repo, if it does not exist

  2. In the requirements.txt, add a line with the version of streamlit-nightly used. Make sure the version is 0.67.1.dev20200921 or higher

    Sample requirements.txt

    streamlit-nightly >= 0.67.1.dev20200921
    
  3. Push your repo to Github, and add it in S4A!

Sample directory structure

your-s4a-repo/
    streamlit_app.py
    requirements.txt