Skip to main content

Streamlit for Jupyter environments

Project description

streamlit-jupyter-magic

A local streamlit server for Jupyter environments, and more.

Installation

pip install streamlit-jupyter-magic

Example

# Cell:
import streamlit_jupyter_magic

# Cell:
%%streamlit 

import streamlit as st

st.title("This is a Test")

if st.button("Click me!"):
    st.button("Click me again!")

Results in the following:

Jupyter Magic Demo

Limitations

  1. Currently doesn't work on colab, due to a couple of colab bugs
  2. To use in multiple notebooks that are open simultaneously, use the --port flag (see below)

Flags

Use any of these flags with %%streamlit FLAGS...

  • --port NUMBER - set the port for streamlit to use; default is 5000
  • --host HOST - set the host for streamlit to use; default is "localhost"
  • --name NAME - set the name (a unique instance id) for this cell app; default uses Jupyter cell ID
  • --width VALUE - set the app width, such as "100%"
  • --height VALUE - set the app height, such as "700px"
  • --use-colab-workaround - on colab, use a window rather than iframe, but still doesn't work (colab bug)

Under the hood

streamlit-jupyter-magic uses streamlit pages to keep memory usage down.

The magic code can be found in: streamlit_jupyter_magic/init.py

The rest of the code is utility code for managing the streamlit server.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

streamlit_jupyter_magic-1.0.3-py3-none-any.whl (9.7 kB view details)

Uploaded Python 3

File details

Details for the file streamlit_jupyter_magic-1.0.3-py3-none-any.whl.

File metadata

File hashes

Hashes for streamlit_jupyter_magic-1.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 8a45bea27dc374b712fd071ee6136b461b66fa172782f382f83e17ea5b7a069b
MD5 2dbcf7d070fe47076320a6afe5647e75
BLAKE2b-256 c23c3fe871ab4751e6181e97aea0df57fb50a3edc298b2c06d4158596604a572

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page