filename
stringlengths
24
54
content
stringlengths
819
44.7k
Prep_and_deploy_your_app_on_Community_Cloud___Stre.txt
Prep and deploy your app on Community Cloud - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app remove File organization App dependencies Secrets management Deploy! Manage your app add Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Deploy your app Prep and deploy your app on Community Cloud Streamlit Community Cloud lets you deploy your apps in just one click, and most apps will be deployed in only a few minutes. If you don't have an app ready to deploy, you can fork or clone one from our App gallery —you can find apps for machine learning, data visualization, data exploration, A/B testing, and more. You can also Deploy an app from a template . After you've deployed your app, check out how you can Edit your app with GitHub Codespaces . push_pin Note If you want to deploy your app on a different cloud service, see our Deployment tutorials . Summary The pages that follow explain how to organize your app and provide complete information for Community Cloud to run it correctly. When your app has everything it needs, deploying is easy. Just go to your workspace and click " Create app " in the upper-right corner. Follow the prompts to fill in your app's information, and then click " Deploy ." Ready, set, go! description File organization. Learn how Community Cloud initializes your app and interprets paths. Learn where to put your configuration files. build_circle App dependencies. Learn how to install dependencies and other Python libraries into your deployment environment. password Secrets management. Learn about the interface Community Cloud provides to securely upload your secrets.toml data. flight_takeoff Deploy your app Put it all together to deploy your app for the whole world to see. Previous: Get started Next: File organization forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.empty_-_Streamlit_Docs.txt
st.empty - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers remove st.columns st.container st.dialog link st.empty st.expander st.form link st.popover st.sidebar st.tabs Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Layouts and containers / st.empty st.empty Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Insert a single-element container. Inserts a container into your app that can be used to hold a single element. This allows you to, for example, remove elements at any point, or replace several elements at once (using a child multi-element container). To insert/replace/clear an element on the returned container, you can use with notation or just call methods directly on the returned object. See examples below. Function signature [source] st.empty() Examples Inside a with st.empty(): block, each displayed element will replace the previous one. import streamlit as st import time with st.empty(): for seconds in range(10): st.write(f"⏳ {seconds} seconds have passed") time.sleep(1) st.write(":material/check: 10 seconds over!") st.button("Rerun") Built with Streamlit 🎈 Fullscreen open_in_new You can use an st.empty to replace multiple elements in succession. Use st.container inside st.empty to display (and later replace) a group of elements. import streamlit as st import time st.button("Start over") placeholder = st.empty() placeholder.markdown("Hello") time.sleep(1) placeholder.progress(0, "Wait for it...") time.sleep(1) placeholder.progress(50, "Wait for it...") time.sleep(1) placeholder.progress(100, "Wait for it...") time.sleep(1) with placeholder.container(): st.line_chart({"data": [1, 5, 2, 6]}) time.sleep(1) st.markdown("3...") time.sleep(1) st.markdown("2...") time.sleep(1) st.markdown("1...") time.sleep(1) placeholder.markdown("Poof!") time.sleep(1) placeholder.empty() Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.dialog Next: st.expander forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Publish_a_Component_-_Streamlit_Docs.txt
Publish a Component - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components remove Intro to custom components Create a Component Publish a Component Limitations Component gallery open_in_new Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Custom components / Publish a Component Publish a Component Publish to PyPI Publishing your Streamlit Component to PyPI makes it easily accessible to Python users around the world. This step is completely optional, so if you won’t be releasing your component publicly, you can skip this section! push_pin Note For static Streamlit Components , publishing a Python package to PyPI follows the same steps as the core PyPI packaging instructions . A static Component likely contains only Python code, so once you have your setup.py file correct and generate your distribution files , you're ready to upload to PyPI . Bi-directional Streamlit Components at minimum include both Python and JavaScript code, and as such, need a bit more preparation before they can be published on PyPI. The remainder of this page focuses on the bi-directional Component preparation process. Prepare your Component A bi-directional Streamlit Component varies slightly from a pure Python library in that it must contain pre-compiled frontend code. This is how base Streamlit works as well; when you pip install streamlit , you are getting a Python library where the HTML and frontend code contained within it have been compiled into static assets. The component-template GitHub repo provides the folder structure necessary for PyPI publishing. But before you can publish, you'll need to do a bit of housekeeping: Give your Component a name, if you haven't already Rename the template/my_component/ folder to template/<component name>/ Pass your component's name as the the first argument to declare_component() Edit MANIFEST.in , change the path for recursive-include from package/frontend/build * to <component name>/frontend/build * Edit setup.py , adding your component's name and other relevant info Create a release build of your frontend code. This will add a new directory, frontend/build/ , with your compiled frontend in it: cd frontend npm run build Pass the build folder's path as the path parameter to declare_component . (If you're using the template Python file, you can set _RELEASE = True at the top of the file): import streamlit.components.v1 as components # Change this: # component = components.declare_component("my_component", url="http://localhost:3001") # To this: parent_dir = os.path.dirname(os.path.abspath(__file__)) build_dir = os.path.join(parent_dir, "frontend/build") component = components.declare_component("new_component_name", path=build_dir) Build a Python wheel Once you've changed the default my_component references, compiled the HTML and JavaScript code and set your new component name in components.declare_component() , you're ready to build a Python wheel: Make sure you have the latest versions of setuptools, wheel, and twine Create a wheel from the source code: # Run this from your component's top-level directory; that is, # the directory that contains `setup.py` python setup.py sdist bdist_wheel Upload your wheel to PyPI With your wheel created, the final step is to upload to PyPI. The instructions here highlight how to upload to Test PyPI , so that you can learn the mechanics of the process without worrying about messing anything up. Uploading to PyPI follows the same basic procedure. Create an account on Test PyPI if you don't already have one Visit https://test.pypi.org/account/register/ and complete the steps Visit https://test.pypi.org/manage/account/#api-tokens and create a new API token. Don’t limit the token scope to a particular project, since you are creating a new project. Copy your token before closing the page, as you won’t be able to retrieve it again. Upload your wheel to Test PyPI. twine will prompt you for a username and password. For the username, use __token__ . For the password, use your token value from the previous step, including the pypi- prefix: python -m twine upload --repository testpypi dist/* Install your newly-uploaded package in a new Python project to make sure it works: python -m pip install --index-url https://test.pypi.org/simple/ --no-deps example-pkg-YOUR-USERNAME-HERE If all goes well, you're ready to upload your library to PyPI by following the instructions at https://packaging.python.org/tutorials/packaging-projects/#next-steps . Congratulations, you've created a publicly-available Streamlit Component! Promote your Component! We'd love to help you share your Component with the Streamlit Community! To share it: If you host your code on GitHub, add the tag streamlit-component , so that it's listed in the GitHub streamlit-component topic : Add the streamlit-component tag to your GitHub repo Post on the Streamlit Forum in Show the Community! . Use a post title similar to "New Component: <your component name> , a new way to do X". Add your component to the Community Component Tracker . Tweet us at @streamlit so that we can retweet your announcement for you. Our Components Gallery is updated approximately every month. Follow the above recommendations to maximize the liklihood of your component landing in our Components Gallery. Community Components featured in our docs are hand-curated on a less-regular basis. Popular components with many stars and good documentation are more likely to be selected. Previous: Create a Component Next: Limitations forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Embed_your_app_-_Streamlit_Docs.txt
Embed your app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app add Share your app remove Embed your app Search indexability Share previews Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Share your app / Embed your app Embed your app Embedding Streamlit Community Cloud apps enriches your content by integrating interactive, data-driven applications directly within your pages. Whether you're writing a blog post, a technical document, or sharing resources on platforms like Medium, Notion, or even StackOverflow, embedding Streamlit apps adds a dynamic component to your content. This allows your audience to interact with your ideas, rather than merely reading about them or looking at screenshots. Streamlit Community Cloud supports both iframe and oEmbed methods for embedding public apps. This flexibility enables you to share your apps across a wide array of platforms, broadening your app's visibility and impact. In this guide, we'll cover how to use both methods effectively to share your Streamlit apps with the world. Embedding with iframes Streamlit Community Cloud supports embedding public apps using the subdomain scheme. To embed a public app, add the query parameter /?embed=true to the end of the *.streamlit.app URL. For example, say you want to embed the 30DaysOfStreamlit app . The URL to include in your iframe is: https://30days.streamlit.app/?embed=true : <iframe src="https://30days.streamlit.app?embed=true" style="height: 450px; width: 100%;" ></iframe> Built with Streamlit 🎈 Fullscreen open_in_new priority_high Important There will be no official support for embedding private apps. In addition to allowing you to embed apps via iframes, the ?embed=true query parameter also does the following: Removes the toolbar with the app menu icon ( more_vert ). Removes the padding at the top and bottom of the app. Removes the footer. Removes the colored line from the top of the app. For granular control over the embedding behavior, Streamlit allows you to specify one or more instances of the ?embed_options query parameter (e.g. to show the toolbar, open the app in dark theme, etc). Click here for a full list of Embed options. Embedding with oEmbed Streamlit's oEmbed support allows for a simpler embedding experience. You can directly drop a Streamlit app's URL into a Medium, Ghost, or Notion page (or any of more than 700 content providers that supports oEmbed or embed.ly ). The embedded app will automatically appear! This helps Streamlit Community Cloud apps seamlessly integrate into these platforms, improving the visibility and accessibility of your apps. Example When creating content in a Notion page, Medium article, or Ghost blog, you only need to paste the app's URL and hit " Enter ." The app will then render automatically at that spot in your content. You can use your undecorated app URL without the ?embed=true query parameter. https://30days.streamlit.app/ Here's an example of @chrieke 's Prettymapp app embedded in a Medium article: star Tip Ensure the platform hosting the embedded Streamlit app supports oEmbed or embed.ly . Key Sites for oEmbed oEmbed should work out of the box for several platforms including but not limited to: Medium Notion Looker Tableau Ghost Discourse StackOverflow W3 Reddit Please check the specific platform's documentation to verify support for oEmbed. iframe versus oEmbed The only noteworthy differences between the methods is that iframing allows you to customize the app's embedding behavior (e.g. showing the toolbar, opening the app in dark theme, etc) using the various ?embed_options described in the next section. Embed options When Embedding with iframes , Streamlit allows you to specify one or more instances of the ?embed_options query parameter for granular control over the embedding behavior. Both ?embed and ?embed_options are invisible to st.query_params and its precursors, st.experimental_get_query_params and st.experimental_set_query_params . You can't get or set their values. The supported values for ?embed_options are listed below: Show the toolbar at the top right of the app which includes the app menu ( more_vert ), running man, and link to GitHub. /?embed=true&embed_options=show_toolbar Show padding at the top and bottom of the app. /?embed=true&embed_options=show_padding Show the footer reading "Made with Streamlit." (This doesn't apply to Streamlit versions 1.29.0 and later since the footer was removed from the library.) /?embed=true&embed_options=show_footer Show the colored line at the top of the app. /?embed=true&embed_options=show_colored_line Hide the "skeleton" that appears while an app is loading. /?embed=true&embed_options=hide_loading_screen Disable scrolling for the main body of the app. (The sidebar will still be scrollable.) /?embed=true&embed_options=disable_scrolling Open the app with light theme. /?embed=true&embed_options=light_theme Open the app with dark theme. /?embed=true&embed_options=dark_theme You can also combine the params: /?embed=true&embed_options=show_toolbar&embed_options=show_padding&embed_options=show_footer&embed_options=show_colored_line&embed_options=disable_scrolling Build an embed link You can conveniently build an embed link for your app — right from your app! From your app at <your-custom-subdomain>.streamlit.app , click " Share " in the upper-right corner. Click " Embed " to access a list of selectable embed options. Select your embed options and click " Get embed link " to copy the embed link to your clipboard. Previous: Share your app Next: Search indexability forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Share_your_app_-_Streamlit_Docs.txt
Share your app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app add Share your app remove Embed your app Search indexability Share previews Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Share your app Share your app Now that your app is deployed you can easily share it and collaborate on it. But first, let's take a moment and do a little joy dance for getting that app deployed! 🕺💃 Your app is now live at a fixed URL, so go wild and share it with whomever you want. Your app will inherit permissions from your GitHub repo, meaning that if your repo is private your app will be private and if your repo is public your app will be public. If you want to change that you can simply do so from the app settings menu. You are only allowed one private app at a time. If you've deployed from a private repository, you will have to make that app public or delete it before you can deploy another app from a private repository. Only developers can change your app between public and private. Make your app public or private Share your public app Share your private app Make your app public or private If you deployed your app from a public repository, your app will be public by default. If you deployed your app from a private repository, you will need to make the app public if you want to freely share it with the community at large. Set privacy from your app settings Access your App settings and go to the " Sharing " section. Set your app's privacy under "Who can view this app." Select " This app is public and searchable " to make your app public. Select " Only specific people can view this app " to make your app private. Set privacy from the share button From your app at <your-custom-subdomain>.streamlit.app , click " Share " in the upper-right corner. Toggle your app between public and private by clicking " Make this app public ." Share your public app Once your app is public, just give anyone your app's URL and they view it! Streamlit Community Cloud has several convenient shortcuts for sharing your app. Share your app on social media From your app at <your-custom-subdomain>.streamlit.app , click " Share " in the upper-right corner. Click " Social " to access convenient social media share buttons. star Tip Use the social media sharing buttons to post your app on our forum! We'd love to see what you make and perhaps feature your app as our app of the month. 💖 Invite viewers by email Whether your app is public or private, you can send an email invite to your app directly from Streamlit Community Cloud. This grants the viewer access to analytics for all your public apps and the ability to invite other viewers to your workspace. Developers and invited viewers are identified by their email in analytics instead of appearing anonymously (if they view any of your apps while signed in). Read more about viewers in App analytics . From your app at <your-custom-subdomain>.streamlit.app , click " Share " in the upper-right corner. Enter an email address and click " Invite ." Invited users will get a direct link to your app in their inbox. Copy your app's URL From your app click " Share " in the upper-right corner then click " Copy link ." Add a badge to your GitHub repository To help others find and play with your Streamlit app, you can add Streamlit's GitHub badge to your repo. Below is an enlarged example of what the badge looks like. Clicking on the badge takes you to—in this case—Streamlit's Roadmap. Once you deploy your app, you can embed this badge right into your GitHub README.md by adding the following Markdown: [![Streamlit App](https://static.streamlit.io/badges/streamlit_badge_black_white.svg)](https://<your-custom-subdomain>.streamlit.app) push_pin Note Be sure to replace https://<your-custom-subdomain>.streamlit.app with the URL of your deployed app! Share your private app By default an app deployed from a private repository will be private to the developers in the workspace. A private app will not be visible to anyone else unless you grant them explicit permission. You can grant permission by adding them as a developer on GitHub or by adding them as a viewer on Streamlit Community Cloud. Once you have added someone's email address to your app's viewer list, that person will be able to sign in and view your private app. If their email is associated with a Google account, they will be able to sign in with Google OAuth. Otherwise, they will be able to sign in with single-use, emailed links. Streamlit sends an email invitation with a link to your app every time you invite someone. priority_high Important When you add a viewer to any app in your workspace, they are granted access to analytics for that app as well as analytics for all your public apps. They can also pass these permissions to others by inviting more viewers. All viewers and developers in your workspace are identified by their email in analytics. Furthermore, their emails show in analytics for every app in your workspace and not just apps they are explicitly invited to. Read more about viewers in App analytics Invite viewers from the share button From your app at <your-custom-subdomain>.streamlit.app , click " Share " in the upper-right corner. Enter the email to send an invitation to and click " Invite ." Invited users appear in the list below. Invited users will get a direct link to your app in their inbox. To remove a viewer, simply access the share menu as above and click the close next to their name. Invite viewers from your app settings Access your App settings and go to the " Sharing " section. Add or remove users from the list of viewers. Click " Save ." Previous: Manage your app Next: Embed your app forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.info_-_Streamlit_Docs.txt
st.info - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements remove CALLOUTS st.success st.info st.warning st.error st.exception OTHER st.progress st.spinner st.status st.toast st.balloons st.snow Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Status elements / st.info st.info Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display an informational message. Function signature [source] st.info(body, *, icon=None) Parameters body (str) The info text to display. icon (str, None) An optional emoji or icon to display next to the alert. If icon is None (default), no icon is displayed. If icon is a string, the following options are valid: A single-character emoji. For example, you can set icon="🚨" or icon="🔥" . Emoji short codes are not supported. An icon from the Material Symbols library (rounded style) in the format ":material/icon_name:" where "icon_name" is the name of the icon in snake case. For example, icon=":material/thumb_up:" will display the Thumb Up icon. Find additional icons in the Material Symbols font library. Example import streamlit as st st.info('This is a purely informational message', icon="ℹ️") Previous: st.success Next: st.warning forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
FAQ_-_Streamlit_Docs.txt
FAQ - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Knowledge base / FAQ FAQ Here are some frequently asked questions about using Streamlit. If you feel something important is missing that everyone needs to know, please open an issue or submit a pull request and we'll be happy to review it! Sanity checks How can I make Streamlit watch for changes in other modules I'm importing in my app? What browsers does Streamlit support? Where does st.file_uploader store uploaded files and when do they get deleted? How do you retrieve the filename of a file uploaded with st.file_uploader? How to remove "· Streamlit" from the app title? How to download a file in Streamlit? How to download a Pandas DataFrame as a CSV? How can I make st.pydeck_chart use custom Mapbox styles? How to insert elements out of order? How do I upgrade to the latest version of Streamlit? Widget updating for every second input when using session state How do I create an anchor link? How do I enable camera access? Why does Streamlit restrict nested st.columns ? What is serializable session state? Previous: Knowledge base Next: How do I create an anchor link? forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.text_area_-_Streamlit_Docs.txt
st.text_area - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets / st.text_area st.text_area Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a multi-line text input widget. Function signature [source] st.text_area(label, value="", height=None, max_chars=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility="visible") Parameters label (str) A short label explaining to the user what this input is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. value (object or None) The text value of this widget when it first renders. This will be cast to str internally. If None , will initialize empty and return None until the user provides input. Defaults to empty string. height (int or None) Desired height of the UI element expressed in pixels. If this is None (default), the widget's initial height fits three lines. The height must be at least 68 pixels, which fits two lines. max_chars (int or None) Maximum number of characters allowed in text area. key (str or int) An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help (str) An optional tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible" . on_change (callable) An optional callback invoked when this text_area's value changes. args (tuple) An optional tuple of args to pass to the callback. kwargs (dict) An optional dict of kwargs to pass to the callback. placeholder (str or None) An optional string displayed when the text area is empty. If None, no text is displayed. disabled (bool) An optional boolean that disables the text area if set to True . The default is False . label_visibility ("visible", "hidden", or "collapsed") The visibility of the label. The default is "visible" . If this is "hidden" , Streamlit displays an empty spacer instead of the label, which can help keep the widget alligned with other widgets. If this is "collapsed" , Streamlit displays no label or spacer. Returns (str or None) The current value of the text area widget or None if no value has been provided by the user. Example import streamlit as st txt = st.text_area( "Text to analyze", "It was the best of times, it was the worst of times, it was the age of " "wisdom, it was the age of foolishness, it was the epoch of belief, it " "was the epoch of incredulity, it was the season of Light, it was the " "season of Darkness, it was the spring of hope, it was the winter of " "despair, (...)", ) st.write(f"You wrote {len(txt)} characters.") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.chat_input Next: st.text_input forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Using_custom_Python_classes_in_your_Streamlit_app_.txt
Using custom Python classes in your Streamlit app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design remove Animate & update elements Button behavior and examples Dataframes Using custom classes Working with timezones ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / App design / Using custom classes Using custom Python classes in your Streamlit app If you are building a complex Streamlit app or working with existing code, you may have custom Python classes defined in your script. Common examples include the following: Defining a @dataclass to store related data within your app. Defining an Enum class to represent a fixed set of options or values. Defining custom interfaces to external services or databases not covered by st.connection . Because Streamlit reruns your script after every user interaction, custom classes may be redefined multiple times within the same Streamlit session. This may result in unwanted effects, especially with class and instance comparisons. Read on to understand this common pitfall and how to avoid it. We begin by covering some general-purpose patterns you can use for different types of custom classes, and follow with a few more technical details explaining why this matters. Finally, we go into more detail about Using Enum classes specifically, and describe a configuration option which can make them more convenient. Patterns to define your custom classes Pattern 1: Define your class in a separate module This is the recommended, general solution. If possible, move class definitions into their own module file and import them into your app script. As long as you are not editing the files that define your app, Streamlit will not re-import those classes with each rerun. Therefore, if a class is defined in an external file and imported into your script, the class will not be redefined during the session, unless you are actively editing your app. Example: Move your class definition Try running the following Streamlit app where MyClass is defined within the page's script. isinstance() will return True on the first script run then return False on each rerun thereafter. # app.py import streamlit as st # MyClass gets redefined every time app.py reruns class MyClass: def __init__(self, var1, var2): self.var1 = var1 self.var2 = var2 if "my_instance" not in st.session_state: st.session_state.my_instance = MyClass("foo", "bar") # Displays True on the first run then False on every rerun st.write(isinstance(st.session_state.my_instance, MyClass)) st.button("Rerun") If you move the class definition out of app.py into another file, you can make isinstance() consistently return True . Consider the following file structure: myproject/ ├── my_class.py └── app.py # my_class.py class MyClass: def __init__(self, var1, var2): self.var1 = var1 self.var2 = var2 # app.py import streamlit as st from my_class import MyClass # MyClass doesn't get redefined with each rerun if "my_instance" not in st.session_state: st.session_state.my_instance = MyClass("foo", "bar") # Displays True on every rerun st.write(isinstance(st.session_state.my_instance, MyClass)) st.button("Rerun") Streamlit only reloads code in imported modules when it detects the code has changed. Thus, if you are actively editing your app code, you may need to start a new session or restart your Streamlit server to avoid an undesirable class redefinition. Pattern 2: Force your class to compare internal values For classes that store data (like dataclasses ), you may be more interested in comparing the internally stored values rather than the class itself. If you define a custom __eq__ method, you can force comparisons to be made on the internally stored values. Example: Define __eq__ Try running the following Streamlit app and observe how the comparison is True on the first run then False on every rerun thereafter. import streamlit as st from dataclasses import dataclass @dataclass class MyDataclass: var1: int var2: float if "my_dataclass" not in st.session_state: st.session_state.my_dataclass = MyDataclass(1, 5.5) # Displays True on the first run the False on every rerun st.session_state.my_dataclass == MyDataclass(1, 5.5) st.button("Rerun") Since MyDataclass gets redefined with each rerun, the instance stored in Session State will not be equal to any instance defined in a later script run. You can fix this by forcing a comparison of internal values as follows: import streamlit as st from dataclasses import dataclass @dataclass class MyDataclass: var1: int var2: float def __eq__(self, other): # An instance of MyDataclass is equal to another object if the object # contains the same fields with the same values return (self.var1, self.var2) == (other.var1, other.var2) if "my_dataclass" not in st.session_state: st.session_state.my_dataclass = MyDataclass(1, 5.5) # Displays True on every rerun st.session_state.my_dataclass == MyDataclass(1, 5.5) st.button("Rerun") The default Python __eq__ implementation for a regular class or @dataclass depends on the in-memory ID of the class or class instance. To avoid problems in Streamlit, your custom __eq__ method should not depend the type() of self and other . Pattern 3: Store your class as serialized data Another option for classes that store data is to define serialization and deserialization methods like to_str and from_str for your class. You can use these to store class instance data in st.session_state rather than storing the class instance itself. Similar to pattern 2, this is a way to force comparison of the internal data and bypass the changing in-memory IDs. Example: Save your class instance as a string Using the same example from pattern 2, this can be done as follows: import streamlit as st from dataclasses import dataclass @dataclass class MyDataclass: var1: int var2: float def to_str(self): return f"{self.var1},{self.var2}" @classmethod def from_str(cls, serial_str): values = serial_str.split(",") var1 = int(values[0]) var2 = float(values[1]) return cls(var1, var2) if "my_dataclass" not in st.session_state: st.session_state.my_dataclass = MyDataclass(1, 5.5).to_str() # Displays True on every rerun MyDataclass.from_str(st.session_state.my_dataclass) == MyDataclass(1, 5.5) st.button("Rerun") Pattern 4: Use caching to preserve your class For classes that are used as resources (database connections, state managers, APIs), consider using the cached singleton pattern. Use @st.cache_resource to decorate a @staticmethod of your class to generate a single, cached instance of the class. For example: import streamlit as st class MyResource: def __init__(self, api_url: str): self._url = api_url @st.cache_resource(ttl=300) @staticmethod def get_resource_manager(api_url: str): return MyResource(api_url) # This is cached until Session State is cleared or 5 minutes has elapsed. resource_manager = MyResource.get_resource_manager("http://example.com/api/") When you use one of Streamlit's caching decorators on a function, Streamlit doesn't use the function object to look up cached values. Instead, Streamlit's caching decorators index return values using the function's qualified name and module. So, even though Streamlit redefines MyResource with each script run, st.cache_resource is unaffected by this. get_resource_manager() will return its cached value with each rerun, until the value expires. Understanding how Python defines and compares classes So what's really happening here? We'll consider a simple example to illustrate why this is a pitfall. Feel free to skip this section if you don't want to deal more details. You can jump ahead to learn about Using Enum classes . Example: What happens when you define the same class twice? Set aside Streamlit for a moment and think about this simple Python script: from dataclasses import dataclass @dataclass class Student: student_id: int name: str Marshall_A = Student(1, "Marshall") Marshall_B = Student(1, "Marshall") # This is True (because a dataclass will compare two of its instances by value) Marshall_A == Marshall_B # Redefine the class @dataclass class Student: student_id: int name: str Marshall_C = Student(1, "Marshall") # This is False Marshall_A == Marshall_C In this example, the dataclass Student is defined twice. All three Marshalls have the same internal values. If you compare Marshall_A and Marshall_B they will be equal because they were both created from the first definition of Student . However, if you compare Marshall_A and Marshall_C they will not be equal because Marshall_C was created from the second definition of Student . Even though both Student dataclasses are defined exactly the same, they have different in-memory IDs and are therefore different. What's happening in Streamlit? In Streamlit, you probably don't have the same class written twice in your page script. However, the rerun logic of Streamlit creates the same effect. Let's use the above example for an analogy. If you define a class in one script run and save an instance in Session State, then a later rerun will redefine the class and you may end up comparing a Mashall_C in your rerun to a Marshall_A in Session State. Since widgets rely on Session State under the hood, this is where things can get confusing. How Streamlit widgets store options Several Streamlit UI elements, such as st.selectbox or st.radio , accept multiple-choice options via an options argument. The user of your application can typically select one or more of these options. The selected value is returned by the widget function. For example: number = st.selectbox("Pick a number, any number", options=[1, 2, 3]) # number == whatever value the user has selected from the UI. When you call a function like st.selectbox and pass an Iterable to options , the Iterable and current selection are saved into a hidden portion of Session State called the Widget Metadata. When the user of your application interacts with the st.selectbox widget, the broswer sends the index of their selection to your Streamlit server. This index is used to determine which values from the original options list, saved in the Widget Metadata from the previous page execution , are returned to your application. The key detail is that the value returned by st.selectbox (or similar widget function) is from an Iterable saved in Session State during a previous execution of the page, NOT the values passed to options on the current execution. There are a number of architectural reasons why Streamlit is designed this way, which we won't go into here. However, this is how we end up comparing instances of different classes when we think we are comparing instances of the same class. A pathological example The above explanation might be a bit confusing, so here's a pathological example to illustrate the idea. import streamlit as st from dataclasses import dataclass @dataclass class Student: student_id: int name: str Marshall_A = Student(1, "Marshall") if "B" not in st.session_state: st.session_state.B = Student(1, "Marshall") Marshall_B = st.session_state.B options = [Marshall_A,Marshall_B] selected = st.selectbox("Pick", options) # This comparison does not return expected results: selected == Marshall_A # This comparison evaluates as expected: selected == Marshall_B As a final note, we used @dataclass in the example for this section to illustrate a point, but in fact it is possible to encounter these same problems with classes, in general. Any class which checks class identity inside of a comparison operator—such as __eq__ or __gt__ —can exhibit these issues. Using Enum classes in Streamlit The Enum class from the Python standard library is a powerful way to define custom symbolic names that can be used as options for st.multiselect or st.selectbox in place of str values. For example, you might add the following to your streamlit page: from enum import Enum import streamlit as st # class syntax class Color(Enum): RED = 1 GREEN = 2 BLUE = 3 selected_colors = set(st.multiselect("Pick colors", options=Color)) if selected_colors == {Color.RED, Color.GREEN}: st.write("Hooray, you found the color YELLOW!") If you're using the latest version of Streamlit, this Streamlit page will work as it appears it should. When a user picks both Color.RED and Color.GREEN , they are shown the special message. However, if you've read the rest of this page you might notice something tricky going on. Specifically, the Enum class Color gets redefined every time this script is run. In Python, if you define two Enum classes with the same class name, members, and values, the classes and their members are still considered unique from each other. This should cause the above if condition to always evaluate to False . In any script rerun, the Color values returned by st.multiselect would be of a different class than the Color defined in that script run. If you run the snippet above with Streamlit version 1.28.0 or less, you will not be able see the special message. Thankfully, as of version 1.29.0, Streamlit introduced a configuration option to greatly simplify the problem. That's where the enabled-by-default enumCoercion configuration option comes in. Understanding the enumCoercion configuration option When enumCoercion is enabled, Streamlit tries to recognize when you are using an element like st.multiselect or st.selectbox with a set of Enum members as options. If Streamlit detects this, it will convert the widget's returned values to members of the Enum class defined in the latest script run. This is something we call automatic Enum coercion. This behavior is configurable via the enumCoercion setting in your Streamlit config.toml file. It is enabled by default, and may be disabled or set to a stricter set of matching criteria. If you find that you still encounter issues with enumCoercion enabled, consider using the custom class patterns described above, such as moving your Enum class definition to a separate module file. Previous: Dataframes Next: Working with timezones forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_Streamlit_to_TigerGraph___Streamlit_Docs_9.txt
Connect Streamlit to TigerGraph - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources / TigerGraph Connect Streamlit to TigerGraph Introduction This guide explains how to securely access a TigerGraph database from Streamlit Community Cloud. It uses the pyTigerGraph library and Streamlit's Secrets management . Create a TigerGraph Cloud Database First, follow the official tutorials to create a TigerGraph instance in TigerGraph Cloud, either as a blog or a video . Note your username, password, and subdomain. For this tutorial, we will be using the COVID-19 starter kit. When setting up your solution, select the “COVID-19 Analysis" option. Once it is started, ensure your data is downloaded and queries are installed. Add username and password to your local app secrets Your local Streamlit app will read secrets from a file .streamlit/secrets.toml in your app’s root directory. Create this file if it doesn’t exist yet and add your TigerGraph Cloud instance username, password, graph name, and subdomain as shown below: # .streamlit/secrets.toml [tigergraph] host = "https://xxx.i.tgcloud.io/" username = "xxx" password = "xxx" graphname = "xxx" priority_high Important Add this file to .gitignore and don't commit it to your GitHub repo! Copy your app secrets to the cloud As the secrets.toml file above is not committed to GitHub, you need to pass its content to your deployed app (on Streamlit Community Cloud) separately. Go to the app dashboard and in the app's dropdown menu, click on Edit Secrets. Copy the content of secrets.toml into the text area. More information is available at Secrets management . Add PyTigerGraph to your requirements file Add the pyTigerGraph package to your requirements.txt file, preferably pinning its version (replace x.x.x with the version you want installed): # requirements.txt pyTigerGraph==x.x.x Write your Streamlit app Copy the code below to your Streamlit app and run it. Make sure to adapt the name of your graph and query. # streamlit_app.py import streamlit as st import pyTigerGraph as tg # Initialize connection. conn = tg.TigerGraphConnection(**st.secrets["tigergraph"]) conn.apiToken = conn.getToken(conn.createSecret()) # Pull data from the graph by running the "mostDirectInfections" query. # Uses st.cache_data to only rerun when the query changes or after 10 min. @st.cache_data(ttl=600) def get_data(): most_infections = conn.runInstalledQuery("mostDirectInfections")[0]["Answer"][0] return most_infections["v_id"], most_infections["attributes"] items = get_data() # Print results. st.title(f"Patient {items[0]} has the most direct infections") for key, val in items[1].items(): st.write(f"Patient {items[0]}'s {key} is {val}.") See st.cache_data above? Without it, Streamlit would run the query every time the app reruns (e.g. on a widget interaction). With st.cache_data , it only runs when the query changes or after 10 minutes (that's what ttl is for). Watch out: If your database updates more frequently, you should adapt ttl or remove caching so viewers always see the latest data. Learn more in Caching . If everything worked out (and you used the example data we created above), your app should look like this: Previous: TiDB Next: Multipage apps forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Chart_elements_-_Streamlit_Docs.txt
Chart elements - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements remove SIMPLE st.area_chart st.bar_chart st.line_chart st.map st.scatter_chart ADVANCED st.altair_chart st.bokeh_chart st.graphviz_chart st.plotly_chart st.pydeck_chart st.pyplot st.vega_lite_chart Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Chart elements Chart elements Streamlit supports several different charting libraries, and our goal is to continually add support for more. Right now, the most basic library in our arsenal is Matplotlib . Then there are also interactive charting libraries like Vega Lite (2D charts) and deck.gl (maps and 3D charts). And finally we also provide a few chart types that are "native" to Streamlit, like st.line_chart and st.area_chart . Simple chart elements Simple area charts Display an area chart. st.area_chart(my_data_frame) Simple bar charts Display a bar chart. st.bar_chart(my_data_frame) Simple line charts Display a line chart. st.line_chart(my_data_frame) Simple scatter charts Display a line chart. st.scatter_chart(my_data_frame) Scatterplots on maps Display a map with points on it. st.map(my_data_frame) Advanced chart elements Matplotlib Display a matplotlib.pyplot figure. st.pyplot(my_mpl_figure) Altair Display a chart using the Altair library. st.altair_chart(my_altair_chart) Vega-Lite Display a chart using the Vega-Lite library. st.vega_lite_chart(my_vega_lite_chart) Plotly Display an interactive Plotly chart. st.plotly_chart(my_plotly_chart) Bokeh Display an interactive Bokeh chart. st.bokeh_chart(my_bokeh_chart) PyDeck Display a chart using the PyDeck library. st.pydeck_chart(my_pydeck_chart) GraphViz Display a graph using the dagre-d3 library. st.graphviz_chart(my_graphviz_spec) Third-party components These are featured components created by our lovely community. For more examples and inspiration, check out our Components Gallery and Streamlit Extras ! Previous Streamlit Lottie Integrate Lottie animations inside your Streamlit app. Created by @andfanilo . lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") st_lottie(lottie_hello, key="hello") Plotly Events Make Plotly charts interactive!. Created by @null-jones . fig = px.line(x=[1], y=[1]) selected_points = plotly_events(fig) Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) st.altair_chart(chart, use_container_width=True) Plost A deceptively simple plotting library for Streamlit. Created by @tvst . import plost plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) HiPlot High dimensional Interactive Plotting. Created by @facebookresearch . data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] hip.Experiment.from_iterable(data).display() ECharts High dimensional Interactive Plotting. Created by @andfanilo . from streamlit_echarts import st_echarts st_echarts(options=options) Streamlit Folium Streamlit Component for rendering Folium maps. Created by @randyzwitch . m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) st_data = st_folium(m, width=725) Spacy-Streamlit spaCy building blocks and visualizers for Streamlit apps. Created by @explosion . models = ["en_core_web_sm", "en_core_web_md"] spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") Streamlit Agraph A Streamlit Graph Vis, based on react-grah-vis . Created by @ChrisDelClea . from streamlit_agraph import agraph, Node, Edge, Config agraph(nodes=nodes, edges=edges, config=config) Streamlit Lottie Integrate Lottie animations inside your Streamlit app. Created by @andfanilo . lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") st_lottie(lottie_hello, key="hello") Plotly Events Make Plotly charts interactive!. Created by @null-jones . fig = px.line(x=[1], y=[1]) selected_points = plotly_events(fig) Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) st.altair_chart(chart, use_container_width=True) Plost A deceptively simple plotting library for Streamlit. Created by @tvst . import plost plost.line_chart(my_dataframe, x='time', y='stock_value', color='stock_name',) HiPlot High dimensional Interactive Plotting. Created by @facebookresearch . data = [{'dropout':0.1, 'lr': 0.001, 'loss': 10.0, 'optimizer': 'SGD'}, {'dropout':0.15, 'lr': 0.01, 'loss': 3.5, 'optimizer': 'Adam'}, {'dropout':0.3, 'lr': 0.1, 'loss': 4.5, 'optimizer': 'Adam'}] hip.Experiment.from_iterable(data).display() ECharts High dimensional Interactive Plotting. Created by @andfanilo . from streamlit_echarts import st_echarts st_echarts(options=options) Streamlit Folium Streamlit Component for rendering Folium maps. Created by @randyzwitch . m = folium.Map(location=[39.949610, -75.150282], zoom_start=16) st_data = st_folium(m, width=725) Spacy-Streamlit spaCy building blocks and visualizers for Streamlit apps. Created by @explosion . models = ["en_core_web_sm", "en_core_web_md"] spacy_streamlit.visualize(models, "Sundar Pichai is the CEO of Google.") Streamlit Agraph A Streamlit Graph Vis, based on react-grah-vis . Created by @ChrisDelClea . from streamlit_agraph import agraph, Node, Edge, Config agraph(nodes=nodes, edges=edges, config=config) Streamlit Lottie Integrate Lottie animations inside your Streamlit app. Created by @andfanilo . lottie_hello = load_lottieurl("https://assets5.lottiefiles.com/packages/lf20_V9t630.json") st_lottie(lottie_hello, key="hello") Plotly Events Make Plotly charts interactive!. Created by @null-jones . fig = px.line(x=[1], y=[1]) selected_points = plotly_events(fig) Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . chart += get_annotations_chart(annotations=[("Mar 01, 2008", "Pretty good day for GOOG"), ("Dec 01, 2007", "Something's going wrong for GOOG & AAPL"), ("Nov 01, 2008", "Market starts again thanks to..."), ("Dec 01, 2009", "Small crash for GOOG after..."),],) st.altair_chart(chart, use_container_width=True) Next Previous: Data elements Next: st.area_chart forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.form_-_Streamlit_Docs.txt
st.form - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow remove st.dialog st.form st.form_submit_button st.fragment st.rerun st.stop Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Execution flow / st.form star Tip This page only contains information on the st.forms API. For a deeper dive into creating and using forms within Streamlit apps, read our guide on Using forms . st.form Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Create a form that batches elements together with a "Submit" button. A form is a container that visually groups other elements and widgets together, and contains a Submit button. When the form's Submit button is pressed, all widget values inside the form will be sent to Streamlit in a batch. To add elements to a form object, you can use with notation (preferred) or just call methods directly on the form. See examples below. Forms have a few constraints: Every form must contain a st.form_submit_button . st.button and st.download_button cannot be added to a form. Forms can appear anywhere in your app (sidebar, columns, etc), but they cannot be embedded inside other forms. Within a form, the only widget that can have a callback function is st.form_submit_button . Function signature [source] st.form(key, clear_on_submit=False, *, enter_to_submit=True, border=True) Parameters key (str) A string that identifies the form. Each form must have its own key. (This key is not displayed to the user in the interface.) clear_on_submit (bool) If True, all widgets inside the form will be reset to their default values after the user presses the Submit button. Defaults to False. (Note that Custom Components are unaffected by this flag, and will not be reset to their defaults on form submission.) enter_to_submit (bool) Whether to submit the form when a user presses Enter while interacting with a widget inside the form. If this is True (default), pressing Enter while interacting with a form widget is equivalent to clicking the first st.form_submit_button in the form. If this is False , the user must click an st.form_submit_button to submit the form. If the first st.form_submit_button in the form is disabled, the form will override submission behavior with enter_to_submit=False . border (bool) Whether to show a border around the form. Defaults to True. Note Not showing a border can be confusing to viewers since interacting with a widget in the form will do nothing. You should only remove the border if there's another border (e.g. because of an expander) or the form is small (e.g. just a text input and a submit button). Examples Inserting elements using with notation: import streamlit as st with st.form("my_form"): st.write("Inside the form") slider_val = st.slider("Form slider") checkbox_val = st.checkbox("Form checkbox") # Every form must have a submit button. submitted = st.form_submit_button("Submit") if submitted: st.write("slider", slider_val, "checkbox", checkbox_val) st.write("Outside the form") Built with Streamlit 🎈 Fullscreen open_in_new Inserting elements out of order: import streamlit as st form = st.form("my_form") form.slider("Inside the form") st.slider("Outside the form") # Now add a submit button to the form: form.form_submit_button("Submit") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.dialog Next: st.form_submit_button forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.status_-_Streamlit_Docs.txt
st.status - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements remove CALLOUTS st.success st.info st.warning st.error st.exception OTHER st.progress st.spinner st.status st.toast st.balloons st.snow Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Status elements / st.status st.status Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Insert a status container to display output from long-running tasks. Inserts a container into your app that is typically used to show the status and details of a process or task. The container can hold multiple elements and can be expanded or collapsed by the user similar to st.expander . When collapsed, all that is visible is the status icon and label. The label, state, and expanded state can all be updated by calling .update() on the returned object. To add elements to the returned container, you can use with notation (preferred) or just call methods directly on the returned object. By default, st.status() initializes in the "running" state. When called using with notation, it automatically updates to the "complete" state at the end of the "with" block. See examples below for more details. Function signature [source] st.status(label, *, expanded=False, state="running") Parameters label (str) The initial label of the status container. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. expanded (bool) If True, initializes the status container in "expanded" state. Defaults to False (collapsed). state ("running", "complete", or "error") The initial state of the status container which determines which icon is shown: running (default): A spinner icon is shown. complete : A checkmark icon is shown. error : An error icon is shown. Returns (StatusContainer) A mutable status container that can hold multiple elements. The label, state, and expanded state can be updated after creation via .update() . Examples You can use the with notation to insert any element into an status container: import time import streamlit as st with st.status("Downloading data..."): st.write("Searching for data...") time.sleep(2) st.write("Found URL.") time.sleep(1) st.write("Downloading data...") time.sleep(1) st.button("Rerun") Built with Streamlit 🎈 Fullscreen open_in_new You can also use .update() on the container to change the label, state, or expanded state: import time import streamlit as st with st.status("Downloading data...", expanded=True) as status: st.write("Searching for data...") time.sleep(2) st.write("Found URL.") time.sleep(1) st.write("Downloading data...") time.sleep(1) status.update( label="Download complete!", state="complete", expanded=False ) st.button("Rerun") Built with Streamlit 🎈 Fullscreen open_in_new StatusContainer.update Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Update the status container. Only specified arguments are updated. Container contents and unspecified arguments remain unchanged. Function signature [source] StatusContainer.update(*, label=None, expanded=None, state=None) Parameters label (str or None) A new label of the status container. If None, the label is not changed. expanded (bool or None) The new expanded state of the status container. If None, the expanded state is not changed. state ("running", "complete", "error", or None) The new state of the status container. This mainly changes the icon. If None, the state is not changed. Previous: st.spinner Next: st.toast forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Rename_or_change_your_app_s_GitHub_coordinates___S.txt
Rename or change your app's GitHub coordinates - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app remove App analytics App settings Delete your app Edit your app Favorite your app Reboot your app Rename your app in GitHub Upgrade Python Upgrade Streamlit Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Manage your app / Rename your app in GitHub Rename or change your app's GitHub coordinates Streamlit Community Cloud identifies apps by their GitHub coordinates (owner, repository, branch, entrypoint file path). If you move or rename one of these coordinates without preparation, you will lose access to administer any associated app. Delete, rename, redeploy If you need to rename your repository, move your entrypoint file, or otherwise change a deployed app's GitHub coordinates, do the following: Delete your app. Make your desired changes in GitHub. Redeploy your app. Regain access when you've already made changes to your app's GitHub coordinates If you have changed a repository so that Community Cloud can no longer find your app on GitHub, your app will be missing or shown as view-only. View-only means that you can't edit, reboot, delete, or view settings for your app. You can only access analytics. You may be able to regain control as follows: Revert the change you made to your app so that Community Cloud can see the owner, repository, branch, and entrypoint file it expects. Sign out of Community Cloud and GitHub. Sign back in to Community Cloud and GitHub. If you have regained access, delete your app. Proceed with your original change, and redeploy your app. If this does not restore access to your app, please contact Snowflake support for assistance. They can delete your disconnected apps so you can redeploy them. For the quickest help, please provide a complete list of your affected apps by URL. Previous: Reboot your app Next: Upgrade Python forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Add_statefulness_to_apps_-_Streamlit_Docs.txt
Add statefulness to apps - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution remove Running your app Streamlit's architecture The app chrome Caching Session State Forms Fragments Widget behavior Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Architecture & execution / Session State Add statefulness to apps What is State? We define access to a Streamlit app in a browser tab as a session . For each browser tab that connects to the Streamlit server, a new session is created. Streamlit reruns your script from top to bottom every time you interact with your app. Each reruns takes place in a blank slate: no variables are shared between runs. Session State is a way to share variables between reruns, for each user session. In addition to the ability to store and persist state, Streamlit also exposes the ability to manipulate state using Callbacks. Session state also persists across pages inside a multipage app . In this guide, we will illustrate the usage of Session State and Callbacks as we build a stateful Counter app. For details on the Session State and Callbacks API, please refer to our Session State API Reference Guide . Also, check out this Session State basics tutorial video by Streamlit Developer Advocate Dr. Marisa Smith to get started: Build a Counter Let's call our script counter.py . It initializes a count variable and has a button to increment the value stored in the count variable: import streamlit as st st.title('Counter Example') count = 0 increment = st.button('Increment') if increment: count += 1 st.write('Count = ', count) No matter how many times we press the Increment button in the above app, the count remains at 1. Let's understand why: Each time we press the Increment button, Streamlit reruns counter.py from top to bottom, and with every run, count gets initialized to 0 . Pressing Increment subsequently adds 1 to 0, thus count=1 no matter how many times we press Increment . As we'll see later, we can avoid this issue by storing count as a Session State variable. By doing so, we're indicating to Streamlit that it should maintain the value stored inside a Session State variable across app reruns. Let's learn more about the API to use Session State. Initialization The Session State API follows a field-based API, which is very similar to Python dictionaries: import streamlit as st # Check if 'key' already exists in session_state # If not, then initialize it if 'key' not in st.session_state: st.session_state['key'] = 'value' # Session State also supports the attribute based syntax if 'key' not in st.session_state: st.session_state.key = 'value' Reads and updates Read the value of an item in Session State by passing the item to st.write : import streamlit as st if 'key' not in st.session_state: st.session_state['key'] = 'value' # Reads st.write(st.session_state.key) # Outputs: value Update an item in Session State by assigning it a value: import streamlit as st if 'key' not in st.session_state: st.session_state['key'] = 'value' # Updates st.session_state.key = 'value2' # Attribute API st.session_state['key'] = 'value2' # Dictionary like API Streamlit throws an exception if an uninitialized variable is accessed: import streamlit as st st.write(st.session_state['value']) # Throws an exception! Let's now take a look at a few examples that illustrate how to add Session State to our Counter app. Example 1: Add Session State Now that we've got a hang of the Session State API, let's update our Counter app to use Session State: import streamlit as st st.title('Counter Example') if 'count' not in st.session_state: st.session_state.count = 0 increment = st.button('Increment') if increment: st.session_state.count += 1 st.write('Count = ', st.session_state.count) As you can see in the above example, pressing the Increment button updates the count each time. Example 2: Session State and Callbacks Now that we've built a basic Counter app using Session State, let's move on to something a little more complex. The next example uses Callbacks with Session State. Callbacks : A callback is a Python function which gets called when an input widget changes. Callbacks can be used with widgets using the parameters on_change (or on_click ), args , and kwargs . The full Callbacks API can be found in our Session State API Reference Guide . import streamlit as st st.title('Counter Example using Callbacks') if 'count' not in st.session_state: st.session_state.count = 0 def increment_counter(): st.session_state.count += 1 st.button('Increment', on_click=increment_counter) st.write('Count = ', st.session_state.count) Now, pressing the Increment button updates the count each time by calling the increment_counter() function. Example 3: Use args and kwargs in Callbacks Callbacks also support passing arguments using the args parameter in a widget: import streamlit as st st.title('Counter Example using Callbacks with args') if 'count' not in st.session_state: st.session_state.count = 0 increment_value = st.number_input('Enter a value', value=0, step=1) def increment_counter(increment_value): st.session_state.count += increment_value increment = st.button('Increment', on_click=increment_counter, args=(increment_value, )) st.write('Count = ', st.session_state.count) Additionally, we can also use the kwargs parameter in a widget to pass named arguments to the callback function as shown below: import streamlit as st st.title('Counter Example using Callbacks with kwargs') if 'count' not in st.session_state: st.session_state.count = 0 def increment_counter(increment_value=0): st.session_state.count += increment_value def decrement_counter(decrement_value=0): st.session_state.count -= decrement_value st.button('Increment', on_click=increment_counter, kwargs=dict(increment_value=5)) st.button('Decrement', on_click=decrement_counter, kwargs=dict(decrement_value=1)) st.write('Count = ', st.session_state.count) Example 4: Forms and Callbacks Say we now want to not only increment the count , but also store when it was last updated. We illustrate doing this using Callbacks and st.form : import streamlit as st import datetime st.title('Counter Example') if 'count' not in st.session_state: st.session_state.count = 0 st.session_state.last_updated = datetime.time(0,0) def update_counter(): st.session_state.count += st.session_state.increment_value st.session_state.last_updated = st.session_state.update_time with st.form(key='my_form'): st.time_input(label='Enter the time', value=datetime.datetime.now().time(), key='update_time') st.number_input('Enter a value', value=0, step=1, key='increment_value') submit = st.form_submit_button(label='Update', on_click=update_counter) st.write('Current Count = ', st.session_state.count) st.write('Last Updated = ', st.session_state.last_updated) Advanced concepts Session State and Widget State association Session State provides the functionality to store variables across reruns. Widget state (i.e. the value of a widget) is also stored in a session. For simplicity, we have unified this information in one place. i.e. the Session State. This convenience feature makes it super easy to read or write to the widget's state anywhere in the app's code. Session State variables mirror the widget value using the key argument. We illustrate this with the following example. Let's say we have an app with a slider to represent temperature in Celsius. We can set and get the value of the temperature widget by using the Session State API, as follows: import streamlit as st if "celsius" not in st.session_state: # set the initial default value of the slider widget st.session_state.celsius = 50.0 st.slider( "Temperature in Celsius", min_value=-100.0, max_value=100.0, key="celsius" ) # This will get the value of the slider widget st.write(st.session_state.celsius) There is a limitation to setting widget values using the Session State API. priority_high Important Streamlit does not allow setting widget values via the Session State API for st.button and st.file_uploader . The following example will raise a StreamlitAPIException on trying to set the state of st.button via the Session State API: import streamlit as st if 'my_button' not in st.session_state: st.session_state.my_button = True # Streamlit will raise an Exception on trying to set the state of button st.button('Submit', key='my_button') Serializable Session State Serialization refers to the process of converting an object or data structure into a format that can be persisted and shared, and allowing you to recover the data’s original structure. Python’s built-in pickle module serializes Python objects to a byte stream ("pickling") and deserializes the stream into an object ("unpickling"). By default, Streamlit’s Session State allows you to persist any Python object for the duration of the session, irrespective of the object’s pickle-serializability. This property lets you store Python primitives such as integers, floating-point numbers, complex numbers and booleans, dataframes, and even lambdas returned by functions. However, some execution environments may require serializing all data in Session State, so it may be useful to detect incompatibility during development, or when the execution environment will stop supporting it in the future. To that end, Streamlit provides a runner.enforceSerializableSessionState configuration option that, when set to true , only allows pickle-serializable objects in Session State. To enable the option, either create a global or project config file with the following or use it as a command-line flag: # .streamlit/config.toml [runner] enforceSerializableSessionState = true By " pickle-serializable ", we mean calling pickle.dumps(obj) should not raise a PicklingError exception. When the config option is enabled, adding unserializable data to session state should result in an exception. E.g., import streamlit as st def unserializable_data(): return lambda x: x #👇 results in an exception when enforceSerializableSessionState is on st.session_state.unserializable = unserializable_data() priority_high Warning When runner.enforceSerializableSessionState is set to true , Session State implicitly uses the pickle module, which is known to be insecure. Ensure all data saved and retrieved from Session State is trusted because it is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. Only load data you trust . Caveats and limitations Here are some limitations to keep in mind when using Session State: Session State exists for as long as the tab is open and connected to the Streamlit server. As soon as you close the tab, everything stored in Session State is lost. Session State is not persisted. If the Streamlit server crashes, then everything stored in Session State gets wiped For caveats and limitations with the Session State API, please see the API limitations . Previous: Caching Next: Forms forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.code_-_Streamlit_Docs.txt
st.code - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements remove HEADINGS & BODY st.title st.header st.subheader st.markdown FORMATTED TEXT st.caption st.code st.divider st.echo st.latex st.text UTILITIES st.html link Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Text elements / st.code st.code Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a code block with optional syntax highlighting. Function signature [source] st.code(body, language="python", *, line_numbers=False, wrap_lines=False) Parameters body (str) The string to display as code or monospace text. language (str or None) The language that the code is written in, for syntax highlighting. This defaults to "python" . If this is None , the code will be plain, monospace text. For a list of available language values, see react-syntax-highlighter on GitHub. line_numbers (bool) An optional boolean indicating whether to show line numbers to the left of the code block. This defaults to False . wrap_lines (bool) An optional boolean indicating whether to wrap lines. This defaults to False . Examples import streamlit as st code = '''def hello(): print("Hello, Streamlit!")''' st.code(code, language="python") Built with Streamlit 🎈 Fullscreen open_in_new import streamlit as st code = '''Is it a crown or boat? ii iiiiii WWw .iiiiiiii. ...: WWWWWWw .iiiiiiiiiiii. ........ WWWWWWWWWWw iiiiiiiiiiiiiiii ........... WWWWWWWWWWWWWWwiiiiiiiiiiiiiiiii............ WWWWWWWWWWWWWWWWWWwiiiiiiiiiiiiii......... WWWWWWWWWWWWWWWWWWWWWWwiiiiiiiiii....... WWWWWWWWWWWWWWWWWWWWWWWWWWwiiiiiii.... WWWWWWWWWWWWWWWWWWWWWWWWWWWWWWwiiii. -MMMWWWWWWWWWWWWWWWWWWWWWWMMM- ''' st.code(code, language=None) Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.caption Next: st.divider forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.plotly_chart_-_Streamlit_Docs.txt
st.plotly_chart - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements remove SIMPLE st.area_chart st.bar_chart st.line_chart st.map st.scatter_chart ADVANCED st.altair_chart st.bokeh_chart st.graphviz_chart st.plotly_chart st.pydeck_chart st.pyplot st.vega_lite_chart Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Chart elements / st.plotly_chart st.plotly_chart Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display an interactive Plotly chart. Plotly is a charting library for Python. The arguments to this function closely follow the ones for Plotly's plot() function. To show Plotly charts in Streamlit, call st.plotly_chart wherever you would call Plotly's py.plot or py.iplot . Important You must install plotly to use this command. Your app's performance may be enhanced by installing orjson as well. Function signature [source] st.plotly_chart(figure_or_data, use_container_width=False, *, theme="streamlit", key=None, on_select="ignore", selection_mode=('points', 'box', 'lasso'), **kwargs) Parameters figure_or_data (plotly.graph_objs.Figure, plotly.graph_objs.Data, or dict/list of plotly.graph_objs.Figure/Data) The Plotly Figure or Data object to render. See https://plot.ly/python/ for examples of graph descriptions. use_container_width (bool) Whether to override the figure's native width with the width of the parent container. If use_container_width is False (default), Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. If use_container_width is True , Streamlit sets the width of the figure to match the width of the parent container. theme ("streamlit" or None) The theme of the chart. If theme is "streamlit" (default), Streamlit uses its own design default. If theme is None , Streamlit falls back to the default behavior of the library. key (str) An optional string to use for giving this element a stable identity. If key is None (default), this element's identity will be determined based on the values of the other parameters. Additionally, if selections are activated and key is provided, Streamlit will register the key in Session State to store the selection state. The selection state is read-only. on_select ("ignore" or "rerun" or callable) How the figure should respond to user selection events. This controls whether or not the figure behaves like an input widget. on_select can be one of the following: "ignore" (default): Streamlit will not react to any selection events in the chart. The figure will not behave like an input widget. "rerun" : Streamlit will rerun the app when the user selects data in the chart. In this case, st.plotly_chart will return the selection data as a dictionary. A callable : Streamlit will rerun the app and execute the callable as a callback function before the rest of the app. In this case, st.plotly_chart will return the selection data as a dictionary. selection_mode ("points", "box", "lasso" or an Iterable of these) The selection mode of the chart. This can be one of the following: "points" : The chart will allow selections based on individual data points. "box" : The chart will allow selections based on rectangular areas. "lasso" : The chart will allow selections based on freeform areas. An Iterable of the above options: The chart will allow selections based on the modes specified. All selections modes are activated by default. **kwargs (null) Any argument accepted by Plotly's plot() function. Returns (element or dict) If on_select is "ignore" (default), this command returns an internal placeholder for the chart element. Otherwise, this command returns a dictionary-like object that supports both key and attribute notation. The attributes are described by the PlotlyState dictionary schema. Example The example below comes straight from the examples at https://plot.ly/python . Note that plotly.figure_factory requires scipy to run. import streamlit as st import numpy as np import plotly.figure_factory as ff # Add histogram data x1 = np.random.randn(200) - 2 x2 = np.random.randn(200) x3 = np.random.randn(200) + 2 # Group data together hist_data = [x1, x2, x3] group_labels = ['Group 1', 'Group 2', 'Group 3'] # Create distplot with custom bin_size fig = ff.create_distplot( hist_data, group_labels, bin_size=[.1, .25, .5]) # Plot! st.plotly_chart(fig, use_container_width=True) Built with Streamlit 🎈 Fullscreen open_in_new Chart selections PlotlyState Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake The schema for the Plotly chart event state. The event state is stored in a dictionary-like object that supports both key and attribute notation. Event states cannot be programmatically changed or set through Session State. Only selection events are supported at this time. Attributes selection (dict) The state of the on_select event. This attribute returns a dictionary-like object that supports both key and attribute notation. The attributes are described by the PlotlySelectionState dictionary schema. Example Try selecting points by any of the three available methods (direct click, box, or lasso). The current selection state is available through Session State or as the output of the chart function. import streamlit as st import plotly.express as px df = px.data.iris() # iris is a pandas DataFrame fig = px.scatter(df, x="sepal_width", y="sepal_length") event = st.plotly_chart(fig, key="iris", on_select="rerun") event Built with Streamlit 🎈 Fullscreen open_in_new PlotlySelectionState Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake The schema for the Plotly chart selection state. The selection state is stored in a dictionary-like object that supports both key and attribute notation. Selection states cannot be programmatically changed or set through Session State. Attributes points (list[dict[str, Any]]) The selected data points in the chart, including the data points selected by the box and lasso mode. The data includes the values associated to each point and a point index used to populate point_indices . If additional information has been assigned to your points, such as size or legend group, this is also included. point_indices (list[int]) The numerical indices of all selected data points in the chart. The details of each identified point are included in points . box (list[dict[str, Any]]) The metadata related to the box selection. This includes the coordinates of the selected area. lasso (list[dict[str, Any]]) The metadata related to the lasso selection. This includes the coordinates of the selected area. Example When working with more complicated graphs, the points attribute displays additional information. Try selecting points in the following example: import streamlit as st import plotly.express as px df = px.data.iris() fig = px.scatter( df, x="sepal_width", y="sepal_length", color="species", size="petal_length", hover_data=["petal_width"], ) event = st.plotly_chart(fig, key="iris", on_select="rerun") event.selection Built with Streamlit 🎈 Fullscreen open_in_new This is an example of the selection state when selecting a single point: { "points": [ { "curve_number": 2, "point_number": 9, "point_index": 9, "x": 3.6, "y": 7.2, "customdata": [ 2.5 ], "marker_size": 6.1, "legendgroup": "virginica" } ], "point_indices": [ 9 ], "box": [], "lasso": [] } Theming Plotly charts are displayed using the Streamlit theme by default. This theme is sleek, user-friendly, and incorporates Streamlit's color palette. The added benefit is that your charts better integrate with the rest of your app's design. The Streamlit theme is available from Streamlit 1.16.0 through the theme="streamlit" keyword argument. To disable it, and use Plotly's native theme, use theme=None instead. Let's look at an example of charts with the Streamlit theme and the native Plotly theme: import plotly.express as px import streamlit as st df = px.data.gapminder() fig = px.scatter( df.query("year==2007"), x="gdpPercap", y="lifeExp", size="pop", color="continent", hover_name="country", log_x=True, size_max=60, ) tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"]) with tab1: # Use the Streamlit theme. # This is the default. So you can also omit the theme argument. st.plotly_chart(fig, theme="streamlit", use_container_width=True) with tab2: # Use the native Plotly theme. st.plotly_chart(fig, theme=None, use_container_width=True) Click the tabs in the interactive app below to see the charts with the Streamlit theme enabled and disabled. Built with Streamlit 🎈 Fullscreen open_in_new If you're wondering if your own customizations will still be taken into account, don't worry! You can still make changes to your chart configurations. In other words, although we now enable the Streamlit theme by default, you can overwrite it with custom colors or fonts. For example, if you want a chart line to be green instead of the default red, you can do it! Here's an example of an Plotly chart where a custom color scale is defined and reflected: import plotly.express as px import streamlit as st st.subheader("Define a custom colorscale") df = px.data.iris() fig = px.scatter( df, x="sepal_width", y="sepal_length", color="sepal_length", color_continuous_scale="reds", ) tab1, tab2 = st.tabs(["Streamlit theme (default)", "Plotly native theme"]) with tab1: st.plotly_chart(fig, theme="streamlit", use_container_width=True) with tab2: st.plotly_chart(fig, theme=None, use_container_width=True) Notice how the custom color scale is still reflected in the chart, even when the Streamlit theme is enabled 👇 Built with Streamlit 🎈 Fullscreen open_in_new For many more examples of Plotly charts with and without the Streamlit theme, check out the plotly.streamlit.app . Previous: st.graphviz_chart Next: st.pydeck_chart forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Deployment_Issues_-_Streamlit_Docs.txt
Deployment Issues - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Knowledge base / Deployment issues Deployment-related questions and errors How do I deploy Streamlit on a domain so it appears to run on a regular port (i.e. port 80)? How can I deploy multiple Streamlit apps on different subdomains? Invoking a Python subprocess in a deployed Streamlit app Does Streamlit support the WSGI Protocol? (aka Can I deploy Streamlit with gunicorn?) Argh. This app has gone over its resource limits. App is not loading when running remotely Authentication without SSO How do I increase the upload limit of st.file_uploader on Streamlit Community Cloud? Huh. This is isn't supposed to happen message after trying to log in Login attempt to Streamlit Community Cloud fails with error 403 How to submit a support case for Streamlit Community Cloud Previous: Installing dependencies Next: Authentication without SSO forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.testing.v1.AppTest_-_Streamlit_Docs.txt
st.testing.v1.AppTest - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing remove st.testing.v1.AppTest Testing element classes Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / App testing / st.testing.v1.AppTest The AppTest class st.testing.v1.AppTest Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake A simulated Streamlit app to check the correctness of displayed elements and outputs. An instance of AppTest simulates a running Streamlit app. This class provides methods to set up, manipulate, and inspect the app contents via API instead of a browser UI. It can be used to write automated tests of an app in various scenarios. These can then be run using a tool like pytest. AppTest can be initialized by one of three class methods: st.testing.v1.AppTest.from_file (recommended) st.testing.v1.AppTest.from_string st.testing.v1.AppTest.from_function Once initialized, Session State and widget values can be updated and the script can be run. Unlike an actual live-running Streamlit app, you need to call AppTest.run() explicitly to re-run the app after changing a widget value. Switching pages also requires an explicit, follow-up call to AppTest.run() . AppTest enables developers to build tests on their app as-is, in the familiar python test format, without major refactoring or abstracting out logic to be tested separately from the UI. Tests can run quickly with very low overhead. A typical pattern is to build a suite of tests for an app that ensure consistent functionality as the app evolves, and run the tests locally and/or in a CI environment like Github Actions. Note AppTest only supports testing a single page of an app per instance. For multipage apps, each page will need to be tested separately. AppTest is not yet compatible with multipage apps using st.navigation and st.Page . Class description [source] st.testing.v1.AppTest(script_path, *, default_timeout, args=None, kwargs=None) Methods get (element_type) Get elements or widgets of the specified type. run (*, timeout=None) Run the script from the current state. switch_page (page_path) Switch to another page of the app. Attributes secrets (dict[str, Any]) Dictionary of secrets to be used the simulated app. Use dict-like syntax to set secret values for the simulated app. session_state (SafeSessionState) Session State for the simulated app. SafeSessionState object supports read and write operations as usual for Streamlit apps. query_params (dict[str, Any]) Dictionary of query parameters to be used by the simluated app. Use dict-like syntax to set query_params values for the simulated app. button Sequence of all st.button and st.form_submit_button widgets. button_group Sequence of all st.feedback widgets. caption Sequence of all st.caption elements. chat_input Sequence of all st.chat_input widgets. chat_message Sequence of all st.chat_message elements. checkbox Sequence of all st.checkbox widgets. code Sequence of all st.code elements. color_picker Sequence of all st.color_picker widgets. columns Sequence of all columns within st.columns elements. dataframe Sequence of all st.dataframe elements. date_input Sequence of all st.date_input widgets. divider Sequence of all st.divider elements. error Sequence of all st.error elements. exception Sequence of all st.exception elements. expander Sequence of all st.expander elements. header Sequence of all st.header elements. info Sequence of all st.info elements. json Sequence of all st.json elements. latex Sequence of all st.latex elements. main Sequence of elements within the main body of the app. markdown Sequence of all st.markdown elements. metric Sequence of all st.metric elements. multiselect Sequence of all st.multiselect widgets. number_input Sequence of all st.number_input widgets. radio Sequence of all st.radio widgets. select_slider Sequence of all st.select_slider widgets. selectbox Sequence of all st.selectbox widgets. sidebar Sequence of all elements within st.sidebar . slider Sequence of all st.slider widgets. status Sequence of all st.status elements. subheader Sequence of all st.subheader elements. success Sequence of all st.success elements. table Sequence of all st.table elements. tabs Sequence of all tabs within st.tabs elements. text Sequence of all st.text elements. text_area Sequence of all st.text_area widgets. text_input Sequence of all st.text_input widgets. time_input Sequence of all st.time_input widgets. title Sequence of all st.title elements. toast Sequence of all st.toast elements. toggle Sequence of all st.toggle widgets. warning Sequence of all st.warning elements. Initialize a simulated app using AppTest AppTest.from_file Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Create an instance of AppTest to simulate an app page defined within a file. This option is most convenient for CI workflows and testing of published apps. The script must be executable on its own and so must contain all necessary imports. Function signature [source] AppTest.from_file(cls, script_path, *, default_timeout=3) Parameters script_path (str | Path) Path to a script file. The path should be absolute or relative to the file calling .from_file . default_timeout (float) Default time in seconds before a script run is timed out. Can be overridden for individual .run() calls. Returns (AppTest) A simulated Streamlit app for testing. The simulated app can be executed via .run() . AppTest.from_string Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Create an instance of AppTest to simulate an app page defined within a string. This is useful for testing short scripts that fit comfortably as an inline string in the test itself, without having to create a separate file for it. The script must be executable on its own and so must contain all necessary imports. Function signature [source] AppTest.from_string(cls, script, *, default_timeout=3) Parameters script (str) The string contents of the script to be run. default_timeout (float) Default time in seconds before a script run is timed out. Can be overridden for individual .run() calls. Returns (AppTest) A simulated Streamlit app for testing. The simulated app can be executed via .run() . AppTest.from_function Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Create an instance of AppTest to simulate an app page defined within a function. This is similar to AppTest.from_string() , but more convenient to write with IDE assistance. The script must be executable on its own and so must contain all necessary imports. Function signature [source] AppTest.from_function(cls, script, *, default_timeout=3, args=None, kwargs=None) Parameters script (Callable) A function whose body will be used as a script. Must be runnable in isolation, so it must include any necessary imports. default_timeout (float) Default time in seconds before a script run is timed out. Can be overridden for individual .run() calls. args (tuple) An optional tuple of args to pass to the script function. kwargs (dict) An optional dict of kwargs to pass to the script function. Returns (AppTest) A simulated Streamlit app for testing. The simulated app can be executed via .run() . Run an AppTest script AppTest.run Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Run the script from the current state. This is equivalent to manually rerunning the app or the rerun that occurs upon user interaction. AppTest.run() must be manually called after updating a widget value or switching pages as script reruns do not occur automatically as they do for live-running Streamlit apps. Function signature [source] AppTest.run(*, timeout=None) Parameters timeout (float or None) The maximum number of seconds to run the script. If timeout is None (default), Streamlit uses the default timeout set for the instance of AppTest . Returns (AppTest) self AppTest.switch_page Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Switch to another page of the app. This method does not automatically rerun the app. Use a follow-up call to AppTest.run() to obtain the elements on the selected page. Function signature [source] AppTest.switch_page(page_path) Parameters page_path (str) Path of the page to switch to. The path must be relative to the main script's location (e.g. "pages/my_page.py" ). Returns (AppTest) self Get AppTest script elements The main value of AppTest is providing an API to programmatically inspect and interact with the elements and widgets produced by a running Streamlit app. Using the AppTest.<element type> properties or AppTest.get() method returns a collection of all the elements or widgets of the specified type that would have been displayed by running the app. Note that you can also retrieve elements within a specific container in the same way - first retrieve the container, then retrieve the elements just in that container. AppTest.get Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Get elements or widgets of the specified type. This method returns the collection of all elements or widgets of the specified type on the current page. Retrieve a specific element by using its index (order on page) or key lookup. Function signature [source] AppTest.get(element_type) Parameters element_type (str) An element attribute of AppTest . For example, "button", "caption", or "chat_input". Returns (Sequence of Elements) Sequence of elements of the given type. Individual elements can be accessed from a Sequence by index (order on the page). When getting and element_type that is a widget, individual widgets can be accessed by key. For example, at.get("text")[0] for the first st.text element or at.get("slider")(key="my_key") for the st.slider widget with a given key. AppTest.button Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.button and st.form_submit_button widgets. Function signature [source] AppTest.button Returns (WidgetList of Button) Sequence of all st.button and st.form_submit_button widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.button[0] for the first widget or at.button(key="my_key") for a widget with a given key. AppTest.caption Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.caption elements. Function signature [source] AppTest.caption Returns (ElementList of Caption) Sequence of all st.caption elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.caption[0] for the first element. Caption is an extension of the Element class. AppTest.chat_input Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.chat_input widgets. Function signature [source] AppTest.chat_input Returns (WidgetList of ChatInput) Sequence of all st.chat_input widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.chat_input[0] for the first widget or at.chat_input(key="my_key") for a widget with a given key. AppTest.chat_message Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.chat_message elements. Function signature [source] AppTest.chat_message Returns (Sequence of ChatMessage) Sequence of all st.chat_message elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.chat_message[0] for the first element. ChatMessage is an extension of the Block class. AppTest.checkbox Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.checkbox widgets. Function signature [source] AppTest.checkbox Returns (WidgetList of Checkbox) Sequence of all st.checkbox widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.checkbox[0] for the first widget or at.checkbox(key="my_key") for a widget with a given key. AppTest.code Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.code elements. Function signature [source] AppTest.code Returns (ElementList of Code) Sequence of all st.code elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.code[0] for the first element. Code is an extension of the Element class. AppTest.color_picker Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.color_picker widgets. Function signature [source] AppTest.color_picker Returns (WidgetList of ColorPicker) Sequence of all st.color_picker widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.color_picker[0] for the first widget or at.color_picker(key="my_key") for a widget with a given key. AppTest.columns Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all columns within st.columns elements. Each column within a single st.columns will be returned as a separate Column in the Sequence. Function signature [source] AppTest.columns Returns (Sequence of Column) Sequence of all columns within st.columns elements. Individual columns can be accessed from an ElementList by index (order on the page). For example, at.columns[0] for the first column. Column is an extension of the Block class. AppTest.dataframe Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.dataframe elements. Function signature [source] AppTest.dataframe Returns (ElementList of Dataframe) Sequence of all st.dataframe elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.dataframe[0] for the first element. Dataframe is an extension of the Element class. AppTest.date_input Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.date_input widgets. Function signature [source] AppTest.date_input Returns (WidgetList of DateInput) Sequence of all st.date_input widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.date_input[0] for the first widget or at.date_input(key="my_key") for a widget with a given key. AppTest.divider Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.divider elements. Function signature [source] AppTest.divider Returns (ElementList of Divider) Sequence of all st.divider elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.divider[0] for the first element. Divider is an extension of the Element class. AppTest.error Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.error elements. Function signature [source] AppTest.error Returns (ElementList of Error) Sequence of all st.error elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.error[0] for the first element. Error is an extension of the Element class. AppTest.exception Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.exception elements. Function signature [source] AppTest.exception Returns (ElementList of Exception) Sequence of all st.exception elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.exception[0] for the first element. Exception is an extension of the Element class. AppTest.expander Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.expander elements. Function signature [source] AppTest.expander Returns (Sequence of Expandable) Sequence of all st.expander elements. Individual elements can be accessed from a Sequence by index (order on the page). For example, at.expander[0] for the first element. Expandable is an extension of the Block class. AppTest.header Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.header elements. Function signature [source] AppTest.header Returns (ElementList of Header) Sequence of all st.header elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.header[0] for the first element. Header is an extension of the Element class. AppTest.info Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.info elements. Function signature [source] AppTest.info Returns (ElementList of Info) Sequence of all st.info elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.info[0] for the first element. Info is an extension of the Element class. AppTest.json Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.json elements. Function signature [source] AppTest.json Returns (ElementList of Json) Sequence of all st.json elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.json[0] for the first element. Json is an extension of the Element class. AppTest.latex Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.latex elements. Function signature [source] AppTest.latex Returns (ElementList of Latex) Sequence of all st.latex elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.latex[0] for the first element. Latex is an extension of the Element class. AppTest.main Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of elements within the main body of the app. Function signature [source] AppTest.main Returns (Block) A container of elements. Block can be queried for elements in the same manner as AppTest . For example, Block.checkbox will return all st.checkbox within the associated container. AppTest.markdown Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.markdown elements. Function signature [source] AppTest.markdown Returns (ElementList of Markdown) Sequence of all st.markdown elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.markdown[0] for the first element. Markdown is an extension of the Element class. AppTest.metric Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.metric elements. Function signature [source] AppTest.metric Returns (ElementList of Metric) Sequence of all st.metric elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.metric[0] for the first element. Metric is an extension of the Element class. AppTest.multiselect Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.multiselect widgets. Function signature [source] AppTest.multiselect Returns (WidgetList of Multiselect) Sequence of all st.multiselect widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.multiselect[0] for the first widget or at.multiselect(key="my_key") for a widget with a given key. AppTest.number_input Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.number_input widgets. Function signature [source] AppTest.number_input Returns (WidgetList of NumberInput) Sequence of all st.number_input widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.number_input[0] for the first widget or at.number_input(key="my_key") for a widget with a given key. AppTest.radio Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.radio widgets. Function signature [source] AppTest.radio Returns (WidgetList of Radio) Sequence of all st.radio widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.radio[0] for the first widget or at.radio(key="my_key") for a widget with a given key. AppTest.select_slider Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.select_slider widgets. Function signature [source] AppTest.select_slider Returns (WidgetList of SelectSlider) Sequence of all st.select_slider widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.select_slider[0] for the first widget or at.select_slider(key="my_key") for a widget with a given key. AppTest.selectbox Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.selectbox widgets. Function signature [source] AppTest.selectbox Returns (WidgetList of Selectbox) Sequence of all st.selectbox widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.selectbox[0] for the first widget or at.selectbox(key="my_key") for a widget with a given key. AppTest.sidebar Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all elements within st.sidebar . Function signature [source] AppTest.sidebar Returns (Block) A container of elements. Block can be queried for elements in the same manner as AppTest . For example, Block.checkbox will return all st.checkbox within the associated container. AppTest.slider Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.slider widgets. Function signature [source] AppTest.slider Returns (WidgetList of Slider) Sequence of all st.slider widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.slider[0] for the first widget or at.slider(key="my_key") for a widget with a given key. AppTest.subheader Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.subheader elements. Function signature [source] AppTest.subheader Returns (ElementList of Subheader) Sequence of all st.subheader elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.subheader[0] for the first element. Subheader is an extension of the Element class. AppTest.success Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.success elements. Function signature [source] AppTest.success Returns (ElementList of Success) Sequence of all st.success elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.success[0] for the first element. Success is an extension of the Element class. AppTest.status Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.status elements. Function signature [source] AppTest.status Returns (Sequence of Status) Sequence of all st.status elements. Individual elements can be accessed from a Sequence by index (order on the page). For example, at.status[0] for the first element. Status is an extension of the Block class. AppTest.table Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.table elements. Function signature [source] AppTest.table Returns (ElementList of Table) Sequence of all st.table elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.table[0] for the first element. Table is an extension of the Element class. AppTest.tabs Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all tabs within st.tabs elements. Each tab within a single st.tabs will be returned as a separate Tab in the Sequence. Additionally, the tab labels are forwarded to each Tab element as a property. For example, st.tabs("A","B") will yield two Tab objects, with Tab.label returning "A" and "B", respectively. Function signature [source] AppTest.tabs Returns (Sequence of Tab) Sequence of all tabs within st.tabs elements. Individual tabs can be accessed from an ElementList by index (order on the page). For example, at.tabs[0] for the first tab. Tab is an extension of the Block class. AppTest.text Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.text elements. Function signature [source] AppTest.text Returns (ElementList of Text) Sequence of all st.text elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.text[0] for the first element. Text is an extension of the Element class. AppTest.text_area Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.text_area widgets. Function signature [source] AppTest.text_area Returns (WidgetList of TextArea) Sequence of all st.text_area widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.text_area[0] for the first widget or at.text_area(key="my_key") for a widget with a given key. AppTest.text_input Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.text_input widgets. Function signature [source] AppTest.text_input Returns (WidgetList of TextInput) Sequence of all st.text_input widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.text_input[0] for the first widget or at.text_input(key="my_key") for a widget with a given key. AppTest.time_input Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.time_input widgets. Function signature [source] AppTest.time_input Returns (WidgetList of TimeInput) Sequence of all st.time_input widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.time_input[0] for the first widget or at.time_input(key="my_key") for a widget with a given key. AppTest.title Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.title elements. Function signature [source] AppTest.title Returns (ElementList of Title) Sequence of all st.title elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.title[0] for the first element. Title is an extension of the Element class. AppTest.toast Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.toast elements. Function signature [source] AppTest.toast Returns (ElementList of Toast) Sequence of all st.toast elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.toast[0] for the first element. Toast is an extension of the Element class. AppTest.toggle Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.toggle widgets. Function signature [source] AppTest.toggle Returns (WidgetList of Toggle) Sequence of all st.toggle widgets. Individual widgets can be accessed from a WidgetList by index (order on the page) or key. For example, at.toggle[0] for the first widget or at.toggle(key="my_key") for a widget with a given key. AppTest.warning Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Sequence of all st.warning elements. Function signature [source] AppTest.warning Returns (ElementList of Warning) Sequence of all st.warning elements. Individual elements can be accessed from an ElementList by index (order on the page). For example, at.warning[0] for the first element. Warning is an extension of the Element class. Previous: App testing Next: Testing element classes forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Workspace_settings_-_Streamlit_Docs.txt
Workspace settings - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app add Share your app add Manage your account remove Sign in & sign out Workspace settings Manage your GitHub connection Update your email Delete your account Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Manage your account / Workspace settings Workspace settings From your workspace settings you can Manage your account , see your App resources and limits and access support resources. Access your workspace settings Sign in to share.streamlit.io . In the upper-left corner, click on your workspace name. In the drop-down menu, click " Settings ." Linked accounts The " Linked accounts " section shows your current email identity and source control account. To learn more, see Manage your account . Limits The " Limits " section shows your current resources and limits. To learn more, see App resources and limits . Support The " Support " section provides a convenient list of useful resources so you know where to go for help. Previous: Sign in & sign out Next: Manage your GitHub connection forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_Streamlit_to_a_private_Google_Sheet___Stre.txt
Connect Streamlit to a private Google Sheet - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources / Private Google Sheet Connect Streamlit to a private Google Sheet Introduction This guide explains how to securely access a private Google Sheet from Streamlit Community Cloud. It uses st.connection , Streamlit GSheetsConnection , and Streamlit's Secrets management . If you are fine with enabling link sharing for your Google Sheet (i.e. everyone with the link can view it), the guide Connect Streamlit to a public Google Sheet shows a simpler method of doing this. If your Sheet contains sensitive information and you cannot enable link sharing, keep on reading. Prerequisites This tutorial requires streamlit>=1.28 and st-gsheets-connection in your Python environment. Create a Google Sheet If you already have a Sheet that you want to use, you can skip to the next step . Create a spreadsheet with this example data. name pet Mary dog John cat Robert bird Enable the Sheets API Programmatic access to Google Sheets is controlled through Google Cloud Platform . Create an account or sign in and head over to the APIs & Services dashboard (select or create a project if asked). As shown below, search for the Sheets API and enable it: Create a service account & key file To use the Sheets API from Streamlit Community Cloud, you need a Google Cloud Platform service account (a special account type for programmatic data access). Go to the Service Accounts page and create an account with the Viewer permission (this will let the account access data but not change it): push_pin Note The button " CREATE SERVICE ACCOUNT " is gray, you don't have the correct permissions. Ask the admin of your Google Cloud project for help. After clicking " DONE ", you should be back on the service accounts overview. First, note down the email address of the account you just created ( important for next step! ). Then, create a JSON key file for the new account and download it: Share the Google Sheet with the service account By default, the service account you just created cannot access your Google Sheet. To give it access, click on the " Share " button in the Google Sheet, add the email of the service account (noted down in step 2), and choose the correct permission (if you just want to read the data, " Viewer " is enough): Add the key file to your local app secrets Your local Streamlit app will read secrets from a file .streamlit/secrets.toml in your app's root directory. Create this file if it doesn't exist yet and add the URL of your Google Sheet plus the content of the key file you downloaded to it as shown below: # .streamlit/secrets.toml [connections.gsheets] spreadsheet = "https://docs.google.com/spreadsheets/d/xxxxxxx/edit#gid=0" # From your JSON key file type = "service_account" project_id = "xxx" private_key_id = "xxx" private_key = "xxx" client_email = "xxx" client_id = "xxx" auth_uri = "https://accounts.google.com/o/oauth2/auth" token_uri = "https://oauth2.googleapis.com/token" auth_provider_x509_cert_url = "https://www.googleapis.com/oauth2/v1/certs" client_x509_cert_url = "xxx" priority_high Important Add this file to .gitignore and don't commit it to your GitHub repo! Write your Streamlit app Copy the code below to your Streamlit app and run it. # streamlit_app.py import streamlit as st from streamlit_gsheets import GSheetsConnection # Create a connection object. conn = st.connection("gsheets", type=GSheetsConnection) df = conn.read() # Print results. for row in df.itertuples(): st.write(f"{row.name} has a :{row.pet}:") See st.connection above? This handles secrets retrieval, setup, query caching and retries. By default, .read() results are cached without expiring. You can pass optional parameters to .read() to customize your connection. For example, you can specify the name of a worksheet, cache expiration time, or pass-through parameters for pandas.read_csv like this: df = conn.read( worksheet="Sheet1", ttl="10m", usecols=[0, 1], nrows=3, ) In this case, we set ttl="10m" to ensure the query result is cached for no longer than 10 minutes. You can also set ttl=0 to disable caching. Learn more in Caching . We've declared optional parameters usecols=[0,1] and nrows=3 for pandas to use under the hood. If everything worked out (and you used the example table we created above), your app should look like this: Connecting to a Google Sheet from Community Cloud This tutorial assumes a local Streamlit app, however you can also connect to Google Sheets from apps hosted in Community Cloud. The main additional steps are: Include information about dependencies using a requirements.txt file with st-gsheets-connection and any other dependencies. Add your secrets to your Community Cloud app. Previous: PostgreSQL Next: Public Google Sheet forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.image_-_Streamlit_Docs.txt
st.image - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements remove st.audio st.image st.logo st.video Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Media elements / st.image st.image Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display an image or list of images. Function signature [source] st.image(image, caption=None, width=None, use_column_width=None, clamp=False, channels="RGB", output_format="auto", *, use_container_width=False) Parameters image (numpy.ndarray, BytesIO, str, Path, or list of these) The image to display. This can be one of the following: A URL (string) for a hosted image. A path to a local image file. The path can be a str or Path object. Paths can be absolute or relative to the working directory (where you execute streamlit run ). An SVG string like <svg xmlns=...</svg> . A byte array defining an image. This includes monochrome images of shape (w,h) or (w,h,1), color images of shape (w,h,3), or RGBA images of shape (w,h,4), where w and h are the image width and height, respectively. A list of any of the above. Streamlit displays the list as a row of images that overflow to additional rows as needed. caption (str or list of str) Image caption(s). If this is None (default), no caption is displayed. If image is a list of multiple images, caption must be a list of captions (one caption for each image) or None . width (int or None) Image width. If this is None (default), Streamlit will use the image's native width, up to the width of the parent container. When using an SVG image without a default width, you should declare width or use use_container_width=True . use_column_width ("auto", "always", "never", or bool) delete use_column_width is deprecated and will be removed in a future release. Please use the use_container_width parameter instead. If "auto", set the image's width to its natural size, but do not exceed the width of the column. If "always" or True, set the image's width to the column width. If "never" or False, set the image's width to its natural size. Note: if set, use_column_width takes precedence over the width parameter. clamp (bool) Whether to clamp image pixel values to a valid range (0-255 per channel). This is only used for byte array images; the parameter is ignored for image URLs and files. If this is False (default) and an image has an out-of-range value, a RuntimeError will be raised. channels ("RGB" or "BGR") The color format when image is an nd.array . This is ignored for other image types. If this is "RGB" (default), image[:, :, 0] is the red channel, image[:, :, 1] is the green channel, and image[:, :, 2] is the blue channel. For images coming from libraries like OpenCV, you should set this to "BGR" instead. output_format ("JPEG", "PNG", or "auto") The output format to use when transferring the image data. If this is "auto" (default), Streamlit identifies the compression type based on the type and format of the image. Photos should use the "JPEG" format for lossy compression while diagrams should use the "PNG" format for lossless compression. use_container_width (bool) Whether to override width with the width of the parent container. If use_container_width is False (default), Streamlit sets the image's width according to width . If use_container_width is True , Streamlit sets the width of the image to match the width of the parent container. Example import streamlit as st st.image("sunrise.jpg", caption="Sunrise by the mountains") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.audio Next: st.logo forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_to_data_sources_-_Streamlit_Docs.txt
Connect to data sources - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources Connect Streamlit to data sources These step-by-step guides demonstrate how to connect Streamlit apps to various databases & APIs. They use Streamlit's Secrets management and caching to provide secure and fast data access. AWS S3 BigQuery Firestore (blog) Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Previous: Execution flow Next: AWS S3 forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st_column_config_SelectboxColumn___Streamlit_Docs_.txt
st.column_config.SelectboxColumn - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements remove st.dataframe st.data_editor st.column_config remove Column Text column Number column Checkbox column Selectbox column Datetime column Date column Time column List column Link column Image column Area chart column Line chart column Bar chart column Progress column st.table st.metric st.json Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Data elements / st.column_config / Selectbox column st.column_config.SelectboxColumn Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Configure a selectbox column in st.dataframe or st.data_editor . This is the default column type for Pandas categorical values. This command needs to be used in the column_config parameter of st.dataframe or st.data_editor . When used with st.data_editor , editing will be enabled with a selectbox widget. Function signature [source] st.column_config.SelectboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, options=None) Parameters label (str or None) The label shown at the top of the column. If this is None (default), the column name is used. width ("small", "medium", "large", or None) The display width of the column. If this is None (default), the column will be sized to fit the cell contents. Otherwise, this can be one of the following: "small" : 75px wide "medium" : 200px wide "large" : 400px wide help (str or None) An optional tooltip that gets displayed when hovering over the column label. If this is None (default), no tooltip is displayed. disabled (bool or None) Whether editing should be disabled for this column. If this is None (default), Streamlit will decide: indices are disabled and data columns are not. If a column has mixed types, it may become uneditable regardless of disabled . required (bool or None) Whether edited cells in the column need to have a value. If this is False (default), the user can submit empty values for this column. If this is True , an edited cell in this column can only be submitted if its value is not None , and a new row will only be submitted after the user fills in this column. pinned (bool or None) Whether the column is pinned. A pinned column will stay visible on the left side no matter where the user scrolls. If this is None (default), Streamlit will decide: index columns are pinned, and data columns are not pinned. default (str, int, float, bool, or None) Specifies the default value in this column when a new row is added by the user. This defaults to None . options (Iterable of str or None) The options that can be selected during editing. If this is None (default), the options will be inferred from the underlying dataframe column if its dtype is "category". For more information, see Pandas docs ). Examples import pandas as pd import streamlit as st data_df = pd.DataFrame( { "category": [ "📊 Data Exploration", "📈 Data Visualization", "🤖 LLM", "📊 Data Exploration", ], } ) st.data_editor( data_df, column_config={ "category": st.column_config.SelectboxColumn( "App Category", help="The category of the app", width="medium", options=[ "📊 Data Exploration", "📈 Data Visualization", "🤖 LLM", ], required=True, ) }, hide_index=True, ) Built with Streamlit 🎈 Fullscreen open_in_new Previous: Checkbox column Next: Datetime column forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_Streamlit_to_Neon_-_Streamlit_Docs.txt
Connect Streamlit to Neon - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources / Neon Connect Streamlit to Neon Introduction This guide explains how to securely access a Neon database from Streamlit. Neon is a fully managed serverless PostgreSQL database that separates storage and compute to offer features such as instant branching and automatic scaling. Prerequisites The following packages must be installed in your Python environment: streamlit>=1.28 psycopg2-binary>=2.9.6 sqlalchemy>=2.0.0 push_pin Note You may use psycopg2 instead of psycopg2-binary . However, building Psycopg requires a few prerequisites (like a C compiler). To use psycopg2 on Community Cloud, you must include libpq-dev in a packages.txt file in the root of your repository. psycopg2-binary is a stand-alone package that is practical for testing and development. You must have a Neon account. You should have a basic understanding of st.connection and Secrets management . Create a Neon project If you already have a Neon project that you want to use, you can skip to the next step . Log in to the Neon console and navigate to the Projects section. If you see a prompt to enter your project name, skip to the next step. Otherwise, click the " New Project " button to create a new project. Enter "Streamlit-Neon" for your project name, accept the othe default settings, and click " Create Project ." After Neon creates your project with a ready-to-use neondb database, you will be redirected to your project's Quickstart. Click on " SQL Editor " from the left sidebar. Replace the text in the input area with the following code and click " Run " to add sample data to your project. CREATE TABLE home ( id SERIAL PRIMARY KEY, name VARCHAR(100), pet VARCHAR(100) ); INSERT INTO home (name, pet) VALUES ('Mary', 'dog'), ('John', 'cat'), ('Robert', 'bird'); Add the Neon connection string to your local app secrets Within your Neon project, click " Dashboard " in the left sidebar. Within the "Connection Details" tile, locate your database connection string. It should look similar to this: postgresql://neondb_owner:[email protected]/neondb?sslmode=require If you do not already have a .streamlit/secrets.toml file in your app's root directory, create an empty secrets file. Copy your connection string and add it to your app's .streamlit/secrets.toml file as follows: # .streamlit/secrets.toml [connections.neon] url="postgresql://neondb_owner:[email protected]/neondb?sslmode=require" priority_high Important Add this file to .gitignore and don't commit it to your GitHub repo! Write your Streamlit app Copy the code below to your Streamlit app and save it. # streamlit_app.py import streamlit as st # Initialize connection. conn = st.connection("neon", type="sql") # Perform query. df = conn.query('SELECT * FROM home;', ttl="10m") # Print results. for row in df.itertuples(): st.write(f"{row.name} has a :{row.pet}:") The st.connection object above handles secrets retrieval, setup, query caching and retries. By default, query() results are cached without expiring. Setting the ttl parameter to "10m" ensures the query result is cached for no longer than 10 minutes. You can also set ttl=0 to disable caching. Learn more in Caching . Run your Streamlit app. streamlit run streamlit_app.py If everything worked out (and you used the example table we created above), your app should look like this: Connecting to a Neon database from Community Cloud This tutorial assumes a local Streamlit app, but you can also connect to a Neon database from apps hosted on Community Cloud. The additional steps are: Add a requirements.txt file to your repo. Include all the packages listed in Prequisites and any other dependencies. Add your secrets to your app in Community Cloud. Previous: MySQL Next: PostgreSQL forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st_column_config_BarChartColumn___Streamlit_Docs_3.txt
st.column_config.BarChartColumn - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements remove st.dataframe st.data_editor st.column_config remove Column Text column Number column Checkbox column Selectbox column Datetime column Date column Time column List column Link column Image column Area chart column Line chart column Bar chart column Progress column st.table st.metric st.json Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Data elements / st.column_config / Bar chart column st.column_config.BarChartColumn Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Configure a bar chart column in st.dataframe or st.data_editor . Cells need to contain a list of numbers. Chart columns are not editable at the moment. This command needs to be used in the column_config parameter of st.dataframe or st.data_editor . Function signature [source] st.column_config.BarChartColumn(label=None, *, width=None, help=None, pinned=None, y_min=None, y_max=None) Parameters label (str or None) The label shown at the top of the column. If this is None (default), the column name is used. width ("small", "medium", "large", or None) The display width of the column. If this is None (default), the column will be sized to fit the cell contents. Otherwise, this can be one of the following: "small" : 75px wide "medium" : 200px wide "large" : 400px wide help (str or None) An optional tooltip that gets displayed when hovering over the column label. If this is None (default), no tooltip is displayed. pinned (bool or None) Whether the column is pinned. A pinned column will stay visible on the left side no matter where the user scrolls. If this is None (default), Streamlit will decide: index columns are pinned, and data columns are not pinned. y_min (int, float, or None) The minimum value on the y-axis for all cells in the column. If this is None (default), every cell will use the minimum of its data. y_max (int, float, or None) The maximum value on the y-axis for all cells in the column. If this is None (default), every cell will use the maximum of its data. Examples import pandas as pd import streamlit as st data_df = pd.DataFrame( { "sales": [ [0, 4, 26, 80, 100, 40], [80, 20, 80, 35, 40, 100], [10, 20, 80, 80, 70, 0], [10, 100, 20, 100, 30, 100], ], } ) st.data_editor( data_df, column_config={ "sales": st.column_config.BarChartColumn( "Sales (last 6 months)", help="The sales volume in the last 6 months", y_min=0, y_max=100, ), }, hide_index=True, ) Built with Streamlit 🎈 Fullscreen open_in_new Previous: Line chart column Next: Progress column forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Layouts_and_Containers_-_Streamlit_Docs.txt
Layouts and Containers - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers remove st.columns st.container st.dialog link st.empty st.expander st.form link st.popover st.sidebar st.tabs Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Layouts and containers Layouts and Containers Complex layouts Streamlit provides several options for controlling how different elements are laid out on the screen. Columns Insert containers laid out as side-by-side columns. col1, col2 = st.columns(2) col1.write("this is column 1") col2.write("this is column 2") Container Insert a multi-element container. c = st.container() st.write("This will show last") c.write("This will show first") c.write("This will show second") Modal dialog Insert a modal dialog that can rerun independently from the rest of the script. @st.dialog("Sign up") def email_form(): name = st.text_input("Name") email = st.text_input("Email") Empty Insert a single-element container. c = st.empty() st.write("This will show last") c.write("This will be replaced") c.write("This will show first") Expander Insert a multi-element container that can be expanded/collapsed. with st.expander("Open to see more"): st.write("This is more content") Popover Insert a multi-element popover container that can be opened/closed. with st.popover("Settings"): st.checkbox("Show completed") Sidebar Display items in a sidebar. st.sidebar.write("This lives in the sidebar") st.sidebar.button("Click me!") Tabs Insert containers separated into tabs. tab1, tab2 = st.tabs(["Tab 1", "Tab2"]) tab1.write("this is tab 1") tab2.write("this is tab 2") Third-party components These are featured components created by our lovely community. For more examples and inspiration, check out our Components Gallery and Streamlit Extras ! Streamlit Elements Create a draggable and resizable dashboard in Streamlit. Created by @okls . from streamlit_elements import elements, mui, html with elements("new_element"): mui.Typography("Hello world") Pydantic Auto-generate Streamlit UI from Pydantic Models and Dataclasses. Created by @lukasmasuch . import streamlit_pydantic as sp sp.pydantic_form(key="my_form", model=ExampleModel) Streamlit Pages An experimental version of Streamlit Multi-Page Apps. Created by @blackary . from st_pages import Page, show_pages, add_page_title show_pages([ Page("streamlit_app.py", "Home", "🏠"), Page("other_pages/page2.py", "Page 2", ":books:"), ]) Previous: Media elements Next: st.columns forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Input_widgets_-_Streamlit_Docs.txt
Input widgets - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets Input widgets With widgets, Streamlit allows you to bake interactivity directly into your apps with buttons, sliders, text inputs, and more. Button elements Button Display a button widget. clicked = st.button("Click me") Download button Display a download button widget. st.download_button("Download file", file) Form button Display a form submit button. For use with st.form . st.form_submit_button("Sign up") Link button Display a link button. st.link_button("Go to gallery", url) Page link Display a link to another page in a multipage app. st.page_link("app.py", label="Home", icon="🏠") st.page_link("pages/profile.py", label="My profile") Selection elements Checkbox Display a checkbox widget. selected = st.checkbox("I agree") Color picker Display a color picker widget. color = st.color_picker("Pick a color") Feedback Display a rating or sentiment button group. st.feedback("stars") Multiselect Display a multiselect widget. The multiselect widget starts as empty. choices = st.multiselect("Buy", ["milk", "apples", "potatoes"]) Pills Display a pill-button selection widget. st.pills("Tags", ["Sports", "AI", "Politics"]) Radio Display a radio button widget. choice = st.radio("Pick one", ["cats", "dogs"]) Segmented control Display a segmented-button selection widget. st.segmented_control("Filter", ["Open", "Closed", "All"]) Select slider Display a slider widget to select items from a list. size = st.select_slider("Pick a size", ["S", "M", "L"]) Selectbox Display a select widget. choice = st.selectbox("Pick one", ["cats", "dogs"]) Toggle Display a toggle widget. activated = st.toggle("Activate") Numeric input elements Number input Display a numeric input widget. choice = st.number_input("Pick a number", 0, 10) Slider Display a slider widget. number = st.slider("Pick a number", 0, 100) Date and time input elements Date input Display a date input widget. date = st.date_input("Your birthday") Time input Display a time input widget. time = st.time_input("Meeting time") Text input elements Text input Display a single-line text input widget. name = st.text_input("First name") Text area Display a multi-line text input widget. text = st.text_area("Text to translate") Chat input Display a chat input widget. prompt = st.chat_input("Say something") if prompt: st.write(f"The user has sent: {prompt}") Other input elements Audio input Display a widget that allows users to record with their microphone. speech = st.audio_input("Record a voice message") Data editor Display a data editor widget. edited = st.data_editor(df, num_rows="dynamic") File uploader Display a file uploader widget. data = st.file_uploader("Upload a CSV") Camera input Display a widget that allows users to upload images directly from a camera. image = st.camera_input("Take a picture") Third-party components These are featured components created by our lovely community. For more examples and inspiration, check out our Components Gallery and Streamlit Extras ! Previous Streamlit Chat Streamlit Component for a Chatbot UI. Created by @AI-Yash . from streamlit_chat import message message("My message") message("Hello bot!", is_user=True) # align's the message to the right Streamlit Option Menu Select a single item from a list of options in a menu. Created by @victoryhb . from streamlit_option_menu import option_menu option_menu("Main Menu", ["Home", 'Settings'], icons=['house', 'gear'], menu_icon="cast", default_index=1) Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . from streamlit_extras.stoggle import stoggle stoggle( "Click me!", """🥷 Surprise! Here's some additional content""",) Streamlit Elements Create a draggable and resizable dashboard in Streamlit. Created by @okls . from streamlit_elements import elements, mui, html with elements("new_element"): mui.Typography("Hello world") Tags Add tags to your Streamlit apps. Created by @gagan3012 . from streamlit_tags import st_tags st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') Stqdm The simplest way to handle a progress bar in streamlit app. Created by @Wirg . from stqdm import stqdm for _ in stqdm(range(50)): sleep(0.5) Timeline Display a Timeline in Streamlit apps using TimelineJS . Created by @innerdoc . from streamlit_timeline import timeline with open('example.json', "r") as f: timeline(f.read(), height=800) Camera input live Alternative for st.camera_input which returns the webcam images live. Created by @blackary . from camera_input_live import camera_input_live image = camera_input_live() st.image(value) Streamlit Ace Ace editor component for Streamlit. Created by @okld . from streamlit_ace import st_ace content = st_ace() content Streamlit Chat Streamlit Component for a Chatbot UI. Created by @AI-Yash . from streamlit_chat import message message("My message") message("Hello bot!", is_user=True) # align's the message to the right Streamlit Option Menu Select a single item from a list of options in a menu. Created by @victoryhb . from streamlit_option_menu import option_menu option_menu("Main Menu", ["Home", 'Settings'], icons=['house', 'gear'], menu_icon="cast", default_index=1) Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . from streamlit_extras.stoggle import stoggle stoggle( "Click me!", """🥷 Surprise! Here's some additional content""",) Streamlit Elements Create a draggable and resizable dashboard in Streamlit. Created by @okls . from streamlit_elements import elements, mui, html with elements("new_element"): mui.Typography("Hello world") Tags Add tags to your Streamlit apps. Created by @gagan3012 . from streamlit_tags import st_tags st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') Stqdm The simplest way to handle a progress bar in streamlit app. Created by @Wirg . from stqdm import stqdm for _ in stqdm(range(50)): sleep(0.5) Timeline Display a Timeline in Streamlit apps using TimelineJS . Created by @innerdoc . from streamlit_timeline import timeline with open('example.json', "r") as f: timeline(f.read(), height=800) Camera input live Alternative for st.camera_input which returns the webcam images live. Created by @blackary . from camera_input_live import camera_input_live image = camera_input_live() st.image(value) Streamlit Ace Ace editor component for Streamlit. Created by @okld . from streamlit_ace import st_ace content = st_ace() content Streamlit Chat Streamlit Component for a Chatbot UI. Created by @AI-Yash . from streamlit_chat import message message("My message") message("Hello bot!", is_user=True) # align's the message to the right Streamlit Option Menu Select a single item from a list of options in a menu. Created by @victoryhb . from streamlit_option_menu import option_menu option_menu("Main Menu", ["Home", 'Settings'], icons=['house', 'gear'], menu_icon="cast", default_index=1) Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . from streamlit_extras.stoggle import stoggle stoggle( "Click me!", """🥷 Surprise! Here's some additional content""",) Next Previous: Chart elements Next: st.button forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Session_State_-_Streamlit_Docs.txt
Session State - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state remove st.cache_data st.cache_resource st.session_state st.query_params st.experimental_get_query_params delete st.experimental_set_query_params delete Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Caching and state / st.session_state Session State Session State is a way to share variables between reruns, for each user session. In addition to the ability to store and persist state, Streamlit also exposes the ability to manipulate state using Callbacks. Session state also persists across apps inside a multipage app . Check out this Session State basics tutorial video by Streamlit Developer Advocate Dr. Marisa Smith to get started: Initialize values in Session State The Session State API follows a field-based API, which is very similar to Python dictionaries: # Initialization if 'key' not in st.session_state: st.session_state['key'] = 'value' # Session State also supports attribute based syntax if 'key' not in st.session_state: st.session_state.key = 'value' Reads and updates Read the value of an item in Session State and display it by passing to st.write : # Read st.write(st.session_state.key) # Outputs: value Update an item in Session State by assigning it a value: st.session_state.key = 'value2' # Attribute API st.session_state['key'] = 'value2' # Dictionary like API Curious about what is in Session State? Use st.write or magic: st.write(st.session_state) # With magic: st.session_state Streamlit throws a handy exception if an uninitialized variable is accessed: st.write(st.session_state['value']) # Throws an exception! Delete items Delete items in Session State using the syntax to delete items in any Python dictionary: # Delete a single key-value pair del st.session_state[key] # Delete all the items in Session state for key in st.session_state.keys(): del st.session_state[key] Session State can also be cleared by going to Settings → Clear Cache, followed by Rerunning the app. Session State and Widget State association Every widget with a key is automatically added to Session State: st.text_input("Your name", key="name") # This exists now: st.session_state.name Use Callbacks to update Session State A callback is a python function which gets called when an input widget changes. Order of execution : When updating Session state in response to events , a callback function gets executed first, and then the app is executed from top to bottom. Callbacks can be used with widgets using the parameters on_change (or on_click ), args , and kwargs : Parameters on_change or on_click - The function name to be used as a callback args ( tuple ) - List of arguments to be passed to the callback function kwargs ( dict ) - Named arguments to be passed to the callback function Widgets which support the on_change event: st.checkbox st.color_picker st.date_input st.data_editor st.file_uploader st.multiselect st.number_input st.radio st.select_slider st.selectbox st.slider st.text_area st.text_input st.time_input st.toggle Widgets which support the on_click event: st.button st.download_button st.form_submit_button To add a callback, define a callback function above the widget declaration and pass it to the widget via the on_change (or on_click ) parameter. Forms and Callbacks Widgets inside a form can have their values be accessed and set via the Session State API. st.form_submit_button can have a callback associated with it. The callback gets executed upon clicking on the submit button. For example: def form_callback(): st.write(st.session_state.my_slider) st.write(st.session_state.my_checkbox) with st.form(key='my_form'): slider_input = st.slider('My slider', 0, 10, 5, key='my_slider') checkbox_input = st.checkbox('Yes or No', key='my_checkbox') submit_button = st.form_submit_button(label='Submit', on_click=form_callback) Serializable Session State Serialization refers to the process of converting an object or data structure into a format that can be persisted and shared, and allowing you to recover the data’s original structure. Python’s built-in pickle module serializes Python objects to a byte stream ("pickling") and deserializes the stream into an object ("unpickling"). By default, Streamlit’s Session State allows you to persist any Python object for the duration of the session, irrespective of the object’s pickle-serializability. This property lets you store Python primitives such as integers, floating-point numbers, complex numbers and booleans, dataframes, and even lambdas returned by functions. However, some execution environments may require serializing all data in Session State, so it may be useful to detect incompatibility during development, or when the execution environment will stop supporting it in the future. To that end, Streamlit provides a runner.enforceSerializableSessionState configuration option that, when set to true , only allows pickle-serializable objects in Session State. To enable the option, either create a global or project config file with the following or use it as a command-line flag: # .streamlit/config.toml [runner] enforceSerializableSessionState = true By " pickle-serializable ", we mean calling pickle.dumps(obj) should not raise a PicklingError exception. When the config option is enabled, adding unserializable data to session state should result in an exception. E.g., import streamlit as st def unserializable_data(): return lambda x: x #👇 results in an exception when enforceSerializableSessionState is on st.session_state.unserializable = unserializable_data() priority_high Warning When runner.enforceSerializableSessionState is set to true , Session State implicitly uses the pickle module, which is known to be insecure. Ensure all data saved and retrieved from Session State is trusted because it is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. Only load data you trust . Caveats and limitations Only the st.form_submit_button has a callback in forms. Other widgets inside a form are not allowed to have callbacks. on_change and on_click events are only supported on input type widgets. Modifying the value of a widget via the Session state API, after instantiating it, is not allowed and will raise a StreamlitAPIException . For example: slider = st.slider( label='My Slider', min_value=1, max_value=10, value=5, key='my_slider') st.session_state.my_slider = 7 # Throws an exception! Setting the widget state via the Session State API and using the value parameter in the widget declaration is not recommended, and will throw a warning on the first run. For example: st.session_state.my_slider = 7 slider = st.slider( label='Choose a Value', min_value=1, max_value=10, value=5, key='my_slider') Setting the state of button-like widgets: st.button , st.download_button , and st.file_uploader via the Session State API is not allowed. Such type of widgets are by default False and have ephemeral True states which are only valid for a single run. For example: if 'my_button' not in st.session_state: st.session_state.my_button = True st.button('My button', key='my_button') # Throws an exception! Previous: st.experimental_singleton Next: st.query_params forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Deploy_-_Streamlit_Docs.txt
Deploy - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy Deploy Get all the information you need to deploy your app and share it with your users. book Concepts. Understand the basics of app deployment. cloud Streamlit Community Cloud. Deploy your app on our free platform and join a community of developers who share their apps around the world. This is a great place for your non-commerical, personal, and educational apps. ac_unit Snowflake. Deploy your app in Snowflake for a secure, enterprise-grade environment. This is a great place for your business apps. bolt Other platforms. Learn how to deploy your app on a variety of platforms with our convenient collection of tutorials. Previous: Develop Next: Concepts forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Utilities_and_user_info_-_Streamlit_Docs.txt
Utilities and user info - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities remove st.context st.experimental_user st.help st.html Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Utilities Utilities and user info There are a handful of methods that allow you to create placeholders in your app, provide help using doc strings, get and modify configuration options and query parameters. Context st.context provides a read-only interface to access cookies and headers. st.context.cookies st.context.headers Get help Display object’s doc string, nicely formatted. st.help(st.write) st.help(pd.DataFrame) Render HTML Renders HTML strings to your app. st.html("<p>Foo bar.</p>") User info st.experimental_user returns information about the logged-in user of private apps on Streamlit Community Cloud. if st.experimental_user.email == "[email protected]": st.write("Welcome back, ", st.experimental_user.email) else: st.write("You are not authorized to view this page.") Previous: Custom components Next: st.context forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Configure_and_customize_your_app___Streamlit_Docs_.txt
Configure and customize your app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming remove Configuration options HTTPS support Serving static files Customize your theme App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Configuration and theming Configure and customize your app Configuration options Understand the types of options available to you through Streamlit configuration. HTTPS support Understand how to configure SSL and TLS for your Streamlit app. Static file serving Understand how to host files alongside your app to make them accessible by URL. Use this if you want to point to files with raw HTML. Theming Understand how to use the theming configuration options to customize the color and appearance of your app. Previous: Custom components Next: Configuration options forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_Streamlit_to_TiDB_-_Streamlit_Docs.txt
Connect Streamlit to TiDB - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources / TiDB Connect Streamlit to TiDB Introduction This guide explains how to securely access a remote TiDB database from Streamlit Community Cloud. It uses st.connection and Streamlit's Secrets management . The below example code will only work on Streamlit version >= 1.28 , when st.connection was added. TiDB is an open-source, MySQL-compatible database that supports Hybrid Transactional and Analytical Processing (HTAP) workloads. TiDB introducs a built-in vector search to the SQL database family, enabling support for your AI applications without requiring a new database or additional technical stacks. TiDB Cloud is a fully managed cloud database service that simplifies the deployment and management of TiDB databases for developers. Sign in to TiDB Cloud and create a cluster First, head over to TiDB Cloud and sign up for a free account, using either Google, GitHub, Microsoft or E-mail: Once you've signed in, you will already have a TiDB cluster: You can create more clusters if you want to. Click the cluster name to enter cluster overview page: Then click Connect to easily get the connection arguments to access the cluster. On the popup, click Generate Password to set the password. priority_high Important Make sure to note down the password. It won't be available on TiDB Cloud after this step. Create a TiDB database push_pin Note If you already have a database that you want to use, feel free to skip to the next step . Once your TiDB cluster is up and running, connect to it with the mysql client(or with SQL Editor tab on the console) and enter the following commands to create a database and a table with some example values: CREATE DATABASE pets; USE pets; CREATE TABLE mytable ( name varchar(80), pet varchar(80) ); INSERT INTO mytable VALUES ('Mary', 'dog'), ('John', 'cat'), ('Robert', 'bird'); Add username and password to your local app secrets Your local Streamlit app will read secrets from a file .streamlit/secrets.toml in your app's root directory. Learn more about Streamlit secrets management here . Create this file if it doesn't exist yet and add host, username and password of your TiDB cluster as shown below: # .streamlit/secrets.toml [connections.tidb] dialect = "mysql" host = "<TiDB_cluster_host>" port = 4000 database = "pets" username = "<TiDB_cluster_user>" password = "<TiDB_cluster_password>" priority_high Important When copying your app secrets to Streamlit Community Cloud, be sure to replace the values of host , username and password with those of your remote TiDB cluster! Add this file to .gitignore and don't commit it to your GitHub repo! Copy your app secrets to the cloud As the secrets.toml file above is not committed to GitHub, you need to pass its content to your deployed app (on Streamlit Community Cloud) separately. Go to the app dashboard and in the app's dropdown menu, click on Edit Secrets . Copy the content of secrets.toml into the text area. More information is available at Secrets management . Add dependencies to your requirements file Add the mysqlclient and SQLAlchemy packages to your requirements.txt file, preferably pinning its version (replace x.x.x with the version you want installed): # requirements.txt mysqlclient==x.x.x SQLAlchemy==x.x.x Write your Streamlit app Copy the code below to your Streamlit app and run it. Make sure to adapt query to use the name of your table. # streamlit_app.py import streamlit as st # Initialize connection. conn = st.connection('tidb', type='sql') # Perform query. df = conn.query('SELECT * from mytable;', ttl=600) # Print results. for row in df.itertuples(): st.write(f"{row.name} has a :{row.pet}:") See st.connection above? This handles secrets retrieval, setup, query caching and retries. By default, query() results are cached without expiring. In this case, we set ttl=600 to ensure the query result is cached for no longer than 10 minutes. You can also set ttl=0 to disable caching. Learn more in Caching . If everything worked out (and you used the example table we created above), your app should look like this: Connect with PyMySQL Other than mysqlclient , PyMySQL is another popular MySQL Python client. To use PyMySQL, first you need to adapt your requirements file: # requirements.txt PyMySQL==x.x.x SQLAlchemy==x.x.x Then adapt your secrets file: # .streamlit/secrets.toml [connections.tidb] dialect = "mysql" driver = "pymysql" host = "<TiDB_cluster_host>" port = 4000 database = "pets" username = "<TiDB_cluster_user>" password = "<TiDB_cluster_password>" create_engine_kwargs = { connect_args = { ssl = { ca = "<path_to_CA_store>" }}} Previous: Tableau Next: TigerGraph forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Dataframes_-_Streamlit_Docs.txt
Dataframes - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design remove Animate & update elements Button behavior and examples Dataframes Using custom classes Working with timezones ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / App design / Dataframes Dataframes Dataframes are a great way to display and edit data in a tabular format. Working with Pandas DataFrames and other tabular data structures is key to data science workflows. If developers and data scientists want to display this data in Streamlit, they have multiple options: st.dataframe and st.data_editor . If you want to solely display data in a table-like UI, st.dataframe is the way to go. If you want to interactively edit data, use st.data_editor . We explore the use cases and advantages of each option in the following sections. Display dataframes with st.dataframe Streamlit can display dataframes in a table-like UI via st.dataframe : import streamlit as st import pandas as pd df = pd.DataFrame( [ {"command": "st.selectbox", "rating": 4, "is_widget": True}, {"command": "st.balloons", "rating": 5, "is_widget": False}, {"command": "st.time_input", "rating": 3, "is_widget": True}, ] ) st.dataframe(df, use_container_width=True) Built with Streamlit 🎈 Fullscreen open_in_new st.dataframe UI features st.dataframe provides additional functionality by using glide-data-grid under the hood: Column sorting : Sort columns by clicking on their headers. Column resizing : Resize columns by dragging and dropping column header borders. Table resizing : Resize tables by dragging and dropping the bottom right corner. Fullscreen view : Enlarge tables to fullscreen by clicking the fullscreen icon ( fullscreen ) in the toolbar. Search : Click the search icon ( search ) in the toolbar or use hotkeys ( ⌘+F or Ctrl+F ) to search through the data. Download : Click the download icon in the toolbar to download the data as a CSV file. Copy to clipboard : Select one or multiple cells, copy them to the clipboard ( ⌘+C or Ctrl+C ), and paste them into your favorite spreadsheet software. Try out all the UI features using the embedded app from the prior section. In addition to Pandas DataFrames, st.dataframe also supports other common Python types, e.g., list, dict, or numpy array. It also supports Snowpark and PySpark DataFrames, which allow you to lazily evaluate and pull data from databases. This can be useful for working with large datasets. Edit data with st.data_editor Streamlit supports editable dataframes via the st.data_editor command. Check out its API in st.data_editor . It shows the dataframe in a table, similar to st.dataframe . But in contrast to st.dataframe , this table isn't static! The user can click on cells and edit them. The edited data is then returned on the Python side. Here's an example: df = pd.DataFrame( [ {"command": "st.selectbox", "rating": 4, "is_widget": True}, {"command": "st.balloons", "rating": 5, "is_widget": False}, {"command": "st.time_input", "rating": 3, "is_widget": True}, ] ) edited_df = st.data_editor(df) # 👈 An editable dataframe favorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"] st.markdown(f"Your favorite command is **{favorite_command}** 🎈") Built with Streamlit 🎈 Fullscreen open_in_new Try it out by double-clicking on any cell. You'll notice you can edit all cell values. Try editing the values in the rating column and observe how the text output at the bottom changes: st.data_editor UI features st.data_editor also supports a few additional things: Add and delete rows : You can do this by setting num_rows= "dynamic" when calling st.data_editor . This will allow users to add and delete rows as needed. Copy and paste support : Copy and paste both between st.data_editor and spreadsheet software like Google Sheets and Excel. Access edited data : Access only the individual edits instead of the entire edited data structure via Session State. Bulk edits : Similar to Excel, just drag a handle to edit neighboring cells. Automatic input validation : Column Configuration provides strong data type support and other configurable options. For example, there's no way to enter letters into a number cell. Number cells can have a designated min and max. Edit common data structures : st.data_editor supports lists, dicts, NumPy ndarray, and more! Add and delete rows With st.data_editor , viewers can add or delete rows via the table UI. This mode can be activated by setting the num_rows parameter to "dynamic" : edited_df = st.data_editor(df, num_rows="dynamic") To add new rows, click the plus icon ( add ) in the toolbar. Alternatively, click inside a shaded cell below the bottom row of the table. To delete rows, select one or more rows using the checkboxes on the left. Click the delete icon ( delete ) or press the delete key on your keyboard. Built with Streamlit 🎈 Fullscreen open_in_new Copy and paste support The data editor supports pasting in tabular data from Google Sheets, Excel, Notion, and many other similar tools. You can also copy-paste data between st.data_editor instances. This functionality, powered by the Clipboard API , can be a huge time saver for users who need to work with data across multiple platforms. To try it out: Copy data from this Google Sheets document to your clipboard. Single click any cell in the name column in the app above. Paste it in using hotkeys ( ⌘+V or Ctrl+V ). push_pin Note Every cell of the pasted data will be evaluated individually and inserted into the cells if the data is compatible with the column type. For example, pasting in non-numerical text data into a number column will be ignored. star Tip If you embed your apps with iframes, you'll need to allow the iframe to access the clipboard if you want to use the copy-paste functionality. To do so, give the iframe clipboard-write and clipboard-read permissions. E.g. <iframe allow="clipboard-write;clipboard-read;" ... src="https://your-app-url"></iframe> As developers, ensure the app is served with a valid, trusted certificate when using TLS. If users encounter issues with copying and pasting data, direct them to check if their browser has activated clipboard access permissions for the Streamlit application, either when prompted or through the browser's site settings. Access edited data Sometimes, it is more convenient to know which cells have been changed rather than getting the entire edited dataframe back. Streamlit makes this easy through the use of Session State . If a key parameter is set, Streamlit will store any changes made to the dataframe in Session State. This snippet shows how you can access changed data using Session State: st.data_editor(df, key="my_key", num_rows="dynamic") # 👈 Set a key st.write("Here's the value in Session State:") st.write(st.session_state["my_key"]) # 👈 Show the value in Session State In this code snippet, the key parameter is set to "my_key" . After the data editor is created, the value associated to "my_key" in Session State is displayed in the app using st.write . This shows the additions, edits, and deletions that were made. This can be useful when working with large dataframes and you only need to know which cells have changed, rather than access the entire edited dataframe. Built with Streamlit 🎈 Fullscreen open_in_new Use all we've learned so far and apply them to the above embedded app. Try editing cells, adding new rows, and deleting rows. Notice how edits to the table are reflected in Session State. When you make any edits, a rerun is triggered which sends the edits to the backend. The widget's state is a JSON object containing three properties: edited_rows , added_rows , and deleted rows: . priority_high Warning When going from st.experimental_data_editor to st.data_editor in 1.23.0, the data editor's representation in st.session_state was changed. The edited_cells dictionary is now called edited_rows and uses a different format ( {0: {"column name": "edited value"}} instead of {"0:1": "edited value"} ). You may need to adjust your code if your app uses st.experimental_data_editor in combination with st.session_state ." edited_rows is a dictionary containing all edits. Keys are zero-based row indices and values are dictionaries that map column names to edits (e.g. {0: {"col1": ..., "col2": ...}} ). added_rows is a list of newly added rows. Each value is a dictionary with the same format as above (e.g. [{"col1": ..., "col2": ...}] ). deleted_rows is a list of row numbers that have been deleted from the table (e.g. [0, 2] ). st.data_editor does not support reordering rows, so added rows will always be appended to the end of the dataframe with any edits and deletions applicable to the original rows. Bulk edits The data editor includes a feature that allows for bulk editing of cells. Similar to Excel, you can drag a handle across a selection of cells to edit their values in bulk. You can even apply commonly used keyboard shortcuts in spreadsheet software. This is useful when you need to make the same change across multiple cells, rather than editing each cell individually. Edit common data structures Editing doesn't just work for Pandas DataFrames! You can also edit lists, tuples, sets, dictionaries, NumPy arrays, or Snowpark & PySpark DataFrames. Most data types will be returned in their original format. But some types (e.g. Snowpark and PySpark) are converted to Pandas DataFrames. To learn about all the supported types, read the st.data_editor API. For example, you can easily let the user add items to a list: edited_list = st.data_editor(["red", "green", "blue"], num_rows= "dynamic") st.write("Here are all the colors you entered:") st.write(edited_list) Or numpy arrays: import numpy as np st.data_editor(np.array([ ["st.text_area", "widget", 4.92], ["st.markdown", "element", 47.22] ])) Or lists of records: st.data_editor([ {"name": "st.text_area", "type": "widget"}, {"name": "st.markdown", "type": "element"}, ]) Or dictionaries and many more types! st.data_editor({ "st.text_area": "widget", "st.markdown": "element" }) Automatic input validation The data editor includes automatic input validation to help prevent errors when editing cells. For example, if you have a column that contains numerical data, the input field will automatically restrict the user to only entering numerical data. This helps to prevent errors that could occur if the user were to accidentally enter a non-numerical value. Additional input validation can be configured through the Column configuration API . Keep reading below for an overview of column configuration, including validation options. Configuring columns You can configure the display and editing behavior of columns in st.dataframe and st.data_editor via the Column configuration API . We have developed the API to let you add images, charts, and clickable URLs in dataframe and data editor columns. Additionally, you can make individual columns editable, set columns as categorical and specify which options they can take, hide the index of the dataframe, and much more. Column configuration includes the following column types: Text, Number, Checkbox, Selectbox, Date, Time, Datetime, List, Link, Image, Line chart, Bar chart, and Progress. There is also a generic Column option. See the embedded app below to view these different column types. Each column type is individually previewed in the Column configuration API documentation. Built with Streamlit 🎈 Fullscreen open_in_new Format values A format parameter is available in column configuration for Text , Date , Time , and Datetime columns. Chart-like columns can also be formatted. Line chart and Bar chart columns have a y_min and y_max parameters to set the vertical bounds. For a Progress column , you can declare the horizontal bounds with min_value and max_value . Validate input When specifying a column configuration, you can declare not only the data type of the column but also value restrictions. All column configuration elements allow you to make a column required with the keyword parameter required=True . For Text and Link columns, you can specify the maximum number of characters with max_chars or use regular expressions to validate entries through validate . Numerical columns, including Number, Date, Time, and Datetime have min_value and max_value parameters. Selectbox columns have a configurable list of options . The data type for Number columns is float by default. Passing a value of type int to any of min_value , max_value , step , or default will set the type for the column as int . Configure an empty dataframe You can use st.data_editor to collect tabular input from a user. When starting from an empty dataframe, default column types are text. Use column configuration to specify the data types you want to collect from users. import streamlit as st import pandas as pd df = pd.DataFrame(columns=['name','age','color']) colors = ['red', 'orange', 'yellow', 'green', 'blue', 'indigo', 'violet'] config = { 'name' : st.column_config.TextColumn('Full Name (required)', width='large', required=True), 'age' : st.column_config.NumberColumn('Age (years)', min_value=0, max_value=122), 'color' : st.column_config.SelectboxColumn('Favorite Color', options=colors) } result = st.data_editor(df, column_config = config, num_rows='dynamic') if st.button('Get results'): st.write(result) Built with Streamlit 🎈 Fullscreen open_in_new Additional formatting options In addition to column configuration, st.dataframe and st.data_editor have a few more parameters to customize the display of your dataframe. hide_index : Set to True to hide the dataframe's index. column_order : Pass a list of column labels to specify the order of display. disabled : Pass a list of column labels to disable them from editing. This let's you avoid disabling them individually. Handling large datasets st.dataframe and st.data_editor have been designed to theoretically handle tables with millions of rows thanks to their highly performant implementation using the glide-data-grid library and HTML canvas. However, the maximum amount of data that an app can realistically handle will depend on several other factors, including: The maximum size of WebSocket messages: Streamlit's WebSocket messages are configurable via the server.maxMessageSize config option , which limits the amount of data that can be transferred via the WebSocket connection at once. The server memory: The amount of data that your app can handle will also depend on the amount of memory available on your server. If the server's memory is exceeded, the app may become slow or unresponsive. The user's browser memory: Since all the data needs to be transferred to the user's browser for rendering, the amount of memory available on the user's device can also affect the app's performance. If the browser's memory is exceeded, it may crash or become unresponsive. In addition to these factors, a slow network connection can also significantly slow down apps that handle large datasets. When handling large datasets with more than 150,000 rows, Streamlit applies additional optimizations and disables column sorting. This can help to reduce the amount of data that needs to be processed at once and improve the app's performance. Limitations Streamlit casts all column names to strings internally, so st.data_editor will return a DataFrame where all column names are strings. The dataframe toolbar is not currently configurable. While Streamlit's data editing capabilities offer a lot of functionality, editing is enabled for a limited set of column types ( TextColumn , NumberColumn , LinkColumn , CheckboxColumn , SelectboxColumn , DateColumn , TimeColumn , and DatetimeColumn ). We are actively working on supporting editing for other column types as well, such as images, lists, and charts. Almost all editable datatypes are supported for index editing. However, pandas.CategoricalIndex and pandas.MultiIndex are not supported for editing. Sorting is not supported for st.data_editor when num_rows="dynamic" . Sorting is deactivated to optimize performance on large datasets with more than 150,000 rows. We are continually working to improve Streamlit's handling of DataFrame and add functionality to data editing, so keep an eye out for updates. Previous: Button behavior and examples Next: Using custom classes forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Static_file_serving_-_Streamlit_Docs.txt
Static file serving - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming remove Configuration options HTTPS support Serving static files Customize your theme App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Configuration and theming / Serving static files Static file serving Streamlit apps can host and serve small, static media files to support media embedding use cases that won't work with the normal media elements . To enable this feature, set enableStaticServing = true under [server] in your config file, or environment variable STREAMLIT_SERVER_ENABLE_STATIC_SERVING=true . Media stored in the folder ./static/ relative to the running app file is served at path app/static/[filename] , such as http://localhost:8501/app/static/cat.png . Details on usage Files with the following extensions will be served normally: ".jpg", ".jpeg", ".png", ".gif" . Any other file will be sent with header Content-Type:text/plain which will cause browsers to render in plain text. This is included for security - other file types that need to render should be hosted outside the app. Streamlit also sets X-Content-Type-Options:nosniff for all files rendered from the static directory. For apps running on Streamlit Community Cloud: Files available in the Github repo will always be served. Any files generated while the app is running, such as based on user interaction (file upload, etc), are not guaranteed to persist across user sessions. Apps which store and serve many files, or large files, may run into resource limits and be shut down. Example usage Put an image cat.png in the folder ./static/ Add enableStaticServing = true under [server] in your .streamlit/config.toml Any media in the ./static/ folder is served at the relative URL like app/static/cat.png # .streamlit/config.toml [server] enableStaticServing = true # app.py import streamlit as st with st.echo(): st.title("CAT") st.markdown("[![Click me](app/static/cat.png)](https://streamlit.io)") Additional resources: https://docs.streamlit.io/develop/concepts/configuration https://static-file-serving.streamlit.app/ Built with Streamlit 🎈 Fullscreen open_in_new Previous: HTTPS support Next: Customize your theme forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
HTTPS_support_-_Streamlit_Docs.txt
HTTPS support - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming remove Configuration options HTTPS support Serving static files Customize your theme App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Configuration and theming / HTTPS support HTTPS support Many apps need to be accessed with SSL / TLS protocol or https:// . We recommend performing SSL termination in a reverse proxy or load balancer for self-hosted and production use cases, not directly in the app. Streamlit Community Cloud uses this approach, and every major cloud and app hosting platform should allow you to configure it and provide extensive documentation. You can find some of these platforms in our Deployment tutorials . To terminate SSL in your Streamlit app, you must configure server.sslCertFile and server.sslKeyFile . Learn how to set config options in Configuration . Details on usage The configuration value should be a local file path to a cert file and key file. These must be available at the time the app starts. Both server.sslCertFile and server.sslKeyFile must be specified. If only one is specified, your app will exit with an error. This feature will not work in Community Cloud. Community Cloud already serves your app with TLS. priority_high Warning In a production environment, we recommend performing SSL termination by the load balancer or the reverse proxy, not using this option. The use of this option in Streamlit has not gone through extensive security audits or performance tests. Example usage # .streamlit/config.toml [server] sslCertFile = '/path/to/certchain.pem' sslKeyFile = '/path/to/private.key' Previous: Configuration options Next: Serving static files forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.checkbox_-_Streamlit_Docs.txt
st.checkbox - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets / st.checkbox st.checkbox Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a checkbox widget. Function signature [source] st.checkbox(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility="visible") Parameters label (str) A short label explaining to the user what this checkbox is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. value (bool) Preselect the checkbox when it first renders. This will be cast to bool internally. key (str or int) An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help (str) An optional tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible" . on_change (callable) An optional callback invoked when this checkbox's value changes. args (tuple) An optional tuple of args to pass to the callback. kwargs (dict) An optional dict of kwargs to pass to the callback. disabled (bool) An optional boolean that disables the checkbox if set to True . The default is False . label_visibility ("visible", "hidden", or "collapsed") The visibility of the label. The default is "visible" . If this is "hidden" , Streamlit displays an empty spacer instead of the label, which can help keep the widget alligned with other widgets. If this is "collapsed" , Streamlit displays no label or spacer. Returns (bool) Whether or not the checkbox is checked. Example import streamlit as st agree = st.checkbox("I agree") if agree: st.write("Great!") Built with Streamlit 🎈 Fullscreen open_in_new Featured videos Check out our video on how to use one of Streamlit's core functions, the checkbox! ☑ In the video below, we'll take it a step further and learn how to combine a button , checkbox and radio button ! Previous: st.page_link Next: st.color_picker forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Caching_and_state_-_Streamlit_Docs.txt
Caching and state - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state remove st.cache_data st.cache_resource st.session_state st.query_params st.experimental_get_query_params delete st.experimental_set_query_params delete Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Caching and state Caching and state Optimize performance and add statefulness to your app! Caching Streamlit provides powerful cache primitives for data and global resources. They allow your app to stay performant even when loading data from the web, manipulating large datasets, or performing expensive computations. Cache data Function decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference). @st.cache_data def long_function(param1, param2): # Perform expensive computation here or # fetch data from the web here return data Cache resource Function decorator to cache functions that return global resources (e.g. database connections, ML models). @st.cache_resource def init_model(): # Return a global resource here return pipeline( "sentiment-analysis", model="distilbert-base-uncased-finetuned-sst-2-english" ) Manage state Streamlit re-executes your script with each user interaction. Widgets have built-in statefulness between reruns, but Session State lets you do more! Session State Save data between reruns and across pages. st.session_state["foo"] = "bar" Query parameters Get, set, or clear the query parameters that are shown in the browser's URL bar. st.query_params[key] = value st.query_params.clear() Deprecated commands delete This command was deprecated in version 1.18.0. Use st.cache_data instead. Memo Experimental function decorator to memoize function executions. @st.experimental_memo def fetch_and_clean_data(url): # Fetch data from URL here, and then clean it up. return data delete This command was deprecated in version 1.18.0. Use st.cache_resource instead. Singleton Experimental function decorator to store singleton objects. @st.experimental_singleton def get_database_session(url): # Create a database session object that points to the URL. return session delete Get query parameters Get query parameters that are shown in the browser's URL bar. param_dict = st.experimental_get_query_params() delete Set query parameters Set query parameters that are shown in the browser's URL bar. st.experimental_set_query_params( {"show_all"=True, "selected"=["asia", "america"]} ) Previous: Execution flow Next: st.cache_data forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.cache_data_-_Streamlit_Docs.txt
st.cache_data - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state remove st.cache_data st.cache_resource st.session_state st.query_params st.experimental_get_query_params delete st.experimental_set_query_params delete Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Caching and state / st.cache_data star Tip This page only contains information on the st.cache_data API. For a deeper dive into caching and how to use it, check out Caching . st.cache_data Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference). Cached objects are stored in "pickled" form, which means that the return value of a cached function must be pickleable. Each caller of the cached function gets its own copy of the cached data. You can clear a function's cache with func.clear() or clear the entire cache with st.cache_data.clear() . A function's arguments must be hashable to cache it. If you have an unhashable argument (like a database connection) or an argument you want to exclude from caching, use an underscore prefix in the argument name. In this case, Streamlit will return a cached value when all other arguments match a previous function call. Alternatively, you can declare custom hashing functions with hash_funcs . To cache global resources, use st.cache_resource instead. Learn more about caching at https://docs.streamlit.io/develop/concepts/architecture/caching . Function signature [source] st.cache_data(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets, hash_funcs=None) Parameters func (callable) The function to cache. Streamlit hashes the function's source code. ttl (float, timedelta, str, or None) The maximum time to keep an entry in the cache. Can be one of: None if cache entries should never expire (default). A number specifying the time in seconds. A string specifying the time in a format supported by Pandas's Timedelta constructor , e.g. "1d" , "1.5 days" , or "1h23s" . A timedelta object from Python's built-in datetime library , e.g. timedelta(days=1) . Note that ttl will be ignored if persist="disk" or persist=True . max_entries (int or None) The maximum number of entries to keep in the cache, or None for an unbounded cache. When a new entry is added to a full cache, the oldest cached entry will be removed. Defaults to None. show_spinner (bool or str) Enable the spinner. Default is True to show a spinner when there is a "cache miss" and the cached data is being created. If string, value of show_spinner param will be used for spinner text. persist ("disk", bool, or None) Optional location to persist cached data to. Passing "disk" (or True) will persist the cached data to the local disk. None (or False) will disable persistence. The default is None. experimental_allow_widgets (bool) delete The cached widget replay functionality was removed in 1.38. Please remove the experimental_allow_widgets parameter from your caching decorators. This parameter will be removed in a future version. Allow widgets to be used in the cached function. Defaults to False. hash_funcs (dict or None) Mapping of types or fully qualified names to hash functions. This is used to override the behavior of the hasher inside Streamlit's caching mechanism: when the hasher encounters an object, it will first check to see if its type matches a key in this dict and, if so, will use the provided function to generate a hash for it. See below for an example of how this can be used. Example import streamlit as st @st.cache_data def fetch_and_clean_data(url): # Fetch data from URL here, and then clean it up. return data d1 = fetch_and_clean_data(DATA_URL_1) # Actually executes the function, since this is the first time it was # encountered. d2 = fetch_and_clean_data(DATA_URL_1) # Does not execute the function. Instead, returns its previously computed # value. This means that now the data in d1 is the same as in d2. d3 = fetch_and_clean_data(DATA_URL_2) # This is a different URL, so the function executes. To set the persist parameter, use this command as follows: import streamlit as st @st.cache_data(persist="disk") def fetch_and_clean_data(url): # Fetch data from URL here, and then clean it up. return data By default, all parameters to a cached function must be hashable. Any parameter whose name begins with _ will not be hashed. You can use this as an "escape hatch" for parameters that are not hashable: import streamlit as st @st.cache_data def fetch_and_clean_data(_db_connection, num_rows): # Fetch data from _db_connection here, and then clean it up. return data connection = make_database_connection() d1 = fetch_and_clean_data(connection, num_rows=10) # Actually executes the function, since this is the first time it was # encountered. another_connection = make_database_connection() d2 = fetch_and_clean_data(another_connection, num_rows=10) # Does not execute the function. Instead, returns its previously computed # value - even though the _database_connection parameter was different # in both calls. A cached function's cache can be procedurally cleared: import streamlit as st @st.cache_data def fetch_and_clean_data(_db_connection, num_rows): # Fetch data from _db_connection here, and then clean it up. return data fetch_and_clean_data.clear(_db_connection, 50) # Clear the cached entry for the arguments provided. fetch_and_clean_data.clear() # Clear all cached entries for this function. To override the default hashing behavior, pass a custom hash function. You can do that by mapping a type (e.g. datetime.datetime ) to a hash function ( lambda dt: dt.isoformat() ) like this: import streamlit as st import datetime @st.cache_data(hash_funcs={datetime.datetime: lambda dt: dt.isoformat()}) def convert_to_utc(dt: datetime.datetime): return dt.astimezone(datetime.timezone.utc) Alternatively, you can map the type's fully-qualified name (e.g. "datetime.datetime" ) to the hash function instead: import streamlit as st import datetime @st.cache_data(hash_funcs={"datetime.datetime": lambda dt: dt.isoformat()}) def convert_to_utc(dt: datetime.datetime): return dt.astimezone(datetime.timezone.utc) priority_high Warning st.cache_data implicitly uses the pickle module, which is known to be insecure. Anything your cached function returns is pickled and stored, then unpickled on retrieval. Ensure your cached functions return trusted values because it is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. Only load data you trust . st.cache_data.clear Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Clear all in-memory and on-disk data caches. Function signature [source] st.cache_data.clear() Example In the example below, pressing the "Clear All" button will clear memoized values from all functions decorated with @st.cache_data . import streamlit as st @st.cache_data def square(x): return x**2 @st.cache_data def cube(x): return x**3 if st.button("Clear All"): # Clear values from *all* all in-memory and on-disk data caches: # i.e. clear values from both square and cube st.cache_data.clear() CachedFunc.clear Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Clear the cached function's associated cache. If no arguments are passed, Streamlit will clear all values cached for the function. If arguments are passed, Streamlit will clear the cached value for these arguments only. Function signature [source] CachedFunc.clear(*args, **kwargs) Parameters *args (Any) Arguments of the cached functions. **kwargs (Any) Keyword arguments of the cached function. Example import streamlit as st import time @st.cache_data def foo(bar): time.sleep(2) st.write(f"Executed foo({bar}).") return bar if st.button("Clear all cached values for `foo`", on_click=foo.clear): foo.clear() if st.button("Clear the cached value of `foo(1)`"): foo.clear(1) foo(1) foo(2) Using Streamlit commands in cached functions Static elements Since version 1.16.0, cached functions can contain Streamlit commands! For example, you can do this: @st.cache_data def get_api_data(): data = api.get(...) st.success("Fetched data from API!") # 👈 Show a success message return data As we know, Streamlit only runs this function if it hasn’t been cached before. On this first run, the st.success message will appear in the app. But what happens on subsequent runs? It still shows up! Streamlit realizes that there is an st. command inside the cached function, saves it during the first run, and replays it on subsequent runs. Replaying static elements works for both caching decorators. You can also use this functionality to cache entire parts of your UI: @st.cache_data def show_data(): st.header("Data analysis") data = api.get(...) st.success("Fetched data from API!") st.write("Here is a plot of the data:") st.line_chart(data) st.write("And here is the raw data:") st.dataframe(data) Input widgets You can also use interactive input widgets like st.slider or st.text_input in cached functions. Widget replay is an experimental feature at the moment. To enable it, you need to set the experimental_allow_widgets parameter: @st.cache_data(experimental_allow_widgets=True) # 👈 Set the parameter def get_data(): num_rows = st.slider("Number of rows to get") # 👈 Add a slider data = api.get(..., num_rows) return data Streamlit treats the slider like an additional input parameter to the cached function. If you change the slider position, Streamlit will see if it has already cached the function for this slider value. If yes, it will return the cached value. If not, it will rerun the function using the new slider value. Using widgets in cached functions is extremely powerful because it lets you cache entire parts of your app. But it can be dangerous! Since Streamlit treats the widget value as an additional input parameter, it can easily lead to excessive memory usage. Imagine your cached function has five sliders and returns a 100 MB DataFrame. Then we’ll add 100 MB to the cache for every permutation of these five slider values – even if the sliders do not influence the returned data! These additions can make your cache explode very quickly. Please be aware of this limitation if you use widgets in cached functions. We recommend using this feature only for isolated parts of your UI where the widgets directly influence the cached return value. priority_high Warning Support for widgets in cached functions is currently experimental. We may change or remove it anytime without warning. Please use it with care! push_pin Note Two widgets are currently not supported in cached functions: st.file_uploader and st.camera_input . We may support them in the future. Feel free to open a GitHub issue if you need them! Previous: Caching and state Next: st.cache_resource forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Limitations_of_custom_components___Streamlit_Docs_.txt
Limitations of custom components - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components remove Intro to custom components Create a Component Publish a Component Limitations Component gallery open_in_new Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Custom components / Limitations Limitations of custom components How do Streamlit Components differ from functionality provided in the base Streamlit package? Streamlit Components are wrapped up in an iframe, which gives you the ability to do whatever you want (within the iframe) using any web technology you like. What types of things aren't possible with Streamlit Components? Because each Streamlit Component gets mounted into its own sandboxed iframe, this implies a few limitations on what is possible with Components: Can't communicate with other Components : Components can’t contain (or otherwise communicate with) other components, so Components cannot be used to build something like a grid layout. Can't modify CSS : A Component can’t modify the CSS that the rest of the Streamlit app uses, so you can't create something to put the app in dark mode, for example. Can't add/remove elements : A Component can’t add or remove other elements of a Streamlit app, so you couldn't make something to remove the app menu, for example. My Component seems to be blinking/stuttering...how do I fix that? Currently, no automatic debouncing of Component updates is performed within Streamlit. The Component creator themselves can decide to rate-limit the updates they send back to Streamlit. Previous: Publish a Component Next: Component gallery forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
App_settings_-_Streamlit_Docs.txt
App settings - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app remove App analytics App settings Delete your app Edit your app Favorite your app Reboot your app Rename your app in GitHub Upgrade Python Upgrade Streamlit Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Manage your app / App settings App settings This page is about your app settings on Streamlit Community Cloud. From your app settings you can view or change your app's URL , manage public or private access to your app , and update your saved secrets for your apps . If you access " Settings " from your app chrome in the upper-right corner of your running app, you can access features to control the appearance of your app while it's running. Access your app settings You can get to your app's settings: From your workspace . From your Cloud logs . Access app settings from your workspace From your workspace at share.streamlit.io , click the overflow icon ( more_vert ) next to your app. Click " Settings ." Access app settings from your Cloud logs From your app at <your-custom-subdomain>.streamlit.app , click " Manage app " in the lower-right corner. Click the overflow menu icon ( more_vert ) and click " Settings ." Change your app settings View or change your app's URL To view or customize your app subdomain from the dashboard: Access your app's settings as described above. On the " General " tab in the "App settings" dialog, see your app's unique subdomain in the "App URL" field. Optional: Enter a new, custom subdomain between 6 and 63 characters in length, and then click " Save ." If a custom subdomain is not available (e.g. because it's already taken or contains restricted words), you'll see an error message. Change your subdomain as indicated. Update your app's share settings Learn how to Share your app . View or update your secrets Access your app's settings as described above. On the " Secrets " tab in the "App settings" dialog, see your app's secrets in the "Secrets" field. Optional: Add, edit, or delete your secrets, and then click " Save ." Learn more about Secrets management for your Community Cloud app . Previous: App analytics Next: Delete your app forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
First_steps_building_Streamlit_apps___Streamlit_Do.txt
First steps building Streamlit apps - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps remove Create an app Create a multipage app code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Get started / First steps First steps building Streamlit apps If you've just read through our Basic concepts and want to get your hands on Streamlit. Check out these tutorials. Make sure you have installed Streamlit so you can execute the code yourself. description Create an app uses the concepts learned in Fundamentals along with caching to walk through making your first app. auto_stories Create a multipage app walks through the easy steps to add pages to your app. Previous: Fundamentals Next: Create an app forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st_column_config_CheckboxColumn___Streamlit_Docs_0.txt
st.column_config.CheckboxColumn - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements remove st.dataframe st.data_editor st.column_config remove Column Text column Number column Checkbox column Selectbox column Datetime column Date column Time column List column Link column Image column Area chart column Line chart column Bar chart column Progress column st.table st.metric st.json Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Data elements / st.column_config / Checkbox column st.column_config.CheckboxColumn Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Configure a checkbox column in st.dataframe or st.data_editor . This is the default column type for boolean values. This command needs to be used in the column_config parameter of st.dataframe or st.data_editor . When used with st.data_editor , editing will be enabled with a checkbox widget. Function signature [source] st.column_config.CheckboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None) Parameters label (str or None) The label shown at the top of the column. If this is None (default), the column name is used. width ("small", "medium", "large", or None) The display width of the column. If this is None (default), the column will be sized to fit the cell contents. Otherwise, this can be one of the following: "small" : 75px wide "medium" : 200px wide "large" : 400px wide help (str or None) An optional tooltip that gets displayed when hovering over the column label. If this is None (default), no tooltip is displayed. disabled (bool or None) Whether editing should be disabled for this column. If this is None (default), Streamlit will decide: indices are disabled and data columns are not. If a column has mixed types, it may become uneditable regardless of disabled . required (bool or None) Whether edited cells in the column need to have a value. If this is False (default), the user can submit empty values for this column. If this is True , an edited cell in this column can only be submitted if its value is not None , and a new row will only be submitted after the user fills in this column. pinned (bool or None) Whether the column is pinned. A pinned column will stay visible on the left side no matter where the user scrolls. If this is None (default), Streamlit will decide: index columns are pinned, and data columns are not pinned. default (bool or None) Specifies the default value in this column when a new row is added by the user. This defaults to None . Examples import pandas as pd import streamlit as st data_df = pd.DataFrame( { "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"], "favorite": [True, False, False, True], } ) st.data_editor( data_df, column_config={ "favorite": st.column_config.CheckboxColumn( "Your favorite?", help="Select your **favorite** widgets", default=False, ) }, disabled=["widgets"], hide_index=True, ) Built with Streamlit 🎈 Fullscreen open_in_new Previous: Number column Next: Selectbox column forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.dialog_-_Streamlit_Docs.txt
st.dialog - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow remove st.dialog st.form st.form_submit_button st.fragment st.rerun st.stop Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Execution flow / st.dialog st.dialog Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Function decorator to create a modal dialog. A function decorated with @st.dialog becomes a dialog function. When you call a dialog function, Streamlit inserts a modal dialog into your app. Streamlit element commands called within the dialog function render inside the modal dialog. The dialog function can accept arguments that can be passed when it is called. Any values from the dialog that need to be accessed from the wider app should generally be stored in Session State. A user can dismiss a modal dialog by clicking outside of it, clicking the " X " in its upper-right corner, or pressing ESC on their keyboard. Dismissing a modal dialog does not trigger an app rerun. To close the modal dialog programmatically, call st.rerun() explicitly inside of the dialog function. st.dialog inherits behavior from st.fragment . When a user interacts with an input widget created inside a dialog function, Streamlit only reruns the dialog function instead of the full script. Calling st.sidebar in a dialog function is not supported. Dialog code can interact with Session State, imported modules, and other Streamlit elements created outside the dialog. Note that these interactions are additive across multiple dialog reruns. You are responsible for handling any side effects of that behavior. Warning Only one dialog function may be called in a script run, which means that only one dialog can be open at any given time. Function signature [source] st.dialog(title, *, width="small") Parameters title (str) The title to display at the top of the modal dialog. It cannot be empty. width ("small", "large") The width of the modal dialog. If width is "small (default), the modal dialog will be 500 pixels wide. If width is "large" , the modal dialog will be about 750 pixels wide. Examples The following example demonstrates the basic usage of @st.dialog . In this app, clicking " A " or " B " will open a modal dialog and prompt you to enter a reason for your vote. In the modal dialog, click " Submit " to record your vote into Session State and rerun the app. This will close the modal dialog since the dialog function is not called during the full-script rerun. import streamlit as st @st.dialog("Cast your vote") def vote(item): st.write(f"Why is {item} your favorite?") reason = st.text_input("Because...") if st.button("Submit"): st.session_state.vote = {"item": item, "reason": reason} st.rerun() if "vote" not in st.session_state: st.write("Vote for your favorite") if st.button("A"): vote("A") if st.button("B"): vote("B") else: f"You voted for {st.session_state.vote['item']} because {st.session_state.vote['reason']}" Built with Streamlit 🎈 Fullscreen open_in_new Previous: Execution flow Next: st.form forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.logo_-_Streamlit_Docs.txt
st.logo - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements remove st.audio st.image st.logo st.video Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Media elements / st.logo st.logo Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Renders a logo in the upper-left corner of your app and its sidebar. If st.logo is called multiple times within a page, Streamlit will render the image passed in the last call. For the most consistent results, call st.logo early in your page script and choose an image that works well in both light and dark mode. Avoid empty margins around your image. If your logo does not work well for both light and dark mode, consider setting the theme and hiding the settings menu from users with the configuration option client.toolbarMode="minimal" . Function signature [source] st.logo(image, *, size="medium", link=None, icon_image=None) Parameters image (Anything supported by st.image (except list)) The image to display in the upper-left corner of your app and its sidebar. This can be any of the types supported by st.image except a list. If icon_image is also provided, then Streamlit will only display image in the sidebar. Streamlit scales the image to a max height set by size and a max width to fit within the sidebar. size ("small", "medium", or "large") The size of the image displayed in the upper-left corner of the app and its sidebar. The possible values are as follows: "small" : 20px max height "medium" (default): 24px max height "large" : 32px max height link (str or None) The external URL to open when a user clicks on the logo. The URL must start with "http://" or "https://". If link is None (default), the logo will not include a hyperlink. icon_image (Anything supported by st.image (except list) or None) An optional, typically smaller image to replace image in the upper-left corner when the sidebar is closed. This can be any of the types supported by st.image except a list. If icon_image is None (default), Streamlit will always display image in the upper-left corner, regardless of whether the sidebar is open or closed. Otherwise, Streamlit will render icon_image in the upper-left corner of the app when the sidebar is closed. Streamlit scales the image to a max height set by size and a max width to fit within the sidebar. If the sidebar is closed, the max width is retained from when it was last open. For best results, pass a wide or horizontal image to image and a square image to icon_image . Or, pass a square image to image and leave icon_image=None . Examples A common design practice is to use a wider logo in the sidebar, and a smaller, icon-styled logo in your app's main body. import streamlit as st st.logo( LOGO_URL_LARGE, link="https://streamlit.io/gallery", icon_image=LOGO_URL_SMALL, ) Try switching logos around in the following example: import streamlit as st HORIZONTAL_RED = "images/horizontal_red.png" ICON_RED = "images/icon_red.png" HORIZONTAL_BLUE = "images/horizontal_blue.png" ICON_BLUE = "images/icon_blue.png" options = [HORIZONTAL_RED, ICON_RED, HORIZONTAL_BLUE, ICON_BLUE] sidebar_logo = st.selectbox("Sidebar logo", options, 0) main_body_logo = st.selectbox("Main body logo", options, 1) st.logo(sidebar_logo, icon_image=main_body_logo) st.sidebar.markdown("Hi!") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.image Next: st.video forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.experimental_singleton_-_Streamlit_Docs.txt
st.experimental_singleton - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state remove st.cache_data st.cache_resource st.session_state st.query_params st.experimental_get_query_params delete st.experimental_set_query_params delete Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Caching and state / st.experimental_singleton priority_high Important This is an experimental feature. Experimental features and their APIs may change or be removed at any time. To learn more, click here . st.experimental_singleton Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake priority_high Warning This method did not exist in version 1.41.0 of Streamlit. st.experimental_singleton.clear Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake priority_high Warning This method did not exist in version 1.41.0 of Streamlit. Example In the example below, pressing the "Clear All" button will clear all singleton caches. i.e. Clears cached singleton objects from all functions decorated with @st.experimental_singleton . import streamlit as st from transformers import BertModel @st.experimental_singleton def get_database_session(url): # Create a database session object that points to the URL. return session @st.experimental_singleton def get_model(model_type): # Create a model of the specified type. return BertModel.from_pretrained(model_type) if st.button("Clear All"): # Clears all singleton caches: st.experimental_singleton.clear() Validating the cache The @st.experimental_singleton decorator is used to cache the output of a function, so that it only needs to be executed once. This can improve performance in certain situations, such as when a function takes a long time to execute or makes a network request. However, in some cases, the cached output may become invalid over time, such as when a database connection times out. To handle this, the @st.experimental_singleton decorator supports an optional validate parameter, which accepts a validation function that is called each time the cached output is accessed. If the validation function returns False, the cached output is discarded and the decorated function is executed again. Best Practices Use the validate parameter when the cached output may become invalid over time, such as when a database connection or an API key expires. Use the validate parameter judiciously, as it will add an additional overhead of calling the validation function each time the cached output is accessed. Make sure that the validation function is as fast as possible, as it will be called each time the cached output is accessed. Consider to validate cached data periodically, instead of each time it is accessed, to mitigate the performance impact. Handle errors that may occur during validation and provide a fallback mechanism if the validation fails. Replay static st elements in cache-decorated functions Functions decorated with @st.experimental_singleton can contain static st elements. When a cache-decorated function is executed, we record the element and block messages produced, so the elements will appear in the app even when execution of the function is skipped because the result was cached. In the example below, the @st.experimental_singleton decorator is used to cache the execution of the get_model function, that returns a 🤗 Hugging Face Transformers model. Notice the cached function also contains a st.bar_chart command, which will be replayed when the function is skipped because the result was cached. import numpy as np import pandas as pd import streamlit as st from transformers import AutoModel @st.experimental_singleton def get_model(model_type): # Contains a static element st.bar_chart st.bar_chart( np.random.rand(10, 1) ) # This will be recorded and displayed even when the function is skipped # Create a model of the specified type return AutoModel.from_pretrained(model_type) bert_model = get_model("distilbert-base-uncased") st.help(bert_model) # Display the model's docstring Supported static st elements in cache-decorated functions include: st.alert st.altair_chart st.area_chart st.audio st.bar_chart st.ballons st.bokeh_chart st.caption st.code st.components.v1.html st.components.v1.iframe st.container st.dataframe st.echo st.empty st.error st.exception st.expander st.experimental_get_query_params st.experimental_set_query_params st.form st.form_submit_button st.graphviz_chart st.help st.image st.info st.json st.latex st.line_chart st.markdown st.metric st.plotly_chart st.progress st.pydeck_chart st.snow st.spinner st.success st.table st.text st.vega_lite_chart st.video st.warning Replay input widgets in cache-decorated functions In addition to static elements, functions decorated with @st.experimental_singleton can also contain input widgets ! Replaying input widgets is disabled by default. To enable it, you can set the experimental_allow_widgets parameter for @st.experimental_singleton to True . The example below enables widget replaying, and shows the use of a checkbox widget within a cache-decorated function. import streamlit as st # Enable widget replay @st.experimental_singleton(experimental_allow_widgets=True) def func(): # Contains an input widget st.checkbox("Works!") func() If the cache decorated function contains input widgets, but experimental_allow_widgets is set to False or unset, Streamlit will throw a CachedStFunctionWarning , like the one below: import streamlit as st # Widget replay is disabled by default @st.experimental_singleton def func(): # Streamlit will throw a CachedStFunctionWarning st.checkbox("Doesn't work") func() How widget replay works Let's demystify how widget replay in cache-decorated functions works and gain a conceptual understanding. Widget values are treated as additional inputs to the function, and are used to determine whether the function should be executed or not. Consider the following example: import streamlit as st @st.experimental_singleton(experimental_allow_widgets=True) def plus_one(x): y = x + 1 if st.checkbox("Nuke the value 💥"): st.write("Value was nuked, returning 0") y = 0 return y st.write(plus_one(2)) The plus_one function takes an integer x as input, and returns x + 1 . The function also contains a checkbox widget, which is used to "nuke" the value of x . i.e. the return value of plus_one depends on the state of the checkbox: if it is checked, the function returns 0 , otherwise it returns 3 . In order to know which value the cache should return (in case of a cache hit), Streamlit treats the checkbox state (checked / unchecked) as an additional input to the function plus_one (just like x ). If the user checks the checkbox (thereby changing its state), we look up the cache for the same value of x (2) and the same checkbox state (checked). If the cache contains a value for this combination of inputs, we return it. Otherwise, we execute the function and store the result in the cache. Let's now understand how enabling and disabling widget replay changes the behavior of the function. Widget replay disabled Widgets in cached functions throw a CachedStFunctionWarning and are ignored. Other static elements in cached functions replay as expected. Widget replay enabled Widgets in cached functions don't lead to a warning, and are replayed as expected. Interacting with a widget in a cached function will cause the function to be executed again, and the cache to be updated. Widgets in cached functions retain their state across reruns. Each unique combination of widget values is treated as a separate input to the function, and is used to determine whether the function should be executed or not. i.e. Each unique combination of widget values has its own cache entry; the cached function runs the first time and the saved value is used afterwards. Calling a cached function multiple times in one script run with the same arguments triggers a DuplicateWidgetID error. If the arguments to a cached function change, widgets from that function that render again retain their state. Changing the source code of a cached function invalidates the cache. Both st.experimental_singleton and st.experimental_memo support widget replay. Fundamentally, the behavior of a function with (supported) widgets in it doesn't change when it is decorated with @st.experimental_singleton or @st.experimental_memo . The only difference is that the function is only executed when we detect a cache "miss". Supported widgets All input widgets are supported in cache-decorated functions. The following is an exhaustive list of supported widgets: st.button st.camera_input st.checkbox st.color_picker st.date_input st.download_button st.file_uploader st.multiselect st.number_input st.radio st.selectbox st.select_slider st.slider st.text_area st.text_input st.time_input Previous: st.experimental_memo Next: st.session_state forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.line_chart_-_Streamlit_Docs.txt
st.line_chart - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements remove SIMPLE st.area_chart st.bar_chart st.line_chart st.map st.scatter_chart ADVANCED st.altair_chart st.bokeh_chart st.graphviz_chart st.plotly_chart st.pydeck_chart st.pyplot st.vega_lite_chart Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Chart elements / st.line_chart st.line_chart Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a line chart. This is syntax-sugar around st.altair_chart . The main difference is this command uses the data's own column and indices to figure out the chart's Altair spec. As a result this is easier to use for many "just plot this" scenarios, while being less customizable. If st.line_chart does not guess the data specification correctly, try specifying your desired chart using st.altair_chart . Function signature [source] st.line_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, width=None, height=None, use_container_width=True) Parameters data (Anything supported by st.dataframe) Data to be plotted. x (str or None) Column name or key associated to the x-axis data. If x is None (default), Streamlit uses the data index for the x-axis values. y (str, Sequence of str, or None) Column name(s) or key(s) associated to the y-axis data. If this is None (default), Streamlit draws the data of all remaining columns as data series. If this is a Sequence of strings, Streamlit draws several series on the same chart by melting your wide-format table into a long-format table behind the scenes. x_label (str or None) The label for the x-axis. If this is None (default), Streamlit will use the column name specified in x if available, or else no label will be displayed. y_label (str or None) The label for the y-axis. If this is None (default), Streamlit will use the column name(s) specified in y if available, or else no label will be displayed. color (str, tuple, Sequence of str, Sequence of tuple, or None) The color to use for different lines in this chart. For a line chart with just one line, this can be: None, to use the default color. A hex string like "#ffaa00" or "#ffaa0088". An RGB or RGBA tuple with the red, green, blue, and alpha components specified as ints from 0 to 255 or floats from 0.0 to 1.0. For a line chart with multiple lines, where the dataframe is in long format (that is, y is None or just one column), this can be: None, to use the default colors. The name of a column in the dataset. Data points will be grouped into lines of the same color based on the value of this column. In addition, if the values in this column match one of the color formats above (hex string or color tuple), then that color will be used. For example: if the dataset has 1000 rows, but this column only contains the values "adult", "child", and "baby", then those 1000 datapoints will be grouped into three lines whose colors will be automatically selected from the default palette. But, if for the same 1000-row dataset, this column contained the values "#ffaa00", "#f0f", "#0000ff", then then those 1000 datapoints would still be grouped into three lines, but their colors would be "#ffaa00", "#f0f", "#0000ff" this time around. For a line chart with multiple lines, where the dataframe is in wide format (that is, y is a Sequence of columns), this can be: None, to use the default colors. A list of string colors or color tuples to be used for each of the lines in the chart. This list should have the same length as the number of y values (e.g. color=["#fd0", "#f0f", "#04f"] for three lines). width (int or None) Desired width of the chart expressed in pixels. If width is None (default), Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. If width is greater than the width of the parent container, Streamlit sets the chart width to match the width of the parent container. To use width , you must set use_container_width=False . height (int or None) Desired height of the chart expressed in pixels. If height is None (default), Streamlit sets the height of the chart to fit its contents according to the plotting library. use_container_width (bool) Whether to override width with the width of the parent container. If use_container_width is True (default), Streamlit sets the width of the chart to match the width of the parent container. If use_container_width is False , Streamlit sets the chart's width according to width . Examples import streamlit as st import pandas as pd import numpy as np chart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"]) st.line_chart(chart_data) Built with Streamlit 🎈 Fullscreen open_in_new You can also choose different columns to use for x and y, as well as set the color dynamically based on a 3rd column (assuming your dataframe is in long format): import streamlit as st import pandas as pd import numpy as np chart_data = pd.DataFrame( { "col1": np.random.randn(20), "col2": np.random.randn(20), "col3": np.random.choice(["A", "B", "C"], 20), } ) st.line_chart(chart_data, x="col1", y="col2", color="col3") Built with Streamlit 🎈 Fullscreen open_in_new Finally, if your dataframe is in wide format, you can group multiple columns under the y argument to show multiple lines with different colors: import streamlit as st import pandas as pd import numpy as np chart_data = pd.DataFrame( np.random.randn(20, 3), columns=["col1", "col2", "col3"] ) st.line_chart( chart_data, x="col1", y=["col2", "col3"], color=["#FF0000", "#0000FF"], # Optional ) Built with Streamlit 🎈 Fullscreen open_in_new element.add_rows Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Concatenate a dataframe to the bottom of the current one. Function signature [source] element.add_rows(data=None, **kwargs) Parameters data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None) Table to concat. Optional. **kwargs (pandas.DataFrame, numpy.ndarray, Iterable, dict, or None) The named dataset to concat. Optional. You can only pass in 1 dataset (including the one in the data parameter). Example import streamlit as st import pandas as pd import numpy as np df1 = pd.DataFrame( np.random.randn(50, 20), columns=("col %d" % i for i in range(20)) ) my_table = st.table(df1) df2 = pd.DataFrame( np.random.randn(50, 20), columns=("col %d" % i for i in range(20)) ) my_table.add_rows(df2) # Now the table shown in the Streamlit app contains the data for # df1 followed by the data for df2. You can do the same thing with plots. For example, if you want to add more data to a line chart: # Assuming df1 and df2 from the example above still exist... my_chart = st.line_chart(df1) my_chart.add_rows(df2) # Now the chart shown in the Streamlit app contains the data for # df1 followed by the data for df2. And for plots whose datasets are named, you can pass the data with a keyword argument where the key is the name: my_chart = st.vega_lite_chart( { "mark": "line", "encoding": {"x": "a", "y": "b"}, "datasets": { "some_fancy_name": df1, # <-- named dataset }, "data": {"name": "some_fancy_name"}, } ) my_chart.add_rows(some_fancy_name=df2) # <-- name used as keyword Previous: st.bar_chart Next: st.map forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Manage_your_app_-_Streamlit_Docs.txt
Manage your app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app remove App analytics App settings Delete your app Edit your app Favorite your app Reboot your app Rename your app in GitHub Upgrade Python Upgrade Streamlit Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Manage your app Manage your app You can manage your deployed app from your workspace at share.streamlit.io or directly from <your-custom-subdomain>.streamlit.app . You can view, deploy, delete, reboot, or favorite an app. Manage your app from your workspace Streamlit Community Cloud is organized into workspaces, which automatically group your apps according to their repository's owner in GitHub. Your workspace is indicated in the upper-left corner. For more information, see Switching workspaces . To deploy or manage any app, always switch to the workspace matching the repository's owner first. Sort your apps If you have many apps in your workspace, you can pin apps to the top by marking them as favorite ( star ). For more information, see Favorite your app . App overflow menus Each app has a menu accessible from the overflow icon ( more_vert ) to the right. Edit with Codespaces — See Edit your app with GitHub Codespaces Reboot — See Reboot your app Delete — See Delete your app Analytics — See App analytics Settings — See App settings If you have view-only access to an app, all options in the app's menu will be disabled except analytics. Manage your app directly from your app You can manage your deployed app directly from the app itself! Just make sure you are signed in to Community Cloud, and then visit your app. Cloud logs From your app at <your-custom-subdomain>.streamlit.app , click " Manage app " in the lower-right corner. Once you've clicked on " Manage app ", you will be able to view your app's logs. This is your primary place to troubleshoot any issues with your app. You can access more developer options by clicking the overflow icon ( more_vert ) at the bottom of your Cloud logs. To conveniently download your logs, click " Download log ." Other options accessible from Cloud logs are: Analytics — See App analytics . Reboot app — See Reboot your app . Delete app — See Delete your app . Settings — See App settings . Your apps — Takes you to your app workspace . Documentation — Takes you to our documentation. Support — Takes you to our forums ! App chrome From your app at <your-custom-subdomain>.streamlit.app , you can always access the app chrome just like you can when developing locally. The option to deploy your app is removed, but you can still clear your cache from here. Manage your app in GitHub Update your app Your GitHub repository is the source for your app, so that means that any time you push an update to your repository you'll see it reflected in the app in almost real time. Try it out! Streamlit also smartly detects whether you touched your dependencies, in which case it will automatically do a full redeploy for you—which will take a little more time. But since most updates don't involve dependency changes, you should usually see your app update in real time. Add or remove dependencies To add or remove dependencies at any point, just update requirements.txt (Python dependenciess) or packages.txt (Linux dependencies), and commit the changes to your repository on GitHub. Community Cloud detects the change in your dependencies and automatically triggers (re)installation. It is best practice to pin your Streamlit version in requirements.txt . Otherwise, the version may be auto-upgraded at any point without your knowledge, which could lead to undesired results (e.g. when we deprecate a feature in Streamlit). App resources and limits Resource limits All Community Cloud users have access to the same resources and are subject to the same limits. These limits may change at any time without notice. If your app meets or exceeds its limits, it may slow down from throttling or become nonfunctional. The limits as of February 2024 are approximately as follows: CPU: 0.078 cores minimum, 2 cores maximum Memory: 690MB minimum, 2.7GBs maximum Storage: No minimum, 50GB maximum Symptoms that your app is running out of resources include the following: Your app is running slowly. Your app displays "🤯 This app has gone over its resource limits." Your app displays "😦 Oh no." Good for the world Streamlit offers increased resources for apps with good-for-the-world use cases. Generally, these apps are used by an educational institution or nonprofit organization, are part of an open-source project, or benefit the world in some way. If your app is not primarily used by a for-profit company you can apply for increased resources . Optimizing your app If your app is running slow or showing the error pages mentioned above, we first highly recommend going through and implementing the suggestions in the following blog posts to prevent your app from hitting the resource limits and to detect if your Streamlit app leaks memory: Common app problems: Resource limits 3 steps to fix app memory leaks If your app exceeds its resource limits, developers and viewers alike will see "😦 Oh no." If see "😦 Oh no." when viewing your app, first check your Cloud logs for any specific errors. If there are no errors in your Cloud logs you are likely dealing with a resource issue. Developer view If you are signed in to a developer account for an app over its limits, you can access " Manage app " from the lower-right corner of the app to reboot it and clear its memory. " Manage app " will be red and have a warning icon ( error ). App hibernation All apps without traffic for one weekday will go to sleep. The system checks apps for inactivity throughout each day as follows: Tuesday through Friday: All apps without traffic for 24 hours (one day) will go to sleep. Saturday through Monday: All apps without traffic for 72 hours (three days) will go to sleep. Community Cloud hibernates apps to conserve resources and allow the best communal use of the platform. To keep your app awake, simply visit the app or commit to your app's repository, even if it's an empty commit! When someone visits a sleeping app, they will see the sleeping page: To wake the app up, click " Yes, get this app back up! " This can be done by anyone who has access to view the app, not just the app developer! You can see which of your apps are asleep from your workspace. Sleeping apps have a moon icon ( bedtime ) to the right. Previous: Deploy your app Next: App analytics forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Secrets_management_-_Streamlit_Docs.txt
Secrets management - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets remove Connecting to data Secrets management Security reminders Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Connections and secrets / Secrets management Secrets management Storing unencrypted secrets in a git repository is a bad practice. For applications that require access to sensitive credentials, the recommended solution is to store those credentials outside the repository - such as using a credentials file not committed to the repository or passing them as environment variables. Streamlit provides native file-based secrets management to easily store and securely access your secrets in your Streamlit app. push_pin Note Existing secrets management tools, such as dotenv files , AWS credentials files , Google Cloud Secret Manager , or Hashicorp Vault , will work fine in Streamlit. We just add native secrets management for times when it's useful. How to use secrets management Develop locally and set up secrets Streamlit provides two ways to set up secrets locally using TOML format: In a global secrets file at ~/.streamlit/secrets.toml for macOS/Linux or %userprofile%/.streamlit/secrets.toml for Windows: # Everything in this section will be available as an environment variable db_username = "Jane" db_password = "mypassword" # You can also add other sections if you like. # The contents of sections as shown below will not become environment variables, # but they'll be easily accessible from within Streamlit anyway as we show # later in this doc. [my_other_secrets] things_i_like = ["Streamlit", "Python"] If you use the global secrets file, you don't have to duplicate secrets across several project-level files if multiple Streamlit apps share the same secrets. In a per-project secrets file at $CWD/.streamlit/secrets.toml , where $CWD is the folder you're running Streamlit from. If both a global secrets file and a per-project secrets file exist, secrets in the per-project file overwrite those defined in the global file . priority_high Important Add this file to your .gitignore so you don't commit your secrets! Use secrets in your app Access your secrets by querying the st.secrets dict, or as environment variables. For example, if you enter the secrets from the section above, the code below shows you how to access them within your Streamlit app. import streamlit as st # Everything is accessible via the st.secrets dict: st.write("DB username:", st.secrets["db_username"]) st.write("DB password:", st.secrets["db_password"]) # And the root-level secrets are also accessible as environment variables: import os st.write( "Has environment variables been set:", os.environ["db_username"] == st.secrets["db_username"], ) star Tip You can access st.secrets via attribute notation (e.g. st.secrets.key ), in addition to key notation (e.g. st.secrets["key"] ) — like st.session_state . You can even compactly use TOML sections to pass multiple secrets as a single attribute. Consider the following secrets: [db_credentials] username = "my_username" password = "my_password" Rather than passing each secret as attributes in a function, you can more compactly pass the section to achieve the same result. See the notional code below, which uses the secrets above: # Verbose version my_db.connect(username=st.secrets.db_credentials.username, password=st.secrets.db_credentials.password) # Far more compact version! my_db.connect(**st.secrets.db_credentials) Error handling Here are some common errors you might encounter when using secrets management. If a .streamlit/secrets.toml is created while the app is running, the server needs to be restarted for changes to be reflected in the app. If you try accessing a secret, but no secrets.toml file exists, Streamlit will raise a FileNotFoundError exception: If you try accessing a secret that doesn't exist, Streamlit will raise a KeyError exception: import streamlit as st st.write(st.secrets["nonexistent_key"]) Use secrets on Streamlit Community Cloud When you deploy your app to Streamlit Community Cloud , you can use the same secrets management workflow as you would locally. However, you'll need to also set up your secrets in the Community Cloud Secrets Management console. Learn how to do so via the Cloud-specific Secrets management documentation. Previous: Connecting to data Next: Security reminders forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.header_-_Streamlit_Docs.txt
st.header - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements remove HEADINGS & BODY st.title st.header st.subheader st.markdown FORMATTED TEXT st.caption st.code st.divider st.echo st.latex st.text UTILITIES st.html link Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Text elements / st.header st.header Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display text in header formatting. Function signature [source] st.header(body, anchor=None, *, help=None, divider=False) Parameters body (str) The text to display as GitHub-flavored Markdown. Syntax information can be found at: https://github.github.com/gfm . See the body parameter of st.markdown for additional, supported Markdown directives. anchor (str or False) The anchor name of the header that can be accessed with #anchor in the URL. If omitted, it generates an anchor using the body. If False, the anchor is not shown in the UI. help (str) An optional tooltip that gets displayed next to the header. divider (bool or “blue”, “green”, “orange”, “red”, “violet”, “gray”/"grey", or “rainbow”) Shows a colored divider below the header. If True, successive headers will cycle through divider colors. That is, the first header will have a blue line, the second header will have a green line, and so on. If a string, the color can be set to one of the following: blue, green, orange, red, violet, gray/grey, or rainbow. Examples import streamlit as st st.header("_Streamlit_ is :blue[cool] :sunglasses:") st.header("This is a header with a divider", divider="gray") st.header("These headers have rotating dividers", divider=True) st.header("One", divider=True) st.header("Two", divider=True) st.header("Three", divider=True) st.header("Four", divider=True) Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.title Next: st.subheader forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Deploy_an_app_from_a_template_-_Streamlit_Docs.txt
Deploy an app from a template - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started remove Quickstart Create your account Connect your GitHub account Explore your workspace Deploy from a template Fork and edit a public app Trust and security Deploy your app add Manage your app add Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Get started / Deploy from a template Deploy an app from a template Streamlit Community Cloud makes it easy to get started with several convenient templates. Just pick a template, and Community Cloud will fork it to your account and deploy it. Any edits you push to your new fork will immediately show up in your deployed app. Additionally, if you don't want to use a local development environment, Community Cloud makes it easy to create a GitHub codespace that's fully configured for Streamlit app development. Access the template picker There are two ways to begin deploying a template: the " Create app " button and the template gallery at the bottom of your workspace. If you click the " Create app " button, Community Cloud will ask you "Do you already have an app?" Select " Nope, create one from a template ." If you scroll to the bottom of your workspace in the " My apps " section, you can see the most popular templates. Click on one directly, or select " View all templates ." The template picker shows a list of available templates on the left. A preview for the current, selected template shows on the right. Select a template From the list of templates on the left, select " GDP dashboard ." Optional: For "Name of new GitHub repository," enter a name for your new, forked repository. When you deploy a template, Community Cloud forks the template repository into your GitHub account. Community Cloud chooses a default name for this repository based on the selected template. If you have previously deployed the same template with its default name, Community Cloud will append an auto-incrementing number to the name. push_pin Note Even if you have another user's or organization's workspace selected, Community Cloud will always deploy a template app from your personal workspace. That is, Community Cloud will always fork a template into your GitHub user account. If you want to deploy a template app from an organization, manually fork the template in GitHub, and deploy it from your fork in the associated workspace. Optional: In the "App URL" field, choose a subdomain for your new app. Every Community Cloud app is deployed to a subdomain on streamlit.app , but you can change your app's subdomain at any time. For more information, see App settings . Optional: To edit the template in a GitHub codespace immediately, select the option to " Open GitHub Codespaces... " You can create a codespace for your app at any time. To learn how to create a codespace after you've deployed an app, see Edit your app . Optional: To change the version of Python, at the bottom of the screen, click " Advanced settings ," select a Python version, and then click " Save ." priority_high Important After an app is deployed, you can't change the version of Python without deleting and redeploying the app. At the bottom, click " Deploy ." View your app If you didn't select the option to open GitHub Codespaces, you are redirected to your new app. If you selected the option to open GitHub Codespaces, you are redirected to your new codespace, which can take several minutes to be fully initialized. After the Visual Studio Code editor appears in your codespace, it can take several minutes to install Python and start the Streamlit server. When complete, a split screen view displays a code editor on the left and a running app on the right. The code editor opens two tabs by default: the repository's readme file and the app's entrypoint file. priority_high Important The app displayed in your codespace is not the same instance you deployed on Community Cloud. Your codespace is a self-contained development environment. When you make edits inside a codespace, those edits don't leave the codespace until you commit them to your repository. When you commit your changes to your repository, Community Cloud detects the changes and updates your deployed app. To learn more, see Edit your app . Previous: Explore your workspace Next: Fork and edit a public app forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
2021_release_notes_-_Streamlit_Docs.txt
2021 release notes - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference remove Cheat sheet Release notes remove 2024 2023 2022 2021 2020 2019 Pre-release features Roadmap open_in_new web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Quick reference / Release notes / 2021 2021 release notes This page contains release notes for Streamlit versions released in 2021. For the latest version of Streamlit, see Release notes . Version 1.3.0 Release date: Dec 16, 2021 Notable Changes 💯 Support for NumPy values in st.metric . 🌐 Support for Mesh Layers in PyDeck. 📊 Updated Plotly chart version to support the latest features. 🏀 st.spinner element has visual animated spinner. 🍰 st.caption supports HTML in text with unsafe_allow_html parameter. Other Changes 🪲 Bug fix: Allow st.session_state to be used to set number_input values with no warning ( #4047 ). 🪲 Bug fix: Fix footer alignment in wide mode ( #4035 ). 🐞 Bug fix: Better support for Graphviz and Bokeh charts in containers (columns, expanders, etc.) ( #4039 ). 🐞 Bug fix: Support inline data values in Vega-Lite ( #4070 ). ✍️ Types: Updated type annotations for experimental memo and singleton decorators. ✍️ Types: Improved type annotations for st.selectbox , st.select_slider , st.radio , st.number_input , and st.multiselect . Version 1.2.0 Release date: Nov 11, 2021 Notable Changes ✏️ st.text_input and st.text_area now have a placeholder parameter to display text when the field is empty. 📏 Viewers can now resize the input box in st.text_area . 📁 Streamlit can auto-reload when files in sub-directories change. 🌈 We've upgraded Bokeh support to 2.4.1! We recommend updating your Bokeh library to 2.4.1 to maintain functionality. Going forward, we'll let you know if there's a mismatch in your Bokeh version via an error prompt. 🔒 Developers can access secrets via attribute notation (e.g. st.secrets.key vs st.secrets["key"] ) just like session state. ✍️ Publish type annotations according to PEP 561 . Users now get type annotations for Streamlit when running mypy ( #4025 ). Other Changes 👀 Visual fixes ( #3863 , #3995 , #3926 , #3975 ). 🍔 Fixes to the hamburger menu ( #3968 ). 🖨️ Ability to print session state ( #3970 ). Version 1.1.0 Release date: Oct 21, 2021 Highlights 🧠 Memory improvements: Streamlit apps allocate way less memory over time now. Notable Changes ♻️ Apps automatically rerun now when the content of secrets.toml changes (before this you had to refresh the page manually). Other Changes 🔗 Redirected some links to our brand-new docs site , e.g. in exceptions. 🪲 Bug fix: Allow initialization of range slider with session state ( #3586 ). 🐞 Bug fix: Refresh chart when using add_rows with datetime index ( #3653 ). ✍️ Added some more type annotation in our codebase ( #3908 ). Version 1.0.0 Release date: Oct 5, 2021 Highlights 🎈Announcing Streamlit 1.0! To read more about check out our 1.0 blog post . Other Changes 🐞 Fixed an issue where using df.dtypes to show datatypes for a DF fails while using Arrow ( #3709 ), Image captions stay within image width and are readable ( #3530 ). Version 0.89.0 Release date: Sep 22, 2021 Highlights 💰 Introducing st.experimental_memo and experimental_singleton , a new primitive for caching! See our blog post . 🍔 Streamlit allows developers to configure their hamburger menu to be more user-centric. Notable Changes 💅 We updated our UI to a more polished look with a new font. 🎨 We now support theme.base in the theme object when it's sent to custom components. 🧠 We've modified session state to reset widgets if any of their arguments changed even if they provide a key. Some widget behavior may have changed, but we believe this change makes the most sense. We have added a section to our documentation describing how they behave. Other Changes 🐞 Bug fixes: Support svgs from a URL ( #3809 ) and that do not start with <svg> tag ( #3789 ). Version 0.88.0 Release date: Sep 2, 2021 Highlights ⬇️ Introducing st.download_button , a new button widget for easily downloading files. Notable Changes 🛑 We made changes to improve the redacted exception experience on Streamlit Community Cloud. When client.showErrorDetails=true exceptions display the Error Type and the Traceback, but redact the actual error text to prevent data leaks. Version 0.87.0 Release date: Aug 19, 2021 Highlights 🔢 Introducing st.metric , an API for displaying KPIs. Check out the demo app showcasing the functionality. Other Changes 🐞 Bug Fixes : File uploader retains state upon expander closing ( #3557 ), setIn Error with st.empty ( #3659 ), Missing IFrame embeds in docs ( #3706 ), Fix error writing certain PNG files ( #3597 ). Version 0.86.0 Release date: Aug 5, 2021 Highlights 🎓 Our layout primitives are graduating from beta! You can now use st.columns , st.container and st.expander without the beta_ prefix. Notable Changes 📱 When using st.columns , columns will stack vertically when viewport size <640px so that column layout on smaller viewports is consistent and cleaner. ( #3594 ). Other Changes 🐞 Bug fixes : Fixed st.date_input crashes if its empty ( #3194 ), Opening files with utf-8( #3022 ), st.select_slider resets its state upon interaction ( #3600 ). Version 0.85.0 Release date: Jul 22, 2021 Highlights 🏹 Streamlit now uses Apache Arrow for serializing data frames when they are sent from Streamlit server to the front end. See our blog post . (Users who wish to continue using the legacy data frame serialization can do so by setting the dataFrameSerialization config option to "legacy" in their config.toml ). Other Changes 🐞 Bug fixes: Unresponsive pydeck example ( #3395 ), JSON parse error message ( #2324 ), Tooltips rendering ( #3300 ), Colorpicker not working on Streamlit Sharing ( #2689 ). Version 0.84.0 Release date: Jul 1, 2021 Highlights 🧠 Introducing st.session_state and widget callbacks to allow you to add statefulness to your apps. Check out the blog post Notable Changes 🪄 st.text_input now has an autocomplete parameter to allow password managers to be used Other Changes Using st.set_page_config to assign the page title no longer appends "Streamlit" to that title ( #3467 ) NumberInput: disable plus/minus buttons when the widget is already at its max (or min) value ( #3493 ) Version 0.83.0 Release date: Jun 17, 2021 Highlights 🛣️ Updates to Streamlit docs to include step-by-step guides which demonstrate how to connect Streamlit apps to various databases & APIs Notable Changes 📄 st.form now has a clear_on_submit parameter which "resets" all the form's widgets when the form is submitted. Other Changes Fixed bugs regarding file encodings ( #3320 , #3108 , #2731 ) Version 0.82.0 Release date: May 13, 2021 Notable Changes ♻️ Improvements to memory management by forcing garbage collection between script runs. Version 0.81.1 Release date: Apr 29, 2021 Highlights 📝 Introducing st.form and st.form_submit_button to allow you to batch input widgets. Check out our blog post 🔤 Introducing st.caption so you can add explainer text anywhere in you apps. 🎨 Updates to Theming, including ability to build a theme that inherits from any of our default themes. 🚀 Improvements to deployment experience to Streamlit sharing from the app menu. Other changes Support for binary files in Custom Components ( #3144 ) Version 0.80.0 Release date: Apr 8, 2021 Highlights 🔐 Streamlit now support Secrets management for apps deployed to Streamlit Sharing! ⚓️ Titles and headers now come with automatically generated anchor links. Just hover over any title and click the 🔗 to get the link! Other changes Added allow-downloads capability to custom components ( #3040 ) Fixed markdown tables in dark theme ( #3020 ) Improved color picker widget in the Custom Theme dialog ( #2970 ) Version 0.79.0 Release date: Mar 18, 2021 Highlights 🌈 Introducing support for custom themes. Check out our blog post 🌚 This release also introduces dark mode! 🛠️ Support for tooltips on all input widgets Other changes Fixed bugs regarding file encodings ( #1936 , #2606 ) and caching functions ( #2728 ) Version 0.78.0 Release date: Mar 4, 2021 Features If you're in the Streamlit for Teams beta, we made a few updates to how secrets work. Check the beta docs for more info! Dataframes now displays timezones for all DateTime and Time columns, and shows the time with the timezone applied, rather than in UTC Notable Bug Fixes Various improvement to column alignment in st.beta_columns Removed the long-deprecated format param from st.image , and replaced with output_format . Version 0.77.0 Release date: Feb 23, 2021 Features Added a new config option client.showErrorDetails allowing the developer to control the granularity of error messages. This is useful for when you deploy an app, and want to conceal from your users potentially-sensitive information contained in tracebacks. Notable bug fixes Fixed bug where st.image wasn't rendering certain kinds of SVGs correctly. Fixed regression where the current value of an st.slider was only shown on hover. Version 0.76.0 Release date: February 4, 2021 Notable Changes 🎨 st.color_picker is now out of beta. This means the old beta_color_picker function, which was marked as deprecated for the past 3 months, has now been replaced with color_picker. 🐍 Display a warning when a Streamlit script is run directly as python script.py . st.image 's use_column_width now defaults to an auto option which will resize the image to the column width if the image exceeds the column width. ✂️ Fixed bugs ( 2437 and 2247 ) with content getting cut off within a st.beta_expander 📜 Fixed a bug in st.dataframe where the scrollbar overlapped with the contents in the last column. 💾 Fixed a bug for st.file_uploader where file data returned was not the most recently uploaded file. ➕ Fixed bugs ( 2086 and 2556 ) where some LaTeX commands were not rendering correctly. Version 0.75.0 Release date: January 21, 2021 Notable Changes 🕳 st.empty previously would clear the component at the end of the script. It has now been updated to clear the component instantly. 🛹 Previously in wide mode, we had thin margins around the webpage. This has now been increased to provide a better visual experience. Version 0.74.0 Release date: January 6, 2021 Notable Changes 💾 st.file_uploader . has been stabilized and the deprecation warning and associated configuration option ( deprecation.showfileUploaderEncoding ) has been removed. 📊 st.bokeh_chart is no longer duplicated when the page loads. 🎈 Fixed page icon to support emojis with variants (i.e. 🤦‍♀️ vs 🤦🏼‍♀️) or dashes (i.e 🌙 - crescent-moon). Previous: 2022 Next: 2020 forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.multiselect_-_Streamlit_Docs.txt
st.multiselect - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets / st.multiselect st.multiselect Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a multiselect widget. The multiselect widget starts as empty. Function signature [source] st.multiselect(label, options, default=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, max_selections=None, placeholder="Choose an option", disabled=False, label_visibility="visible") Parameters label (str) A short label explaining to the user what this select widget is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. options (Iterable) Labels for the select options in an Iterable . This can be a list , set , or anything supported by st.dataframe . If options is dataframe-like, the first column will be used. Each label will be cast to str internally by default. default (Iterable of V, V, or None) List of default values. Can also be a single value. format_func (function) Function to modify the display of the options. It receives the raw option as an argument and should output the label to be shown for that option. This has no impact on the return value of the command. key (str or int) An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help (str) An optional tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible" . on_change (callable) An optional callback invoked when this widget's value changes. args (tuple) An optional tuple of args to pass to the callback. kwargs (dict) An optional dict of kwargs to pass to the callback. max_selections (int) The max selections that can be selected at a time. placeholder (str) A string to display when no options are selected. Defaults to "Choose an option." disabled (bool) An optional boolean that disables the multiselect widget if set to True . The default is False . label_visibility ("visible", "hidden", or "collapsed") The visibility of the label. The default is "visible" . If this is "hidden" , Streamlit displays an empty spacer instead of the label, which can help keep the widget alligned with other widgets. If this is "collapsed" , Streamlit displays no label or spacer. Returns (list) A list with the selected options Example import streamlit as st options = st.multiselect( "What are your favorite colors", ["Green", "Yellow", "Red", "Blue"], ["Yellow", "Red"], ) st.write("You selected:", options) Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.feedback Next: st.pills forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Manage_your_GitHub_connection_-_Streamlit_Docs.txt
Manage your GitHub connection - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app add Share your app add Manage your account remove Sign in & sign out Workspace settings Manage your GitHub connection Update your email Delete your account Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Manage your account / Manage your GitHub connection Manage your GitHub connection If you have created an account but not yet connected GitHub, see Connect your GitHub account . If you have already connected your GitHub account but still need to allow Streamlit Community Cloud to access private repositories, see Optional: Add access to private repositories . Add access to an organization If you are in an organization, you can grant or request access to that organization when you connect your GitHub account. For more information, see Organization access . If your GitHub account is already connected, you can remove permissions in your GitHub settings and force Streamlit to reprompt for GitHub authorization the next time you sign in to Community Cloud. Revoke and reauthorize From your workspace, click on your workspace name in the upper-right corner. To sign out of Community Cloud, click " Sign out ." Go to your GitHub application settings at github.com/settings/applications . Find the "Streamlit" application, and click on the three dots ( more_horiz ) to open the overflow menu. If you have ever signed in to Community Cloud using GitHub, you will also see the "Streamlit Community Cloud" application in your GitHub account. The "Streamlit" application manages repository access. The "Streamlit Community Cloud" application is only for managing your identity (email) on Community Cloud. You only need to revoke access to the "Streamlit" application. Click " Revoke ." Click " I understand, revoke access ." Return to share.streamlit.io and sign in. You will be prompted to authorize GitHub as explained in Connect GitHub . Granting previously denied access If an organization owner has restricted Streamlit's access or restricted all OAuth applications, they may need to directly modify their permissions in GitHub. If an organization has restricted Streamlit's access, a red X ( close ) will appear next to the organization when you are prompted to authorize with your GitHub account. See GitHub's documentation on OAuth apps and organizations . Rename your GitHub account or repositories Community Cloud identifies apps by their GitHub coordinates (owner, repository, branch, entrypoint file path). If you rename your account or repository from which you've deployed an app, you will lose access to administer the app. To learn more, see Rename your app in GitHub . Previous: Workspace settings Next: Update your email forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.write_-_Streamlit_Docs.txt
st.write - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic remove st.write st.write_stream magic Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Write and magic / st.write st.write Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Write arguments to the app. This is the Swiss Army knife of Streamlit commands: it does different things depending on what you throw at it. Unlike other Streamlit commands, write() has some unique properties: You can pass in multiple arguments, all of which will be written. Its behavior depends on the input types as follows. It returns None, so its "slot" in the App cannot be reused. Function signature [source] st.write(*args, unsafe_allow_html=False, **kwargs) Parameters *args (any) One or many objects to print to the App. Arguments are handled as follows: write(string) : Prints the formatted Markdown string, with support for LaTeX expression, emoji shortcodes, and colored text. See docs for st.markdown for more. write(dataframe) : Displays any dataframe-like object in an interactive table. write(dict) : Displays dict-like in an interactive viewer. write(list) : Displays list-like in an interactive viewer. write(error) : Prints an exception specially. write(func) : Displays information about a function. write(module) : Displays information about a module. write(class) : Displays information about a class. write(DeltaGenerator) : Displays information about a DeltaGenerator. write(mpl_fig) : Displays a Matplotlib figure. write(generator) : Streams the output of a generator. write(openai.Stream) : Streams the output of an OpenAI stream. write(altair) : Displays an Altair chart. write(PIL.Image) : Displays an image. write(keras) : Displays a Keras model. write(graphviz) : Displays a Graphviz graph. write(plotly_fig) : Displays a Plotly figure. write(bokeh_fig) : Displays a Bokeh figure. write(sympy_expr) : Prints SymPy expression using LaTeX. write(htmlable) : Prints _repr_html_() for the object if available. write(db_cursor) : Displays DB API 2.0 cursor results in a table. write(obj) : Prints str(obj) if otherwise unknown. unsafe_allow_html (bool) Whether to render HTML within *args . This only applies to strings or objects falling back on _repr_html_() . If this is False (default), any HTML tags found in body will be escaped and therefore treated as raw text. If this is True , any HTML expressions within body will be rendered. Adding custom HTML to your app impacts safety, styling, and maintainability. Note If you only want to insert HTML or CSS without Markdown text, we recommend using st.html instead. **kwargs (any) delete **kwargs is deprecated and will be removed in a later version. Use other, more specific Streamlit commands to pass additional keyword arguments. Keyword arguments. Not used. Example Its basic use case is to draw Markdown-formatted text, whenever the input is a string: import streamlit as st st.write("Hello, *World!* :sunglasses:") Built with Streamlit 🎈 Fullscreen open_in_new As mentioned earlier, st.write() also accepts other data formats, such as numbers, data frames, styled data frames, and assorted objects: import streamlit as st import pandas as pd st.write(1234) st.write( pd.DataFrame( { "first column": [1, 2, 3, 4], "second column": [10, 20, 30, 40], } ) ) Built with Streamlit 🎈 Fullscreen open_in_new Finally, you can pass in multiple arguments to do things like: import streamlit as st st.write("1 + 1 = ", 2) st.write("Below is a DataFrame:", data_frame, "Above is a dataframe.") Built with Streamlit 🎈 Fullscreen open_in_new Oh, one more thing: st.write accepts chart objects too! For example: import streamlit as st import pandas as pd import numpy as np import altair as alt df = pd.DataFrame(np.random.randn(200, 3), columns=["a", "b", "c"]) c = ( alt.Chart(df) .mark_circle() .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"]) ) st.write(c) Built with Streamlit 🎈 Fullscreen open_in_new Featured video Learn what the st.write and magic commands are and how to use them. Previous: Write and magic Next: st.write_stream forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
2020_release_notes_-_Streamlit_Docs.txt
2020 release notes - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference remove Cheat sheet Release notes remove 2024 2023 2022 2021 2020 2019 Pre-release features Roadmap open_in_new web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Quick reference / Release notes / 2020 2020 release notes This page contains release notes for Streamlit versions released in 2020. For the latest version of Streamlit, see Release notes . Version 0.73.0 Release date: December 17, 2020 Notable Changes 🐍 Streamlit can now be installed on Python 3.9. Streamlit components are not yet compatible with Python 3.9 and must use version 3.8 or earlier. 🧱 Streamlit Components now allows same origin, enabling features provided by the browser such as a webcam component. 🐙 Fix Streamlit sharing deploy experience for users running on Git versions 2.7.0 or earlier. 🧰 Handle unexpected closing of uploaded files for st.file_uploader . Version 0.72.0 Release date: December 2, 2020 Notable Changes 🌈 Establish a framework for theming and migrate existing components. 📱 Improve the sidebar experience for mobile devices. 🧰 Update st.file_uploader to reduce reruns. Version 0.71.0 Release date: November 11, 2020 Notable Changes 📁 Updated st.file_uploader to automatically reset buffer on app reruns. 📊 Optimize the default rendering of charts and reduce issues with the initial render. Version 0.70.0 Release date: October 28, 2020 Notable Changes 🧪 st.set_page_config and st.color_picker have now been moved into the Streamlit namespace. These will be removed from beta January 28th, 2021. Learn more about our beta process here . 📊 Improve display of bar charts for discrete values. Version 0.69.0 Release date: October 15, 2020 Highlights: 🎁 Introducing Streamlit sharing, the best way to deploy, manage, and share your public Streamlit apps—for free. Read more about it on our blog post or sign up here ! Added st.experimental_rerun to programatically re-run your app. Thanks SimonBiggs ! Notable Changes 📹 Better support across browsers for start and stop times for st.video. 🖼 Bug fix for intermittently failing media files 📦 Bug fix for custom components compatibility with Safari. Make sure to upgrade to the latest streamlit-component-lib . Version 0.68.0 Release date: October 8, 2020 Highlights: ⌗ Introducing new layout options for Streamlit! Move aside, vertical layout. Make a little space for... horizontal layout! Check out our blog post . 💾 File uploader redesigned with new functionality for multiple files uploads and better support for working with uploaded files. This may cause breaking changes. Please see the new api in our documentation Notable Changes 🎈 st.balloon has gotten a facelift with nicer balloons and smoother animations. 🚨 Breaking Change: Following the deprecation of st.deck_gl_chart in January 2020, we have now removed the API completely. Please use st.pydeck_chart instead. 🚨 Breaking Change: Following the deprecation of width and height for st.altair_chart , st.graphviz_chart , st.plotly_chart , and st.vega_lite_chart in January 2020, we have now removed the args completely. Please set the width and height in the respective charting library. Version 0.67.0 Release date: September 16, 2020 Highlights: 🦷 Streamlit Components can now return bytes to your Streamlit App. To create a component that returns bytes, make sure to upgrade to the latest streamlit-component-lib . Notable Changes 📈 Deprecation warning: Beginning December 1st, 2020 st.pyplot() will require a figure to be provided. To disable the deprecation warning, please set deprecation.showPyplotGlobalUse to False 🎚 st.multiselect and st.select are now lightning fast when working with large datasets. Thanks masa3141 ! Version 0.66.0 Release date: September 1, 2020 Highlights: ✏️ st.write is now available for use in the sidebar! 🎚 A slider for distinct or non-numerical values is now available with st.select_slider . ⌗ Streamlit Components can now return dataframes to your Streamlit App. Check out our SelectableDataTable example . 📦 The Streamlit Components library used in our Streamlit Component template is now available as a npm package ( streamlit-component-lib ) to simplify future upgrades to the latest version. Existing components do not need to migrate. Notable Changes 🐼 Support StringDtype from pandas version 1.0.0 🧦 Support for running Streamlit on Unix sockets Version 0.65.0 Release date: August 12, 2020 Highlights: ⚙️ Ability to set page title, favicon, sidebar state, and wide mode via st.beta_set_page_config(). See our documentation for details. 📝 Add stateful behaviors through the use of query parameters with st.experimental_set_query_params and st.experimental_get_query_params. Thanks @zhaoooyue ! 🐼 Improved pandas dataframe support for st.radio, st.selectbox, and st.multiselect. 🛑 Break out of your Streamlit app with st.stop. 🖼 Inline SVG support for st.image. Callouts: 🚨Deprecation Warning: The st.image parameter format has been renamed to output_format. Version 0.64.0 Release date: July 23, 2020 Highlights: 📊 Default matplotlib to display charts with a tight layout. To disable this, set bbox_inches to None , inches as a string, or a Bbox 🗃 Deprecation warning for automatic encoding on st.file_uploader 🙈 If gatherUserStats is False , do not even load the Segment library. Thanks @tanmaylaud ! Version 0.63.0 Release date: July 13, 2020 Highlights: 🧩 Support for Streamlit Components!!! See documentation for more info. 🕗 Support for datetimes in st.slider . And, of course, just like any other value you use in st.slider , you can also pass in two-element lists to get a datetime range slider. Version 0.62.0 Release date: June 21, 2020 Highlights: 📨 Ability to turn websocket compression on/off via the config option server.enableWebsocketCompression . This is useful if your server strips HTTP headers and you do not have access to change that behavior. 🗝️ Out-of-the-box support for CSRF protection using the Cookie-to-header token technique. This means that if you're serving your Streamlit app from multiple replicas you'll need to configure them to to use the same cookie secret with the server.cookieSecret config option. To turn XSRF protection off, set server.enableXsrfProtection=false . Notable bug fixes: 🖼️ Added a grace period to the image cache expiration logic in order to fix multiple related bugs where images sent with st.image or st.pyplot were sometimes missing. Version 0.61.0 Release date: June 2, 2020 Highlights: 📅 Support for date ranges in st.date_picker . See docs for more info, but the TLDR is: just pass a list/tuple as the default date and it will be interpreted as a range. 🗣️ You can now choose whether st.echo prints the code above or below the output of the echoed block. To learn more, refer to the code_location argument in the docs . 📦 Improved @st.cache support for Keras models and Tensorflow saved_models . Version 0.60.0 Release date: May 18, 2020 Highlights: ↕️ Ability to set the height of an st.text_area with the height argument (expressed in pixels). See docs for more. 🔡 Ability to set the maximimum number of characters allowed in st.text_area or st.text_input . Check out the max_chars argument in the docs . 🗺️ Better DeckGL support for the H3 geospatial indexing system. So now you can use things like H3HexagonLayer in st.pydeck_chart . 📦 Improved @st.cache support for PyTorch TensorBase and Model. Version 0.59.0 Release date: May 05, 2020 Highlights: 🎨 New color-picker widget! Use it with st.beta_color_picker() 🧪 Introducing st.beta_* and st.experimental_* function prefixes, for faster Streamlit feature releases. See docs for more info. 📦 Improved @st.cache support for SQL Alchemy objects, CompiledFFI, PyTorch Tensors, and builtins.mappingproxy . Version 0.58.0 Release date: April 22, 2020 Highlights: 💼 Made st.selectbox filtering case-insensitive. ㈬ Better support for Tensorflow sessions in @st.cache . 📊 Changed behavior of st.pyplot to auto-clear the figure only when using the global Matplotlib figure (i.e. only when calling st.pyplot() rather than st.pyplot(fig) ). Version 0.57.0 Release date: March 26, 2020 Highlights: ⏲️ Ability to set expiration options for @st.cache 'ed functions by setting the max_entries and ttl arguments. See docs . 🆙 Improved the machinery behind st.file_uploader , so it's much more performant now! Also increased the default upload limit to 200MB (configurable via server.max_upload_size ). 🔒 The server.address config option now binds the server to that address for added security. 📄 Even more details added to error messages for @st.cache for easier debugging. Version 0.56.0 Release date: February 15, 2020 Highlights: 📄 Improved error messages for st.cache. The errors now also point to the new caching docs we just released. Read more here ! Breaking changes: 🐍 As announced last month , Streamlit no longer supports Python 2. To use Streamlit you'll need Python 3.5 or above. Version 0.55.0 Release date: February 4, 2020 Highlights: 📺 Ability to record screencasts directly from Streamlit! This allows you to easily record and share explanations about your models, analyses, data, etc. Just click ☰ then "Record a screencast". Give it a try! Version 0.54.0 Release date: January 29, 2020 Highlights: ⌨️ Support for password fields! Just pass type="password" to st.text_input() . Notable fixes: ✳️ Numerous st.cache improvements, including better support for complex objects. 🗣️ Fixed cross-talk in sidebar between multiple users. Breaking changes: If you're using the SessionState hack Gist, you should re-download it! Depending on which hack you're using, here are some links to save you some time: SessionState.py st_state_patch.py Version 0.53.0 Release date: January 14, 2020 Highlights: 🗺️ Support for all DeckGL features! Just use Pydeck instead of st.deck_gl_chart . To do that, simply pass a PyDeck object to st.pydeck_chart , st.write , or magic . Note that as a preview release things may change in the near future. Looking forward to hearing input from the community before we stabilize the API! The goals is for this to replace st.deck_gl_chart , since it is does everything the old API did and much more! 🆕 Better handling of Streamlit upgrades while developing. We now auto-reload the browser tab if the app it is displaying uses a newer version of Streamlit than the one the tab is running. 👑 New favicon, with our new logo! Notable fixes: Magic now works correctly in Python 3.8. It no longer causes docstrings to render in your app. Breaking changes: Updated how we calculate the default width and height of all chart types. We now leave chart sizing up to your charting library itself, so please refer to the library's documentation. As a result, the width and height arguments have been deprecated from most chart commands, and use_container_width has been introduced everywhere to allow you to make charts fill as much horizontal space as possible (this used to be the default). Previous: 2021 Next: 2019 forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Manage_your_account_-_Streamlit_Docs.txt
Manage your account - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app add Share your app add Manage your account remove Sign in & sign out Workspace settings Manage your GitHub connection Update your email Delete your account Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Manage your account Manage your account You can Update your email or completely Delete your account through Workspace settings . Your Streamlit Community Cloud account is identified by your email. When you sign in to Community Cloud, regardless of which method you use, you are providing Community Cloud with your email address. In particular, when you sign in to Community Cloud using GitHub, you are using the primary email on your GitHub account. You can view your email identity and source-control identity from your workspace settings, under " Linked accounts ." Access your workspace settings Sign in to share.streamlit.io . In the upper-left corner, click on your workspace name. In the drop-down menu, click " Settings ." Previous: Share your app Next: Sign in & sign out forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st_connections_SnowflakeConnection___Streamlit_Doc.txt
st.connections.SnowflakeConnection - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets remove SECRETS st.secrets secrets.toml CONNECTIONS st.connection SnowflakeConnection SQLConnection BaseConnection SnowparkConnection delete Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Connections and secrets / SnowflakeConnection star Tip This page only contains the st.connections.SnowflakeConnection class. For a deeper dive into creating and managing data connections within Streamlit apps, see Connect Streamlit to Snowflake and Connecting to data . st.connections.SnowflakeConnection Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake A connection to Snowflake using the Snowflake Connector for Python. Initialize this connection object using st.connection("snowflake") or st.connection("<name>", type="snowflake") . Connection parameters for a SnowflakeConnection can be specified using secrets.toml and/or **kwargs . Connection parameters are passed to snowflake.connector.connect() . When an app is running in Streamlit in Snowflake, st.connection("snowflake") connects automatically using the app owner's role without further configuration. **kwargs will be ignored in this case. Use secrets.toml and **kwargs to configure your connection for local development. SnowflakeConnection includes several convenience methods. For example, you can directly execute a SQL query with .query() or access the underlying Snowflake Connector object with .raw_connection . Tip snowflake-snowpark-python must be installed in your environment to use this connection. You can install Snowflake extras along with Streamlit: >>> pip install streamlit[snowflake] Important Account identifiers must be of the form <orgname>-<account_name> where <orgname> is the name of your Snowflake organization and <account_name> is the unique name of your account within your organization. This is dash-separated, not dot-separated like when used in SQL queries. For more information, see Account identifiers . Class description [source] st.connections.SnowflakeConnection(connection_name, **kwargs) Methods cursor () Create a new cursor object from this connection. query (sql, *, ttl=None, show_spinner="Running `snowflake.query(...)`.", params=None, **kwargs) Run a read-only SQL query. reset () Reset this connection so that it gets reinitialized the next time it's used. session () Create a new Snowpark session from this connection. write_pandas (df, table_name, database=None, schema=None, chunk_size=None, **kwargs) Write a pandas.DataFrame to a table in a Snowflake database. Attributes raw_connection Access the underlying connection object from the Snowflake Connector for Python. Examples Example 1: Configuration with Streamlit secrets You can configure your Snowflake connection using Streamlit's Secrets management . For example, if you have MFA enabled on your account, you can connect using key-pair authentication . .streamlit/secrets.toml : [connections.snowflake] account = "xxx-xxx" user = "xxx" private_key_file = "/xxx/xxx/xxx.p8" role = "xxx" warehouse = "xxx" database = "xxx" schema = "xxx" Your app code: import streamlit as st conn = st.connection("snowflake") df = conn.query("SELECT * FROM my_table") Example 2: Configuration with keyword arguments and external authentication You can configure your Snowflake connection with keyword arguments (with or without secrets.toml ). For example, if your Snowflake account supports SSO, you can set up a quick local connection for development using browser-based SSO . import streamlit as st conn = st.connection( "snowflake", account="xxx-xxx", user="xxx", authenticator="externalbrowser" ) df = conn.query("SELECT * FROM my_table") Example 3: Named connection with Snowflake's connection configuration file Snowflake's Python Connector supports a connection configuration file , which is well integrated with Streamlit's SnowflakeConnection . If you already have one or more connections configured, all you need to do is pass the name of the connection to use. ~/.snowflake/connections.toml : [my_connection] account = "xxx-xxx" user = "xxx" password = "xxx" warehouse = "xxx" database = "xxx" schema = "xxx" Your app code: import streamlit as st conn = st.connection("my_connection", type="snowflake") df = conn.query("SELECT * FROM my_table") Example 4: Named connection with Streamlit secrets and Snowflake's connection configuration file If you have a Snowflake configuration file with a connection named my_connection as in Example 3, you can pass the connection name through secrets.toml . .streamlit/secrets.toml : [connections.snowflake] connection_name = "my_connection" Your app code: import streamlit as st conn = st.connection("snowflake") df = conn.query("SELECT * FROM my_table") Example 5: Default connection with an environment variable If you have a Snowflake configuration file with a connection named my_connection as in Example 3, you can set an environment variable to declare it as the default Snowflake connection. SNOWFLAKE_DEFAULT_CONNECTION_NAME = "my_connection" Your app code: import streamlit as st conn = st.connection("snowflake") df = conn.query("SELECT * FROM my_table") Example 6: Default connection in Snowflake's connection configuration file If you have a Snowflake configuration file that defines your default connection, Streamlit will automatically use it if no other connection is declared. ~/.snowflake/connections.toml : [default] account = "xxx-xxx" user = "xxx" password = "xxx" warehouse = "xxx" database = "xxx" schema = "xxx" Your app code: import streamlit as st conn = st.connection("snowflake") df = conn.query("SELECT * FROM my_table") SnowflakeConnection.cursor Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Create a new cursor object from this connection. Snowflake Connector cursors implement the Python Database API v2.0 specification (PEP-249). For more information, see the Snowflake Connector for Python documentation . Function signature [source] SnowflakeConnection.cursor() Returns (snowflake.connector.cursor.SnowflakeCursor) A cursor object for the connection. Example The following example uses a cursor to insert multiple rows into a table. The qmark parameter style is specified as an optional keyword argument. Alternatively, the parameter style can be declared in your connection configuration file. For more information, see the Snowflake Connector for Python documentation . import streamlit as st conn = st.connection("snowflake", "paramstyle"="qmark") rows_to_insert = [("Mary", "dog"), ("John", "cat"), ("Robert", "bird")] conn.cursor().executemany( "INSERT INTO mytable (name, pet) VALUES (?, ?)", rows_to_insert ) SnowflakeConnection.query Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Run a read-only SQL query. This method implements query result caching and simple error handling/retries. The caching behavior is identical to that of using @st.cache_data . Note Queries that are run without a specified ttl are cached indefinitely. Function signature [source] SnowflakeConnection.query(sql, *, ttl=None, show_spinner="Running `snowflake.query(...)`.", params=None, **kwargs) Parameters sql (str) The read-only SQL query to execute. ttl (float, int, timedelta or None) The maximum number of seconds to keep results in the cache. If this is None (default), cached results do not expire with time. show_spinner (boolean or string) Whether to enable the spinner. When a cached query is executed, no spinner is displayed because the result is immediately available. When a new query is executed, the default is to show a spinner with the message "Running snowflake.query(...) ." If this is False , no spinner displays while executing the query. If this is a string, the string will be used as the message for the spinner. params (list, tuple, dict or None) List of parameters to pass to the Snowflake Connector for Python Cursor.execute() method. This connector supports binding data to a SQL statement using qmark bindings. For more information and examples, see the Snowflake Connector for Python documentation . This defaults to None . Returns (pandas.DataFrame) The result of running the query, formatted as a pandas DataFrame. Example import streamlit as st conn = st.connection("snowflake") df = conn.query("SELECT * FROM my_table") st.dataframe(df) SnowflakeConnection.raw_connection Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Access the underlying connection object from the Snowflake Connector for Python. For information on how to use the Snowflake Connector for Python, see the Snowflake Connector for Python documentation . Function signature [source] SnowflakeConnection.raw_connection Returns (snowflake.connector.connection.SnowflakeConnection) The connection object. Example The following example uses a cursor to submit an asynchronous query, saves the query ID, then periodically checks the query status through the connection before retrieving the results. import streamlit as st import time conn = st.connection("snowflake") cur = conn.cursor() cur.execute_async("SELECT * FROM my_table") query_id = cur.sfqid while True: status = conn.raw_connection.get_query_status(query_id) if conn.raw_connection.is_still_running(status): time.sleep(1) else: break cur.get_results_from_sfqid(query_id) df = cur.fetchall() SnowflakeConnection.reset Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Reset this connection so that it gets reinitialized the next time it's used. This method can be useful when a connection has become stale, an auth token has expired, or in similar scenarios where a broken connection might be fixed by reinitializing it. Note that some connection methods may already use reset() in their error handling code. Function signature [source] SnowflakeConnection.reset() Returns (None) No description Example import streamlit as st conn = st.connection("my_conn") # Reset the connection before using it if it isn't healthy # Note: is_healthy() isn't a real method and is just shown for example here. if not conn.is_healthy(): conn.reset() # Do stuff with conn... SnowflakeConnection.session Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Create a new Snowpark session from this connection. For information on how to use Snowpark sessions, see the Snowpark developer guide and Snowpark API Reference . Function signature [source] SnowflakeConnection.session() Returns (snowflake.snowpark.Session) A new Snowpark session for this connection. Example The following example creates a new Snowpark session and uses it to run a query. import streamlit as st conn = st.connection("snowflake") session = conn.session() df = session.sql("SELECT * FROM my_table").collect() SnowflakeConnection.write_pandas Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Write a pandas.DataFrame to a table in a Snowflake database. This convenience method is a thin wrapper around snowflake.connector.pandas_tools.write_pandas() using the underlying connection. The conn parameter is passed automatically. For more information and additional keyword arguments, see the Snowflake Connector for Python documentation . Function signature [source] SnowflakeConnection.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs) Parameters df (pandas.DataFrame) The pandas.DataFrame object containing the data to be copied into the table. table_name (str) Name of the table where the data should be copied to. database (str) Name of the database containing the table. By default, the function writes to the database that is currently in use in the session. Note If you specify this parameter, you must also specify the schema parameter. schema (str) Name of the schema containing the table. By default, the function writes to the table in the schema that is currently in use in the session. chunk_size (int) Number of elements to insert at a time. By default, the function inserts all elements in one chunk. **kwargs (Any) Additional keyword arguments for snowflake.connector.pandas_tools.write_pandas() . Returns (tuple[bool, int, int]) A tuple containing three values: A boolean value that is True if the write was successful. An integer giving the number of chunks of data that were copied. An integer giving the number of rows that were inserted. Example The following example uses the database and schema currently in use in the session and copies the data into a table named "my_table." import streamlit as st import pandas as pd df = pd.DataFrame( {"Name": ["Mary", "John", "Robert"], "Pet": ["dog", "cat", "bird"]} ) conn = st.connection("snowflake") conn.write_pandas(df, "my_table") Previous: st.connection Next: SQLConnection forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Create_your_account_-_Streamlit_Docs.txt
Create your account - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started remove Quickstart Create your account Connect your GitHub account Explore your workspace Deploy from a template Fork and edit a public app Trust and security Deploy your app add Manage your app add Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Get started / Create your account Create your account Before you can start deploying apps for the world to see, you need to sign up for your Streamlit Community Cloud account. Each Community Cloud account is associated with an email. Two accounts can't have the same email. When sharing a private app, you will assign viewing privileges by email. Additionally, two accounts can't have the same source control (GitHub account). If you try to create a second Community Cloud account with the same source control, Community Cloud will merge the accounts. Sign up Community Cloud allows you to sign in using one of the three following methods: Emailed, one-use codes Google GitHub priority_high Important Even when you sign in through GitHub, the authentication flow returns your email address to Community Cloud. Changing the email on your GitHub account can affect your Community Cloud account if you sign in through GitHub. Go to share.streamlit.io . Click " Continue to sign-in ." Continue with one of the three options listed below. Option 1: Sign in using emailed codes In the "Email" field, enter your email address. Click " Continue ." (If prompted, verify you are human.) Go to your email inbox, and copy your one-time, six-digit code. The code is valid for ten minutes. Return to the authentication page, and enter your code. (If prompted, verify you are human.) Option 2: Sign in using Google Click " Continue with Google ." Enter your Google credentials, and follow Google's authentication prompts. Option 3: Sign in using GitHub Click " Continue with GitHub ." Enter your GitHub credentials, and follow GitHub's authentication prompts. This adds the "Streamlit Community Cloud" OAuth application to your GitHub account. This application is only used to pass your email when you sign in to Community Cloud. On the next page, you'll perform additional steps to allow Community Cloud to access your repositories. For more information about using and reviewing the OAuth applications on your account, see Using OAuth apps in GitHub's docs. Fill in your information, and click " Continue " at the bottom. The "Primary email" field is prefilled with the email you used to sign in. If you change this email in the account setup form, it will only impact marketing emails; it will not reflect on your new account. To change the email associated with your account after it's created, see Update your email address . Finish up Congratulations on creating your Streamlit Community Cloud account! A warning icon ( warning ) next to " Workspaces " in the upper-left corner is expected; this indicates that your account is not yet connected to GitHub. Even if you created your account by signing in through GitHub, your account does not yet have permission to access your repositories. Continue to the next page to connect your GitHub account. Previous: Quickstart Next: Connect your GitHub account forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Fundamental_concepts_-_Streamlit_Docs.txt
Fundamental concepts - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals remove Basic concepts Advanced concepts Additional features Summary First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Get started / Fundamentals Fundamental concepts Are you new to Streamlit and want the grand tour? If so, you're in the right place! description Basic concepts. Learn the fundamental concepts of Streamlit. How is a Streamlit app structured? How does it run? How does it magically get your data on a webpage? description Advanced concepts. After you understand the rerun logic of Streamlit, learn how to make efficient and dynamic apps with caching and Session State. Get introduced to handling database connections. description Additional features. Learn about Streamlit's additional features. You don't need to know these concepts for your first app, but check it out to know what's available. Previous: Installation Next: Basic concepts forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st_column_config_DatetimeColumn___Streamlit_Docs_3.txt
st.column_config.DatetimeColumn - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements remove st.dataframe st.data_editor st.column_config remove Column Text column Number column Checkbox column Selectbox column Datetime column Date column Time column List column Link column Image column Area chart column Line chart column Bar chart column Progress column st.table st.metric st.json Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Data elements / st.column_config / Datetime column st.column_config.DatetimeColumn Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Configure a datetime column in st.dataframe or st.data_editor . This is the default column type for datetime values. This command needs to be used in the column_config parameter of st.dataframe or st.data_editor . When used with st.data_editor , editing will be enabled with a datetime picker widget. Function signature [source] st.column_config.DatetimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, pinned=None, default=None, format=None, min_value=None, max_value=None, step=None, timezone=None) Parameters label (str or None) The label shown at the top of the column. If this is None (default), the column name is used. width ("small", "medium", "large", or None) The display width of the column. If this is None (default), the column will be sized to fit the cell contents. Otherwise, this can be one of the following: "small" : 75px wide "medium" : 200px wide "large" : 400px wide help (str or None) An optional tooltip that gets displayed when hovering over the column label. If this is None (default), no tooltip is displayed. disabled (bool or None) Whether editing should be disabled for this column. If this is None (default), Streamlit will decide: indices are disabled and data columns are not. If a column has mixed types, it may become uneditable regardless of disabled . required (bool or None) Whether edited cells in the column need to have a value. If this is False (default), the user can submit empty values for this column. If this is True , an edited cell in this column can only be submitted if its value is not None , and a new row will only be submitted after the user fills in this column. pinned (bool or None) Whether the column is pinned. A pinned column will stay visible on the left side no matter where the user scrolls. If this is None (default), Streamlit will decide: index columns are pinned, and data columns are not pinned. default (datetime.datetime or None) Specifies the default value in this column when a new row is added by the user. This defaults to None . format (str or None) A momentJS format string controlling how datetimes are displayed. See momentJS docs for available formats. If this is None (default), the format is YYYY-MM-DD HH:mm:ss . Number formatting from column_config always takes precedence over number formatting from pandas.Styler . min_value (datetime.datetime or None) The minimum datetime that can be entered. If this is None (default), there will be no minimum. max_value (datetime.datetime or None) The maximum datetime that can be entered. If this is None (default), there will be no maximum. step (int, float, datetime.timedelta, or None) The stepping interval in seconds. If this is None (default), the step will be 1 second. timezone (str or None) The timezone of this column. If this is None (default), the timezone is inferred from the underlying data. Examples from datetime import datetime import pandas as pd import streamlit as st data_df = pd.DataFrame( { "appointment": [ datetime(2024, 2, 5, 12, 30), datetime(2023, 11, 10, 18, 0), datetime(2024, 3, 11, 20, 10), datetime(2023, 9, 12, 3, 0), ] } ) st.data_editor( data_df, column_config={ "appointment": st.column_config.DatetimeColumn( "Appointment", min_value=datetime(2023, 6, 1), max_value=datetime(2025, 1, 1), format="D MMM YYYY, h:mm a", step=60, ), }, hide_index=True, ) Built with Streamlit 🎈 Fullscreen open_in_new Previous: Selectbox column Next: Date column forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Security_reminders_-_Streamlit_Docs.txt
Security reminders - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets remove Connecting to data Secrets management Security reminders Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Connections and secrets / Security reminders Security reminders Protect your secrets Never save usernames, passwords, or security keys directly in your code or commit them to your repository. Use environment variables Avoid putting sensitve information in your code by using environment variables. Be sure to check out st.secrets . Research any platform you use to follow their security best practices. If you use Streamlit Community Cloud, Secrets management allows you save environment variables and store secrets outside of your code. Keep .gitignore updated If you use any sensitive or private information during development, make sure that information is saved in separate files from your code. Ensure .gitignore is properly configured to prevent saving private information to your repository. Pickle warning Streamlit's st.cache_data and st.session_state implicitly use the pickle module, which is known to be insecure. It is possible to construct malicious pickle data that will execute arbitrary code during unpickling. Never load data that could have come from an untrusted source in an unsafe mode or that could have been tampered with. Only load data you trust . When using st.cache_data , anything your function returns is pickled and stored, then unpickled on retrieval. Ensure your cached functions return trusted values. This warning also applies to st.cache (deprecated). When the runner.enforceSerializableSessionState configuration option is set to true , ensure all data saved and retrieved from Session State is trusted. Previous: Secrets management Next: Custom components forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Streamlit_API_cheat_sheet_-_Streamlit_Docs.txt
Streamlit API cheat sheet - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference remove Cheat sheet Release notes add Pre-release features Roadmap open_in_new web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Quick reference / Cheat sheet Streamlit API cheat sheet This is a summary of the docs for the latest version of Streamlit, v1.41.0 . Install & Import pip install streamlit streamlit run first_app.py # Import convention >>> import streamlit as st Pre-release features pip uninstall streamlit pip install streamlit-nightly --upgrade Learn more about experimental features Command line streamlit --help streamlit run your_script.py streamlit hello streamlit config show streamlit cache clear streamlit docs streamlit --version Magic commands # Magic commands implicitly # call st.write(). "_This_ is some **Markdown**" my_variable "dataframe:", my_data_frame Display text st.write("Most objects") # df, err, func, keras! st.write(["st", "is <", 3]) st.write_stream(my_generator) st.write_stream(my_llm_stream) st.text("Fixed width text") st.markdown("_Markdown_") st.latex(r""" e^{i\pi} + 1 = 0 """) st.title("My title") st.header("My header") st.subheader("My sub") st.code("for i in range(8): foo()") st.html("<p>Hi!</p>") Display data st.dataframe(my_dataframe) st.table(data.iloc[0:10]) st.json({"foo":"bar","fu":"ba"}) st.metric("My metric", 42, 2) Display media st.image("./header.png") st.audio(data) st.video(data) st.video(data, subtitles="./subs.vtt") st.logo("logo.jpg") Display charts st.area_chart(df) st.bar_chart(df) st.bar_chart(df, horizontal=True) st.line_chart(df) st.map(df) st.scatter_chart(df) st.altair_chart(chart) st.bokeh_chart(fig) st.graphviz_chart(fig) st.plotly_chart(fig) st.pydeck_chart(chart) st.pyplot(fig) st.vega_lite_chart(df, spec) # Work with user selections event = st.plotly_chart( df, on_select="rerun" ) event = st.altair_chart( chart, on_select="rerun" ) event = st.vega_lite_chart( df, spec, on_select="rerun" ) Add elements to sidebar # Just add it after st.sidebar: a = st.sidebar.radio("Select one:", [1, 2]) # Or use "with" notation: with st.sidebar: st.radio("Select one:", [1, 2]) Columns # Two equal columns: col1, col2 = st.columns(2) col1.write("This is column 1") col2.write("This is column 2") # Three different columns: col1, col2, col3 = st.columns([3, 1, 1]) # col1 is larger. # Bottom-aligned columns col1, col2 = st.columns(2, vertical_alignment="bottom") # You can also use "with" notation: with col1: st.radio("Select one:", [1, 2]) Tabs # Insert containers separated into tabs: tab1, tab2 = st.tabs(["Tab 1", "Tab2"]) tab1.write("this is tab 1") tab2.write("this is tab 2") # You can also use "with" notation: with tab1: st.radio("Select one:", [1, 2]) Expandable containers expand = st.expander("My label", icon=":material/info:") expand.write("Inside the expander.") pop = st.popover("Button label") pop.checkbox("Show all") # You can also use "with" notation: with expand: st.radio("Select one:", [1, 2]) Control flow # Stop execution immediately: st.stop() # Rerun script immediately: st.rerun() # Navigate to another page: st.switch_page("pages/my_page.py") # Define a navigation widget in your entrypoint file pg = st.navigation( st.Page("page1.py", title="Home", url_path="home", default=True) st.Page("page2.py", title="Preferences", url_path="settings") ) pg.run() # Group multiple widgets: with st.form(key="my_form"): username = st.text_input("Username") password = st.text_input("Password") st.form_submit_button("Login") # Define a dialog function @st.dialog("Welcome!") def modal_dialog(): st.write("Hello") modal_dialog() # Define a fragment @st.fragment def fragment_function(): df = get_data() st.line_chart(df) st.button("Update") fragment_function() Display interactive widgets st.button("Click me") st.download_button("Download file", data) st.link_button("Go to gallery", url) st.page_link("app.py", label="Home") st.data_editor("Edit data", data) st.checkbox("I agree") st.feedback("thumbs") st.pills("Tags", ["Sports", "Politics"]) st.radio("Pick one", ["cats", "dogs"]) st.segmented_control("Filter", ["Open", "Closed"]) st.toggle("Enable") st.selectbox("Pick one", ["cats", "dogs"]) st.multiselect("Buy", ["milk", "apples", "potatoes"]) st.slider("Pick a number", 0, 100) st.select_slider("Pick a size", ["S", "M", "L"]) st.text_input("First name") st.number_input("Pick a number", 0, 10) st.text_area("Text to translate") st.date_input("Your birthday") st.time_input("Meeting time") st.file_uploader("Upload a CSV") st.audio_input("Record a voice message") st.camera_input("Take a picture") st.color_picker("Pick a color") # Use widgets' returned values in variables: for i in range(int(st.number_input("Num:"))): foo() if st.sidebar.selectbox("I:",["f"]) == "f": b() my_slider_val = st.slider("Quinn Mallory", 1, 88) st.write(slider_val) # Disable widgets to remove interactivity: st.slider("Pick a number", 0, 100, disabled=True) Build chat-based apps # Insert a chat message container. with st.chat_message("user"): st.write("Hello 👋") st.line_chart(np.random.randn(30, 3)) # Display a chat input widget at the bottom of the app. >>> st.chat_input("Say something") # Display a chat input widget inline. with st.container(): st.chat_input("Say something") Learn how to Build a basic LLM chat app Mutate data # Add rows to a dataframe after # showing it. element = st.dataframe(df1) element.add_rows(df2) # Add rows to a chart after # showing it. element = st.line_chart(df1) element.add_rows(df2) Display code with st.echo(): st.write("Code will be executed and printed") Placeholders, help, and options # Replace any single element. element = st.empty() element.line_chart(...) element.text_input(...) # Replaces previous. # Insert out of order. elements = st.container() elements.line_chart(...) st.write("Hello") elements.text_input(...) # Appears above "Hello". st.help(pandas.DataFrame) st.get_option(key) st.set_option(key, value) st.set_page_config(layout="wide") st.query_params[key] st.query_params.from_dict(params_dict) st.query_params.get_all(key) st.query_params.clear() st.html("<p>Hi!</p>") Connect to data sources st.connection("pets_db", type="sql") conn = st.connection("sql") conn = st.connection("snowflake") class MyConnection(BaseConnection[myconn.MyConnection]): def _connect(self, **kwargs) -> MyConnection: return myconn.connect(**self._secrets, **kwargs) def query(self, query): return self._instance.query(query) Optimize performance Cache data objects # E.g. Dataframe computation, storing downloaded data, etc. @st.cache_data def foo(bar): # Do something expensive and return data return data # Executes foo d1 = foo(ref1) # Does not execute foo # Returns cached item by value, d1 == d2 d2 = foo(ref1) # Different arg, so function foo executes d3 = foo(ref2) # Clear the cached value for foo(ref1) foo.clear(ref1) # Clear all cached entries for this function foo.clear() # Clear values from *all* in-memory or on-disk cached functions st.cache_data.clear() Cache global resources # E.g. TensorFlow session, database connection, etc. @st.cache_resource def foo(bar): # Create and return a non-data object return session # Executes foo s1 = foo(ref1) # Does not execute foo # Returns cached item by reference, s1 == s2 s2 = foo(ref1) # Different arg, so function foo executes s3 = foo(ref2) # Clear the cached value for foo(ref1) foo.clear(ref1) # Clear all cached entries for this function foo.clear() # Clear all global resources from cache st.cache_resource.clear() Display progress and status # Show a spinner during a process with st.spinner(text="In progress"): time.sleep(3) st.success("Done") # Show and update progress bar bar = st.progress(50) time.sleep(3) bar.progress(100) with st.status("Authenticating...") as s: time.sleep(2) st.write("Some long response.") s.update(label="Response") st.balloons() st.snow() st.toast("Warming up...") st.error("Error message") st.warning("Warning message") st.info("Info message") st.success("Success message") st.exception(e) Personalize apps for users # Show different content based on the user's email address. if st.experimental_user.email == "[email protected]": display_jane_content() elif st.experimental_user.email == "[email protected]": display_adam_content() else: st.write("Please contact us to get access!") # Get dictionaries of cookies and headers st.context.cookies st.context.headers Previous: Quick reference Next: Release notes forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.snow_-_Streamlit_Docs.txt
st.snow - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements remove CALLOUTS st.success st.info st.warning st.error st.exception OTHER st.progress st.spinner st.status st.toast st.balloons st.snow Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Status elements / st.snow st.snow Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Draw celebratory snowfall. Function signature [source] st.snow() Example import streamlit as st st.snow() ...then watch your app and get ready for a cool celebration! Previous: st.balloons Next: Third-party components forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Define_multipage_apps_with_st_Page_and_st_navigati.txt
Define multipage apps with st.Page and st.navigation - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps remove Overview Page and navigation Pages directory Working with widgets App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Multipage apps / Page and navigation Define multipage apps with st.Page and st.navigation st.Page and st.navigation are the preferred commands for defining multipage apps. With these commands, you have flexibility to organize your project files and customize your navigation menu. Simply initialize StreamlitPage objects with st.Page , then pass those StreamlitPage objects to st.navigation in your entrypoint file (i.e. the file you pass to streamlit run ). This page assumes you understand the Page terminology presented in the overview. App structure When using st.navigation , your entrypoint file acts like a page router. Each page is a script executed from your entrypoint file. You can define a page from a Python file or function. If you include elements or widgets in your entrypoint file, they become common elements between your pages. In this case, you can think of your entrypoint file like a picture frame around each of your pages. You can only call st.navigation once per app run and you must call it from your entrypoint file. When a user selects a page in navigation (or is routed through a command like st.switch_page ), st.navigation returns the selected page. You must manually execute that page with the .run() method. The following example is a two-page app where each page is defined by a Python file. Directory structure: your-repository/ ├── page_1.py ├── page_2.py └── streamlit_app.py streamlit_app.py : import streamlit as st pg = st.navigation([st.Page("page_1.py"), st.Page("page_2.py")]) pg.run() Defining pages st.Page lets you define a page. The first and only required argument defines your page source, which can be a Python file or function. When using Python files, your pages may be in a subdirectory (or superdirectory). The path to your page file must always be relative to the entrypoint file. Once you create your page objects, pass them to st.navigation to register them as pages in your app. If you don't define your page title or URL pathname, Streamlit will infer them from the file or function name as described in the multipage apps Overview . However, st.Page lets you configure them manually. Within st.Page , Streamlit uses title to set the page label and title. Additionaly, Streamlit uses icon to set the page icon and favicon. If you want to have a different page title and label, or different page icon and favicon, you can use st.set_page_config to change the page title and/or favicon. Just call st.set_page_config after st.navigation , either in your entrypoint file or in your page source. The following example uses st.set_page_config to set a page title and favicon consistently across pages. Each page will have its own label and icon in the navigation menu, but the browser tab will show a consistent title and favicon on all pages. Directory structure: your-repository/ ├── create.py ├── delete.py └── streamlit_app.py streamlit_app.py : import streamlit as st create_page = st.Page("create.py", title="Create entry", icon=":material/add_circle:") delete_page = st.Page("delete.py", title="Delete entry", icon=":material/delete:") pg = st.navigation([create_page, delete_page]) st.set_page_config(page_title="Data manager", page_icon=":material/edit:") pg.run() Customizing navigation If you want to group your pages into sections, st.navigation lets you insert headers within your navigation. Alternatively, you can disable the default navigation widget and build a custom navigation menu with st.page_link . Additionally, you can dynamically change which pages you pass to st.navigation . However, only the page returned by st.navigation accepts the .run() method. If a user enters a URL with a pathname, and that pathname is not associated to a page in st.navigation (on first run), Streamlit will throw a "Page not found" error and redirect them to the default page. Adding section headers As long as you don't want to hide a valid, accessible page in the navigation menu, the simplest way to customize your navigation menu is to organize the pages within st.navigation . You can sort or group pages, as well as remove any pages you don't want the user to access. This is a convenient way to handle user permissions. The following example creates two menu states. When a user starts a new session, they are not logged in. In this case, the only available page is the login page. If a user tries to access another page by URL, it will create a new session and Streamlit will not recognize the page. The user will be diverted to the login page. However, after a user logs in, they will see a navigation menu with three sections and be directed to the dashboard as the app's default page (i.e. homepage). Directory structure: your-repository/ ├── reports │ ├── alerts.py │ ├── bugs.py │ └── dashboard.py ├── tools │ ├── history.py │ └── search.py └── streamlit_app.py streamlit_app.py : import streamlit as st if "logged_in" not in st.session_state: st.session_state.logged_in = False def login(): if st.button("Log in"): st.session_state.logged_in = True st.rerun() def logout(): if st.button("Log out"): st.session_state.logged_in = False st.rerun() login_page = st.Page(login, title="Log in", icon=":material/login:") logout_page = st.Page(logout, title="Log out", icon=":material/logout:") dashboard = st.Page( "reports/dashboard.py", title="Dashboard", icon=":material/dashboard:", default=True ) bugs = st.Page("reports/bugs.py", title="Bug reports", icon=":material/bug_report:") alerts = st.Page( "reports/alerts.py", title="System alerts", icon=":material/notification_important:" ) search = st.Page("tools/search.py", title="Search", icon=":material/search:") history = st.Page("tools/history.py", title="History", icon=":material/history:") if st.session_state.logged_in: pg = st.navigation( { "Account": [logout_page], "Reports": [dashboard, bugs, alerts], "Tools": [search, history], } ) else: pg = st.navigation([login_page]) pg.run() Dynamically changing the available pages You can change what pages are available to a user by updating the list of pages in st.navigation . This is a convenient way to handle role-based or user-based access to certain pages. For more information, check out our tutorial, Create a dynamic navigation menu . Building a custom navigation menu If you want more control over your navigation menu, you can hide the default navigation and build your own. You can hide the default navigation by including position="hidden" in your st.navigation command. If you want a page to be available to a user without showing it in the navigation menu, you must use this method. A user can't be routed to a page if the page isn't included in st.navigation . This applies to navigation by URL as well as commands like st.switch_page and st.page_link . Previous: Overview Next: Pages directory forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.pydeck_chart_-_Streamlit_Docs.txt
st.pydeck_chart - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements remove SIMPLE st.area_chart st.bar_chart st.line_chart st.map st.scatter_chart ADVANCED st.altair_chart st.bokeh_chart st.graphviz_chart st.plotly_chart st.pydeck_chart st.pyplot st.vega_lite_chart Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Chart elements / st.pydeck_chart st.pydeck_chart Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Draw a chart using the PyDeck library. This supports 3D maps, point clouds, and more! More info about PyDeck at https://deckgl.readthedocs.io/en/latest/ . These docs are also quite useful: DeckGL docs: https://github.com/uber/deck.gl/tree/master/docs DeckGL JSON docs: https://github.com/uber/deck.gl/tree/master/modules/json When using this command, Mapbox provides the map tiles to render map content. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox. Mapbox requires users to register and provide a token before users can request map tiles. Currently, Streamlit provides this token for you, but this could change at any time. We strongly recommend all users create and use their own personal Mapbox token to avoid any disruptions to their experience. You can do this with the mapbox.token config option. The use of Mapbox is governed by Mapbox's Terms of Use. To get a token for yourself, create an account at https://mapbox.com . For more info on how to set config options, see https://docs.streamlit.io/develop/api-reference/configuration/config.toml . Function signature [source] st.pydeck_chart(pydeck_obj=None, *, use_container_width=False, width=None, height=None, selection_mode="single-object", on_select="ignore", key=None) Parameters pydeck_obj (pydeck.Deck or None) Object specifying the PyDeck chart to draw. use_container_width (bool) Whether to override the figure's native width with the width of the parent container. If use_container_width is False (default), Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. If use_container_width is True , Streamlit sets the width of the figure to match the width of the parent container. width (int or None) Desired width of the chart expressed in pixels. If width is None (default), Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. If width is greater than the width of the parent container, Streamlit sets the chart width to match the width of the parent container. To use width , you must set use_container_width=False . height (int or None) Desired height of the chart expressed in pixels. If height is None (default), Streamlit sets the height of the chart to fit its contents according to the plotting library. on_select ("ignore" or "rerun" or callable) How the figure should respond to user selection events. This controls whether or not the chart behaves like an input widget. on_select can be one of the following: "ignore" (default): Streamlit will not react to any selection events in the chart. The figure will not behave like an input widget. "rerun" : Streamlit will rerun the app when the user selects data in the chart. In this case, st.pydeck_chart will return the selection data as a dictionary. A callable : Streamlit will rerun the app and execute the callable as a callback function before the rest of the app. In this case, st.pydeck_chart will return the selection data as a dictionary. If on_select is not "ignore" , all layers must have a declared id to keep the chart stateful across reruns. selection_mode ("single-object" or "multi-object") The selection mode of the chart. This can be one of the following: "single-object" (default): Only one object can be selected at a time. "multi-object" : Multiple objects can be selected at a time. key (str) An optional string to use for giving this element a stable identity. If key is None (default), this element's identity will be determined based on the values of the other parameters. Additionally, if selections are activated and key is provided, Streamlit will register the key in Session State to store the selection state. The selection state is read-only. Returns (element or dict) If on_select is "ignore" (default), this command returns an internal placeholder for the chart element. Otherwise, this method returns a dictionary-like object that supports both key and attribute notation. The attributes are described by the PydeckState dictionary schema. Example Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the light or dark map style, based on which Streamlit theme is currently active: import streamlit as st import pandas as pd import numpy as np import pydeck as pdk chart_data = pd.DataFrame( np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4], columns=["lat", "lon"], ) st.pydeck_chart( pdk.Deck( map_style=None, initial_view_state=pdk.ViewState( latitude=37.76, longitude=-122.4, zoom=11, pitch=50, ), layers=[ pdk.Layer( "HexagonLayer", data=chart_data, get_position="[lon, lat]", radius=200, elevation_scale=4, elevation_range=[0, 1000], pickable=True, extruded=True, ), pdk.Layer( "ScatterplotLayer", data=chart_data, get_position="[lon, lat]", get_color="[200, 30, 0, 160]", get_radius=200, ), ], ) ) Built with Streamlit 🎈 Fullscreen open_in_new Note To make the PyDeck chart's style consistent with Streamlit's theme, you can set map_style=None in the pydeck.Deck object. Chart selections PydeckState Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake The schema for the PyDeck event state. The event state is stored in a dictionary-like object that supports both key and attribute notation. Event states cannot be programmatically changed or set through Session State. Only selection events are supported at this time. Attributes selection (dict) The state of the on_select event. This attribute returns a dictionary-like object that supports both key and attribute notation. The attributes are described by the PydeckSelectionState dictionary schema. PydeckSelectionState Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake The schema for the PyDeck chart selection state. The selection state is stored in a dictionary-like object that supports both key and attribute notation. Selection states cannot be programmatically changed or set through Session State. You must define id in pydeck.Layer to ensure statefulness when using selections with st.pydeck_chart . Attributes indices (dict[str, list[int]]) A dictionary of selected objects by layer. Each key in the dictionary is a layer id, and each value is a list of object indices within that layer. objects (dict[str, list[dict[str, Any]]]) A dictionary of object attributes by layer. Each key in the dictionary is a layer id, and each value is a list of metadata dictionaries for the selected objects in that layer. Examples The following example has multi-object selection enabled. The chart displays US state capitals by population (2023 US Census estimate). You can access this data from GitHub. import streamlit as st import pydeck import pandas as pd capitals = pd.read_csv( "capitals.csv", header=0, names=[ "Capital", "State", "Abbreviation", "Latitude", "Longitude", "Population", ], ) capitals["size"] = capitals.Population / 10 point_layer = pydeck.Layer( "ScatterplotLayer", data=capitals, id="capital-cities", get_position=["Longitude", "Latitude"], get_color="[255, 75, 75]", pickable=True, auto_highlight=True, get_radius="size", ) view_state = pydeck.ViewState( latitude=40, longitude=-117, controller=True, zoom=2.4, pitch=30 ) chart = pydeck.Deck( point_layer, initial_view_state=view_state, tooltip={"text": "{Capital}, {Abbreviation}\nPopulation: {Population}"}, ) event = st.pydeck_chart(chart, on_select="rerun", selection_mode="multi-object") event.selection Built with Streamlit 🎈 Fullscreen open_in_new This is an example of the selection state when selecting a single object from a layer with id, "captial-cities" : { "indices":{ "capital-cities":[ 2 ] }, "objects":{ "capital-cities":[ { "Abbreviation":" AZ" "Capital":"Phoenix" "Latitude":33.448457 "Longitude":-112.073844 "Population":1650070 "State":" Arizona" "size":165007.0 } ] } } Previous: st.plotly_chart Next: st.pyplot forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Custom_components_-_Streamlit_Docs.txt
Custom components - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components remove st.components.v1​.declare_component st.components.v1.html st.components.v1.iframe Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Custom components Custom components Declare a component Create and register a custom component. from st.components.v1 import declare_component declare_component( "custom_slider", "/frontend", ) HTML Display an HTML string in an iframe. from st.components.v1 import html html( "<p>Foo bar.</p>" ) iframe Load a remote URL in an iframe. from st.components.v1 import iframe iframe( "docs.streamlit.io" ) Previous: Connections and secrets Next: st.components.v1​.declare_component forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Intro_to_custom_components_-_Streamlit_Docs.txt
Intro to custom components - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components remove Intro to custom components Create a Component Publish a Component Limitations Component gallery open_in_new Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Custom components / Intro to custom components Intro to custom components The first step in developing a Streamlit Component is deciding whether to create a static component (i.e. rendered once, controlled by Python) or to create a bi-directional component that can communicate from Python to JavaScript and back. Create a static component If your goal in creating a Streamlit Component is solely to display HTML code or render a chart from a Python visualization library, Streamlit provides two methods that greatly simplify the process: components.html() and components.iframe() . If you are unsure whether you need bi-directional communication, start here first ! Render an HTML string While st.text , st.markdown and st.write make it easy to write text to a Streamlit app, sometimes you'd rather implement a custom piece of HTML. Similarly, while Streamlit natively supports many charting libraries , you may want to implement a specific HTML/JavaScript template for a new charting library. components.html works by giving you the ability to embed an iframe inside of a Streamlit app that contains your desired output. Example import streamlit as st import streamlit.components.v1 as components # bootstrap 4 collapse example components.html( """ <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/css/bootstrap.min.css" integrity="sha384-Gn5384xqQ1aoWXA+058RXPxPg6fy4IWvTNh0E263XmFcJlSAwiGgFAW/dAiS6JXm" crossorigin="anonymous"> <script src="https://code.jquery.com/jquery-3.2.1.slim.min.js" integrity="sha384-KJ3o2DKtIkvYIK3UENzmM7KCkRr/rE9/Qpg6aAZGJwFDMVNA/GpGFF93hXpG5KkN" crossorigin="anonymous"></script> <script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.0.0/js/bootstrap.min.js" integrity="sha384-JZR6Spejh4U02d8jOt6vLEHfe/JQGiRRSQQxSfFWpi1MquVdAyjUar5+76PVCmYl" crossorigin="anonymous"></script> <div id="accordion"> <div class="card"> <div class="card-header" id="headingOne"> <h5 class="mb-0"> <button class="btn btn-link" data-toggle="collapse" data-target="#collapseOne" aria-expanded="true" aria-controls="collapseOne"> Collapsible Group Item #1 </button> </h5> </div> <div id="collapseOne" class="collapse show" aria-labelledby="headingOne" data-parent="#accordion"> <div class="card-body"> Collapsible Group Item #1 content </div> </div> </div> <div class="card"> <div class="card-header" id="headingTwo"> <h5 class="mb-0"> <button class="btn btn-link collapsed" data-toggle="collapse" data-target="#collapseTwo" aria-expanded="false" aria-controls="collapseTwo"> Collapsible Group Item #2 </button> </h5> </div> <div id="collapseTwo" class="collapse" aria-labelledby="headingTwo" data-parent="#accordion"> <div class="card-body"> Collapsible Group Item #2 content </div> </div> </div> </div> """, height=600, ) Render an iframe URL components.iframe is similar in features to components.html , with the difference being that components.iframe takes a URL as its input. This is used for situations where you want to include an entire page within a Streamlit app. Example import streamlit as st import streamlit.components.v1 as components # embed streamlit docs in a streamlit app components.iframe("https://example.com", height=500) Create a bi-directional component A bi-directional Streamlit Component has two parts: A frontend , which is built out of HTML and any other web tech you like (JavaScript, React, Vue, etc.), and gets rendered in Streamlit apps via an iframe tag. A Python API , which Streamlit apps use to instantiate and talk to that frontend To make the process of creating bi-directional Streamlit Components easier, we've created a React template and a TypeScript-only template in the Streamlit Component-template GitHub repo . We also provide some example Components in the same repo. Development Environment Setup To build a Streamlit Component, you need the following installed in your development environment: Python 3.9 - Python 3.13 Streamlit nodejs npm or yarn Clone the component-template GitHub repo , then decide whether you want to use the React.js ( "template" ) or plain TypeScript ( "template-reactless" ) template. Initialize and build the component template frontend from the terminal: # React template template/my_component/frontend npm install # Initialize the project and install npm dependencies npm run start # Start the Webpack dev server # or # TypeScript-only template template-reactless/my_component/frontend npm install # Initialize the project and install npm dependencies npm run start # Start the Webpack dev server From a separate terminal , run the Streamlit app (Python) that declares and uses the component: # React template cd template . venv/bin/activate # or similar to activate the venv/conda environment where Streamlit is installed pip install -e . # install template as editable package streamlit run my_component/example.py # run the example # or # TypeScript-only template cd template-reactless . venv/bin/activate # or similar to activate the venv/conda environment where Streamlit is installed pip install -e . # install template as editable package streamlit run my_component/example.py # run the example After running the steps above, you should see a Streamlit app in your browser that looks like this: The example app from the template shows how bi-directional communication is implemented. The Streamlit Component displays a button ( Python → JavaScript ), and the end-user can click the button. Each time the button is clicked, the JavaScript front-end increments the counter value and passes it back to Python ( JavaScript → Python ), which is then displayed by Streamlit ( Python → JavaScript ). Frontend Because each Streamlit Component is its own webpage that gets rendered into an iframe , you can use just about any web tech you'd like to create that web page. We provide two templates to get started with in the Streamlit Components-template GitHub repo ; one of those templates uses React and the other does not. push_pin Note Even if you're not already familiar with React, you may still want to check out the React-based template. It handles most of the boilerplate required to send and receive data from Streamlit, and you can learn the bits of React you need as you go. If you'd rather not use React, please read this section anyway! It explains the fundamentals of Streamlit ↔ Component communication. React The React-based template is in template/my_component/frontend/src/MyComponent.tsx . MyComponent.render() is called automatically when the component needs to be re-rendered (just like in any React app) Arguments passed from the Python script are available via the this.props.args dictionary: # Send arguments in Python: result = my_component(greeting="Hello", name="Streamlit") // Receive arguments in frontend: let greeting = this.props.args["greeting"]; // greeting = "Hello" let name = this.props.args["name"]; // name = "Streamlit" Use Streamlit.setComponentValue() to return data from the component to the Python script: // Set value in frontend: Streamlit.setComponentValue(3.14); # Access value in Python: result = my_component(greeting="Hello", name="Streamlit") st.write("result = ", result) # result = 3.14 When you call Streamlit.setComponentValue(new_value) , that new value is sent to Streamlit, which then re-executes the Python script from top to bottom . When the script is re-executed, the call to my_component(...) will return the new value. From a code flow perspective, it appears that you're transmitting data synchronously with the frontend: Python sends the arguments to JavaScript, and JavaScript returns a value to Python, all in a single function call! But in reality this is all happening asynchronously , and it's the re-execution of the Python script that achieves the sleight of hand. Use Streamlit.setFrameHeight() to control the height of your component. By default, the React template calls this automatically (see StreamlitComponentBase.componentDidUpdate() ). You can override this behavior if you need more control. There's a tiny bit of magic in the last line of the file: export default withStreamlitConnection(MyComponent) - this does some handshaking with Streamlit, and sets up the mechanisms for bi-directional data communication. TypeScript-only The TypeScript-only template is in template-reactless/my_component/frontend/src/MyComponent.tsx . This template has much more code than its React sibling, in that all the mechanics of handshaking, setting up event listeners, and updating the component's frame height are done manually. The React version of the template handles most of these details automatically. Towards the bottom of the source file, the template calls Streamlit.setComponentReady() to tell Streamlit it's ready to start receiving data. (You'll generally want to do this after creating and loading everything that the Component relies on.) It subscribes to Streamlit.RENDER_EVENT to be notified of when to redraw. (This event won't be fired until setComponentReady is called) Within its onRender event handler, it accesses the arguments passed in the Python script via event.detail.args It sends data back to the Python script in the same way that the React template does—clicking on the "Click Me!" button calls Streamlit.setComponentValue() It informs Streamlit when its height may have changed via Streamlit.setFrameHeight() Working with Themes push_pin Note Custom component theme support requires streamlit-component-lib version 1.2.0 or higher. Along with sending an args object to your component, Streamlit also sends a theme object defining the active theme so that your component can adjust its styling in a compatible way. This object is sent in the same message as args , so it can be accessed via this.props.theme (when using the React template) or event.detail.theme (when using the plain TypeScript template). The theme object has the following shape: { "base": "lightORdark", "primaryColor": "someColor1", "backgroundColor": "someColor2", "secondaryBackgroundColor": "someColor3", "textColor": "someColor4", "font": "someFont" } The base option allows you to specify a preset Streamlit theme that your custom theme inherits from. Any theme config options not defined in your theme settings have their values set to those of the base theme. Valid values for base are "light" and "dark" . Note that the theme object has fields with the same names and semantics as the options in the "theme" section of the config options printed with the command streamlit config show . When using the React template, the following CSS variables are also set automatically. --base --primary-color --background-color --secondary-background-color --text-color --font If you're not familiar with CSS variables , the TLDR version is that you can use them like this: .mySelector { color: var(--text-color); } These variables match the fields defined in the theme object above, and whether to use CSS variables or the theme object in your component is a matter of personal preference. Other frontend details Because you're hosting your component from a dev server (via npm run start ), any changes you make should be automatically reflected in the Streamlit app when you save. If you want to add more packages to your component, run npm add to add them from within your component's frontend/ directory. npm add baseui To build a static version of your component, run npm run export . See Prepare your Component for more information Python API components.declare_component() is all that's required to create your Component's Python API: import streamlit.components.v1 as components my_component = components.declare_component( "my_component", url="http://localhost:3001" ) You can then use the returned my_component function to send and receive data with your frontend code: # Send data to the frontend using named arguments. return_value = my_component(name="Blackbeard", ship="Queen Anne's Revenge") # `my_component`'s return value is the data returned from the frontend. st.write("Value = ", return_value) While the above is all you need to define from the Python side to have a working Component, we recommend creating a "wrapper" function with named arguments and default values, input validation and so on. This will make it easier for end-users to understand what data values your function accepts and allows for defining helpful docstrings. Please see this example from the Components-template for an example of creating a wrapper function. Data serialization Python → Frontend You send data from Python to the frontend by passing keyword args to your Component's invoke function (that is, the function returned from declare_component ). You can send the following types of data from Python to the frontend: Any JSON-serializable data numpy.array pandas.DataFrame Any JSON-serializable data gets serialized to a JSON string, and deserialized to its JavaScript equivalent. numpy.array and pandas.DataFrame get serialized using Apache Arrow and are deserialized as instances of ArrowTable , which is a custom type that wraps Arrow structures and provides a convenient API on top of them. Check out the CustomDataframe and SelectableDataTable Component example code for more context on how to use ArrowTable . Frontend → Python You send data from the frontend to Python via the Streamlit.setComponentValue() API (which is part of the template code). Unlike arg-passing from Python → frontend, this API takes a single value . If you want to return multiple values, you'll need to wrap them in an Array or Object . Custom Components can send JSON-serializable data from the frontend to Python, as well as Apache Arrow ArrowTable s to represent dataframes. Previous: Custom components Next: Create a Component forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.number_input_-_Streamlit_Docs.txt
st.number_input - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets / st.number_input st.number_input Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a numeric input widget. Note Integer values exceeding +/- (1<<53) - 1 cannot be accurately stored or returned by the widget due to serialization contstraints between the Python server and JavaScript client. You must handle such numbers as floats, leading to a loss in precision. Function signature [source] st.number_input(label, min_value=None, max_value=None, value="min", step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility="visible") Parameters label (str) A short label explaining to the user what this input is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. min_value (int, float, or None) The minimum permitted value. If None, there will be no minimum. max_value (int, float, or None) The maximum permitted value. If None, there will be no maximum. value (int, float, "min" or None) The value of this widget when it first renders. If None , will initialize empty and return None until the user provides input. If "min" (default), will initialize with min_value, or 0.0 if min_value is None. step (int, float, or None) The stepping interval. Defaults to 1 if the value is an int, 0.01 otherwise. If the value is not specified, the format parameter will be used. format (str or None) A printf-style format string controlling how the interface should display numbers. The output must be purely numeric. This does not impact the return value of the widget. Formatting is handled by sprintf.js . For example, format="%0.1f" adjusts the displayed decimal precision to only show one digit after the decimal. key (str or int) An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help (str) An optional tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible" . on_change (callable) An optional callback invoked when this number_input's value changes. args (tuple) An optional tuple of args to pass to the callback. kwargs (dict) An optional dict of kwargs to pass to the callback. placeholder (str or None) An optional string displayed when the number input is empty. If None, no placeholder is displayed. disabled (bool) An optional boolean that disables the number input if set to True . The default is False . label_visibility ("visible", "hidden", or "collapsed") The visibility of the label. The default is "visible" . If this is "hidden" , Streamlit displays an empty spacer instead of the label, which can help keep the widget alligned with other widgets. If this is "collapsed" , Streamlit displays no label or spacer. Returns (int or float or None) The current value of the numeric input widget or None if the widget is empty. The return type will match the data type of the value parameter. Example import streamlit as st number = st.number_input("Insert a number") st.write("The current number is ", number) Built with Streamlit 🎈 Fullscreen open_in_new To initialize an empty number input, use None as the value: import streamlit as st number = st.number_input( "Insert a number", value=None, placeholder="Type a number..." ) st.write("The current number is ", number) Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.toggle Next: st.slider forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Working_with_configuration_options___Streamlit_Doc.txt
Working with configuration options - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming remove Configuration options HTTPS support Serving static files Customize your theme App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Configuration and theming / Configuration options Working with configuration options Streamlit provides four different ways to set configuration options. This list is in reverse order of precedence, i.e. command line flags take precedence over environment variables when the same configuration option is provided multiple times. push_pin Note If you change theme settings in .streamlit/config.toml while the app is running, these changes will reflect immediately. If you change non-theme settings in .streamlit/config.toml while the app is running, the server needs to be restarted for changes to be reflected in the app. In a global config file at ~/.streamlit/config.toml for macOS/Linux or %userprofile%/.streamlit/config.toml for Windows: [server] port = 80 In a per-project config file at $CWD/.streamlit/config.toml , where $CWD is the folder you're running Streamlit from. Through STREAMLIT_* environment variables , such as: export STREAMLIT_SERVER_PORT=80 export STREAMLIT_SERVER_COOKIE_SECRET=dontforgottochangeme As flags on the command line when running streamlit run : streamlit run your_script.py --server.port 80 Available options All available configuration options are documented in config.toml . These options may be declared in a TOML file, as environment variables, or as command line options. When using environment variables to override config.toml , convert the variable (including its section header) to upper snake case and add a STREAMLIT_ prefix. For example, STREAMLIT_CLIENT_SHOW_ERROR_DETAILS is equivalent to the following in TOML: [client] showErrorDetails = true When using command line options to override config.toml and environment variables, use the same case as you would in the TOML file and include the section header as a period-separated prefix. For example, the command line option --server.enableStaticServing true is equivalent to the following: [server] enableStaticServing = true Telemetry As mentioned during the installation process, Streamlit collects usage statistics. You can find out more by reading our Privacy Notice , but the high-level summary is that although we collect telemetry data we cannot see and do not store information contained in Streamlit apps. If you'd like to opt out of usage statistics, add the following to your config file: [browser] gatherUsageStats = false Theming You can change the base colors of your app using the [theme] section of the configuration system. To learn more, see Theming. View all configuration options As described in Command-line options , you can view all available configuration options using: streamlit config show Previous: Configuration and theming Next: HTTPS support forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.experimental_memo_-_Streamlit_Docs.txt
st.experimental_memo - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state remove st.cache_data st.cache_resource st.session_state st.query_params st.experimental_get_query_params delete st.experimental_set_query_params delete Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Caching and state / st.experimental_memo priority_high Important This is an experimental feature. Experimental features and their APIs may change or be removed at any time. To learn more, click here . st.experimental_memo Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake priority_high Warning This method did not exist in version 1.41.0 of Streamlit. Persistent memo caches currently don't support TTL. ttl will be ignored if persist is specified: import streamlit as st @st.experimental_memo(ttl=60, persist="disk") def load_data(): return 42 st.write(load_data()) And a warning will be logged to your terminal: streamlit run app.py You can now view your Streamlit app in your browser. Local URL: http://localhost:8501 Network URL: http://192.168.1.1:8501 2022-09-22 13:35:41.587 The memoized function 'load_data' has a TTL that will be ignored. Persistent memo caches currently don't support TTL. st.experimental_memo.clear Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake priority_high Warning This method did not exist in version 1.41.0 of Streamlit. Example In the example below, pressing the "Clear All" button will clear memoized values from all functions decorated with @st.experimental_memo . import streamlit as st @st.experimental_memo def square(x): return x**2 @st.experimental_memo def cube(x): return x**3 if st.button("Clear All"): # Clear values from *all* memoized functions: # i.e. clear values from both square and cube st.experimental_memo.clear() Replay static st elements in cache-decorated functions Functions decorated with @st.experimental_memo can contain static st elements. When a cache-decorated function is executed, we record the element and block messages produced, so the elements will appear in the app even when execution of the function is skipped because the result was cached. In the example below, the @st.experimental_memo decorator is used to cache the execution of the load_data function, that returns a pandas DataFrame. Notice the cached function also contains a st.area_chart command, which will be replayed when the function is skipped because the result was cached. import numpy as np import pandas as pd import streamlit as st @st.experimental_memo def load_data(rows): chart_data = pd.DataFrame( np.random.randn(rows, 10), columns=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"], ) # Contains a static element st.area_chart st.area_chart(chart_data) # This will be recorded and displayed even when the function is skipped return chart_data df = load_data(20) st.dataframe(df) Supported static st elements in cache-decorated functions include: st.alert st.altair_chart st.area_chart st.audio st.bar_chart st.ballons st.bokeh_chart st.caption st.code st.components.v1.html st.components.v1.iframe st.container st.dataframe st.echo st.empty st.error st.exception st.expander st.experimental_get_query_params st.experimental_set_query_params st.form st.form_submit_button st.graphviz_chart st.help st.image st.info st.json st.latex st.line_chart st.markdown st.metric st.plotly_chart st.progress st.pydeck_chart st.snow st.spinner st.success st.table st.text st.vega_lite_chart st.video st.warning Replay input widgets in cache-decorated functions In addition to static elements, functions decorated with @st.experimental_memo can also contain input widgets ! Replaying input widgets is disabled by default. To enable it, you can set the experimental_allow_widgets parameter for @st.experimental_memo to True . The example below enables widget replaying, and shows the use of a checkbox widget within a cache-decorated function. import streamlit as st # Enable widget replay @st.experimental_memo(experimental_allow_widgets=True) def func(): # Contains an input widget st.checkbox("Works!") func() If the cache decorated function contains input widgets, but experimental_allow_widgets is set to False or unset, Streamlit will throw a CachedStFunctionWarning , like the one below: import streamlit as st # Widget replay is disabled by default @st.experimental_memo def func(): # Streamlit will throw a CachedStFunctionWarning st.checkbox("Doesn't work") func() How widget replay works Let's demystify how widget replay in cache-decorated functions works and gain a conceptual understanding. Widget values are treated as additional inputs to the function, and are used to determine whether the function should be executed or not. Consider the following example: import streamlit as st @st.experimental_memo(experimental_allow_widgets=True) def plus_one(x): y = x + 1 if st.checkbox("Nuke the value 💥"): st.write("Value was nuked, returning 0") y = 0 return y st.write(plus_one(2)) The plus_one function takes an integer x as input, and returns x + 1 . The function also contains a checkbox widget, which is used to "nuke" the value of x . i.e. the return value of plus_one depends on the state of the checkbox: if it is checked, the function returns 0 , otherwise it returns 3 . In order to know which value the cache should return (in case of a cache hit), Streamlit treats the checkbox state (checked / unchecked) as an additional input to the function plus_one (just like x ). If the user checks the checkbox (thereby changing its state), we look up the cache for the same value of x (2) and the same checkbox state (checked). If the cache contains a value for this combination of inputs, we return it. Otherwise, we execute the function and store the result in the cache. Let's now understand how enabling and disabling widget replay changes the behavior of the function. Widget replay disabled Widgets in cached functions throw a CachedStFunctionWarning and are ignored. Other static elements in cached functions replay as expected. Widget replay enabled Widgets in cached functions don't lead to a warning, and are replayed as expected. Interacting with a widget in a cached function will cause the function to be executed again, and the cache to be updated. Widgets in cached functions retain their state across reruns. Each unique combination of widget values is treated as a separate input to the function, and is used to determine whether the function should be executed or not. i.e. Each unique combination of widget values has its own cache entry; the cached function runs the first time and the saved value is used afterwards. Calling a cached function multiple times in one script run with the same arguments triggers a DuplicateWidgetID error. If the arguments to a cached function change, widgets from that function that render again retain their state. Changing the source code of a cached function invalidates the cache. Both st.experimental_memo and st.experimental_singleton support widget replay. Fundamentally, the behavior of a function with (supported) widgets in it doesn't change when it is decorated with @st.experimental_memo or @st.experimental_singleton . The only difference is that the function is only executed when we detect a cache "miss". Supported widgets All input widgets are supported in cache-decorated functions. The following is an exhaustive list of supported widgets: st.button st.camera_input st.checkbox st.color_picker st.date_input st.download_button st.file_uploader st.multiselect st.number_input st.radio st.selectbox st.select_slider st.slider st.text_area st.text_input st.time_input Previous: st.cache_resource Next: st.experimental_singleton forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.slider_-_Streamlit_Docs.txt
st.slider - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets / st.slider st.slider Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a slider widget. This supports int, float, date, time, and datetime types. This also allows you to render a range slider by passing a two-element tuple or list as the value . The difference between st.slider and st.select_slider is that slider only accepts numerical or date/time data and takes a range as input, while select_slider accepts any datatype and takes an iterable set of options. Note Integer values exceeding +/- (1<<53) - 1 cannot be accurately stored or returned by the widget due to serialization contstraints between the Python server and JavaScript client. You must handle such numbers as floats, leading to a loss in precision. Function signature [source] st.slider(label, min_value=None, max_value=None, value=None, step=None, format=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility="visible") Parameters label (str) A short label explaining to the user what this slider is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. min_value (a supported type or None) The minimum permitted value. Defaults to 0 if the value is an int, 0.0 if a float, value - timedelta(days=14) if a date/datetime, time.min if a time max_value (a supported type or None) The maximum permitted value. Defaults to 100 if the value is an int, 1.0 if a float, value + timedelta(days=14) if a date/datetime, time.max if a time value (a supported type or a tuple/list of supported types or None) The value of the slider when it first renders. If a tuple/list of two values is passed here, then a range slider with those lower and upper bounds is rendered. For example, if set to (1, 10) the slider will have a selectable range between 1 and 10. Defaults to min_value. step (int, float, timedelta, or None) The stepping interval. Defaults to 1 if the value is an int, 0.01 if a float, timedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time (or if max_value - min_value < 1 day) format (str or None) A printf-style format string controlling how the interface should display numbers. This does not impact the return value. Formatter for int/float supports: %d %e %f %g %i Formatter for date/time/datetime uses Moment.js notation: https://momentjs.com/docs/#/displaying/format/ key (str or int) An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help (str) An optional tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible" . on_change (callable) An optional callback invoked when this slider's value changes. args (tuple) An optional tuple of args to pass to the callback. kwargs (dict) An optional dict of kwargs to pass to the callback. disabled (bool) An optional boolean that disables the slider if set to True . The default is False . label_visibility ("visible", "hidden", or "collapsed") The visibility of the label. The default is "visible" . If this is "hidden" , Streamlit displays an empty spacer instead of the label, which can help keep the widget alligned with other widgets. If this is "collapsed" , Streamlit displays no label or spacer. Returns (int/float/date/time/datetime or tuple of int/float/date/time/datetime) The current value of the slider widget. The return type will match the data type of the value parameter. Examples import streamlit as st age = st.slider("How old are you?", 0, 130, 25) st.write("I'm ", age, "years old") And here's an example of a range slider: import streamlit as st values = st.slider("Select a range of values", 0.0, 100.0, (25.0, 75.0)) st.write("Values:", values) This is a range time slider: import streamlit as st from datetime import time appointment = st.slider( "Schedule your appointment:", value=(time(11, 30), time(12, 45)) ) st.write("You're scheduled for:", appointment) Finally, a datetime slider: import streamlit as st from datetime import datetime start_time = st.slider( "When do you start?", value=datetime(2020, 1, 1, 9, 30), format="MM/DD/YY - hh:mm", ) st.write("Start time:", start_time) Built with Streamlit 🎈 Fullscreen open_in_new Featured videos Check out our video on how to use one of Streamlit's core functions, the slider! In the video below, we'll take it a step further and make a double-ended slider. Previous: st.number_input Next: st.date_input forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.toggle_-_Streamlit_Docs.txt
st.toggle - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets remove BUTTONS st.button st.download_button st.form_submit_button link st.link_button st.page_link SELECTIONS st.checkbox st.color_picker st.feedback st.multiselect st.pills st.radio st.segmented_control st.selectbox st.select_slider st.toggle NUMERIC st.number_input st.slider DATE & TIME st.date_input st.time_input TEXT st.chat_input link st.text_area st.text_input MEDIA & FILES st.audio_input st.camera_input st.data_editor link st.file_uploader Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Input widgets / st.toggle st.toggle Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a toggle widget. Function signature [source] st.toggle(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility="visible") Parameters label (str) A short label explaining to the user what this toggle is for. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. For accessibility reasons, you should never set an empty label, but you can hide it with label_visibility if needed. In the future, we may disallow empty labels by raising an exception. value (bool) Preselect the toggle when it first renders. This will be cast to bool internally. key (str or int) An optional string or integer to use as the unique key for the widget. If this is omitted, a key will be generated for the widget based on its content. No two widgets may have the same key. help (str) An optional tooltip that gets displayed next to the widget label. Streamlit only displays the tooltip when label_visibility="visible" . on_change (callable) An optional callback invoked when this toggle's value changes. args (tuple) An optional tuple of args to pass to the callback. kwargs (dict) An optional dict of kwargs to pass to the callback. disabled (bool) An optional boolean that disables the toggle if set to True . The default is False . label_visibility ("visible", "hidden", or "collapsed") The visibility of the label. The default is "visible" . If this is "hidden" , Streamlit displays an empty spacer instead of the label, which can help keep the widget alligned with other widgets. If this is "collapsed" , Streamlit displays no label or spacer. Returns (bool) Whether or not the toggle is checked. Example import streamlit as st on = st.toggle("Activate feature") if on: st.write("Feature activated!") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.select_slider Next: st.number_input forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Create_a_multipage_app_-_Streamlit_Docs.txt
Create a multipage app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps remove Create an app Create a multipage app code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Get started / First steps / Create a multipage app Create a multipage app In Additional features , we introduced multipage apps, including how to define pages, structure and run multipage apps, and navigate between pages in the user interface. You can read more details in our guide to Multipage apps In this guide, let’s put our understanding of multipage apps to use by converting the previous version of our streamlit hello app to a multipage app! Motivation Before Streamlit 1.10.0, the streamlit hello command was a large single-page app. As there was no support for multiple pages, we resorted to splitting the app's content using st.selectbox in the sidebar to choose what content to run. The content is comprised of three demos for plotting, mapping, and dataframes. Here's what the code and single-page app looked like: hello.py (👈 Toggle to expand) import streamlit as st def intro(): import streamlit as st st.write("# Welcome to Streamlit! 👋") st.sidebar.success("Select a demo above.") st.markdown( """ Streamlit is an open-source app framework built specifically for Machine Learning and Data Science projects. **👈 Select a demo from the dropdown on the left** to see some examples of what Streamlit can do! ### Want to learn more? - Check out [streamlit.io](https://streamlit.io) - Jump into our [documentation](https://docs.streamlit.io) - Ask a question in our [community forums](https://discuss.streamlit.io) ### See more complex demos - Use a neural net to [analyze the Udacity Self-driving Car Image Dataset](https://github.com/streamlit/demo-self-driving) - Explore a [New York City rideshare dataset](https://github.com/streamlit/demo-uber-nyc-pickups) """ ) def mapping_demo(): import streamlit as st import pandas as pd import pydeck as pdk from urllib.error import URLError st.markdown(f"# {list(page_names_to_funcs.keys())[2]}") st.write( """ This demo shows how to use [`st.pydeck_chart`](https://docs.streamlit.io/develop/api-reference/charts/st.pydeck_chart) to display geospatial data. """ ) @st.cache_data def from_data_file(filename): url = ( "http://raw.githubusercontent.com/streamlit/" "example-data/master/hello/v1/%s" % filename ) return pd.read_json(url) try: ALL_LAYERS = { "Bike Rentals": pdk.Layer( "HexagonLayer", data=from_data_file("bike_rental_stats.json"), get_position=["lon", "lat"], radius=200, elevation_scale=4, elevation_range=[0, 1000], extruded=True, ), "Bart Stop Exits": pdk.Layer( "ScatterplotLayer", data=from_data_file("bart_stop_stats.json"), get_position=["lon", "lat"], get_color=[200, 30, 0, 160], get_radius="[exits]", radius_scale=0.05, ), "Bart Stop Names": pdk.Layer( "TextLayer", data=from_data_file("bart_stop_stats.json"), get_position=["lon", "lat"], get_text="name", get_color=[0, 0, 0, 200], get_size=15, get_alignment_baseline="'bottom'", ), "Outbound Flow": pdk.Layer( "ArcLayer", data=from_data_file("bart_path_stats.json"), get_source_position=["lon", "lat"], get_target_position=["lon2", "lat2"], get_source_color=[200, 30, 0, 160], get_target_color=[200, 30, 0, 160], auto_highlight=True, width_scale=0.0001, get_width="outbound", width_min_pixels=3, width_max_pixels=30, ), } st.sidebar.markdown("### Map Layers") selected_layers = [ layer for layer_name, layer in ALL_LAYERS.items() if st.sidebar.checkbox(layer_name, True) ] if selected_layers: st.pydeck_chart( pdk.Deck( map_style="mapbox://styles/mapbox/light-v9", initial_view_state={ "latitude": 37.76, "longitude": -122.4, "zoom": 11, "pitch": 50, }, layers=selected_layers, ) ) else: st.error("Please choose at least one layer above.") except URLError as e: st.error( """ **This demo requires internet access.** Connection error: %s """ % e.reason ) def plotting_demo(): import streamlit as st import time import numpy as np st.markdown(f'# {list(page_names_to_funcs.keys())[1]}') st.write( """ This demo illustrates a combination of plotting and animation with Streamlit. We're generating a bunch of random numbers in a loop for around 5 seconds. Enjoy! """ ) progress_bar = st.sidebar.progress(0) status_text = st.sidebar.empty() last_rows = np.random.randn(1, 1) chart = st.line_chart(last_rows) for i in range(1, 101): new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0) status_text.text("%i%% Complete" % i) chart.add_rows(new_rows) progress_bar.progress(i) last_rows = new_rows time.sleep(0.05) progress_bar.empty() # Streamlit widgets automatically run the script from top to bottom. Since # this button is not connected to any other logic, it just causes a plain # rerun. st.button("Re-run") def data_frame_demo(): import streamlit as st import pandas as pd import altair as alt from urllib.error import URLError st.markdown(f"# {list(page_names_to_funcs.keys())[3]}") st.write( """ This demo shows how to use `st.write` to visualize Pandas DataFrames. (Data courtesy of the [UN Data Explorer](http://data.un.org/Explorer.aspx).) """ ) @st.cache_data def get_UN_data(): AWS_BUCKET_URL = "http://streamlit-demo-data.s3-us-west-2.amazonaws.com" df = pd.read_csv(AWS_BUCKET_URL + "/agri.csv.gz") return df.set_index("Region") try: df = get_UN_data() countries = st.multiselect( "Choose countries", list(df.index), ["China", "United States of America"] ) if not countries: st.error("Please select at least one country.") else: data = df.loc[countries] data /= 1000000.0 st.write("### Gross Agricultural Production ($B)", data.sort_index()) data = data.T.reset_index() data = pd.melt(data, id_vars=["index"]).rename( columns={"index": "year", "value": "Gross Agricultural Product ($B)"} ) chart = ( alt.Chart(data) .mark_area(opacity=0.3) .encode( x="year:T", y=alt.Y("Gross Agricultural Product ($B):Q", stack=None), color="Region:N", ) ) st.altair_chart(chart, use_container_width=True) except URLError as e: st.error( """ **This demo requires internet access.** Connection error: %s """ % e.reason ) page_names_to_funcs = { "—": intro, "Plotting Demo": plotting_demo, "Mapping Demo": mapping_demo, "DataFrame Demo": data_frame_demo } demo_name = st.sidebar.selectbox("Choose a demo", page_names_to_funcs.keys()) page_names_to_funcs[demo_name]() Built with Streamlit 🎈 Fullscreen open_in_new Notice how large the file is! Each app “page" is written as a function, and the selectbox is used to pick which page to display. As our app grows, maintaining the code requires a lot of additional overhead. Moreover, we’re limited by the st.selectbox UI to choose which “page" to run, we cannot customize individual page titles with st.set_page_config , and we’re unable to navigate between pages using URLs. Convert an existing app into a multipage app Now that we've identified the limitations of a single-page app, what can we do about it? Armed with our knowledge from the previous section, we can convert the existing app to be a multipage app, of course! At a high level, we need to perform the following steps: Create a new pages folder in the same folder where the “entrypoint file" ( hello.py ) lives Rename our entrypoint file to Hello.py , so that the title in the sidebar is capitalized Create three new files inside of pages : pages/1_📈_Plotting_Demo.py pages/2_🌍_Mapping_Demo.py pages/3_📊_DataFrame_Demo.py Move the contents of the plotting_demo , mapping_demo , and data_frame_demo functions into their corresponding new files from Step 3 Run streamlit run Hello.py to view your newly converted multipage app! Now, let’s walk through each step of the process and view the corresponding changes in code. Create the entrypoint file Hello.py import streamlit as st st.set_page_config( page_title="Hello", page_icon="👋", ) st.write("# Welcome to Streamlit! 👋") st.sidebar.success("Select a demo above.") st.markdown( """ Streamlit is an open-source app framework built specifically for Machine Learning and Data Science projects. **👈 Select a demo from the sidebar** to see some examples of what Streamlit can do! ### Want to learn more? - Check out [streamlit.io](https://streamlit.io) - Jump into our [documentation](https://docs.streamlit.io) - Ask a question in our [community forums](https://discuss.streamlit.io) ### See more complex demos - Use a neural net to [analyze the Udacity Self-driving Car Image Dataset](https://github.com/streamlit/demo-self-driving) - Explore a [New York City rideshare dataset](https://github.com/streamlit/demo-uber-nyc-pickups) """ ) We rename our entrypoint file to Hello.py , so that the title in the sidebar is capitalized and only the code for the intro page is included. Additionally, we’re able to customize the page title and favicon — as it appears in the browser tab with st.set_page_config . We can do so for each of our pages too! Notice how the sidebar does not contain page labels as we haven’t created any pages yet. Create multiple pages A few things to remember here: We can change the ordering of pages in our MPA by adding numbers to the beginning of each Python file. If we add a 1 to the front of our file name, Streamlit will put that file first in the list. The name of each Streamlit app is determined by the file name, so to change the app name you need to change the file name! We can add some fun to our app by adding emojis to our file names that will render in our Streamlit app. Each page will have its own URL, defined by the name of the file. Check out how we do all this below! For each new page, we create a new file inside the pages folder, and add the appropriate demo code into it. pages/1_📈_Plotting_Demo.py import streamlit as st import time import numpy as np st.set_page_config(page_title="Plotting Demo", page_icon="📈") st.markdown("# Plotting Demo") st.sidebar.header("Plotting Demo") st.write( """This demo illustrates a combination of plotting and animation with Streamlit. We're generating a bunch of random numbers in a loop for around 5 seconds. Enjoy!""" ) progress_bar = st.sidebar.progress(0) status_text = st.sidebar.empty() last_rows = np.random.randn(1, 1) chart = st.line_chart(last_rows) for i in range(1, 101): new_rows = last_rows[-1, :] + np.random.randn(5, 1).cumsum(axis=0) status_text.text("%i%% Complete" % i) chart.add_rows(new_rows) progress_bar.progress(i) last_rows = new_rows time.sleep(0.05) progress_bar.empty() # Streamlit widgets automatically run the script from top to bottom. Since # this button is not connected to any other logic, it just causes a plain # rerun. st.button("Re-run") pages/2_🌍_Mapping_Demo.py import streamlit as st import pandas as pd import pydeck as pdk from urllib.error import URLError st.set_page_config(page_title="Mapping Demo", page_icon="🌍") st.markdown("# Mapping Demo") st.sidebar.header("Mapping Demo") st.write( """This demo shows how to use [`st.pydeck_chart`](https://docs.streamlit.io/develop/api-reference/charts/st.pydeck_chart) to display geospatial data.""" ) @st.cache_data def from_data_file(filename): url = ( "http://raw.githubusercontent.com/streamlit/" "example-data/master/hello/v1/%s" % filename ) return pd.read_json(url) try: ALL_LAYERS = { "Bike Rentals": pdk.Layer( "HexagonLayer", data=from_data_file("bike_rental_stats.json"), get_position=["lon", "lat"], radius=200, elevation_scale=4, elevation_range=[0, 1000], extruded=True, ), "Bart Stop Exits": pdk.Layer( "ScatterplotLayer", data=from_data_file("bart_stop_stats.json"), get_position=["lon", "lat"], get_color=[200, 30, 0, 160], get_radius="[exits]", radius_scale=0.05, ), "Bart Stop Names": pdk.Layer( "TextLayer", data=from_data_file("bart_stop_stats.json"), get_position=["lon", "lat"], get_text="name", get_color=[0, 0, 0, 200], get_size=15, get_alignment_baseline="'bottom'", ), "Outbound Flow": pdk.Layer( "ArcLayer", data=from_data_file("bart_path_stats.json"), get_source_position=["lon", "lat"], get_target_position=["lon2", "lat2"], get_source_color=[200, 30, 0, 160], get_target_color=[200, 30, 0, 160], auto_highlight=True, width_scale=0.0001, get_width="outbound", width_min_pixels=3, width_max_pixels=30, ), } st.sidebar.markdown("### Map Layers") selected_layers = [ layer for layer_name, layer in ALL_LAYERS.items() if st.sidebar.checkbox(layer_name, True) ] if selected_layers: st.pydeck_chart( pdk.Deck( map_style="mapbox://styles/mapbox/light-v9", initial_view_state={ "latitude": 37.76, "longitude": -122.4, "zoom": 11, "pitch": 50, }, layers=selected_layers, ) ) else: st.error("Please choose at least one layer above.") except URLError as e: st.error( """ **This demo requires internet access.** Connection error: %s """ % e.reason ) pages/3_📊_DataFrame_Demo.py import streamlit as st import pandas as pd import altair as alt from urllib.error import URLError st.set_page_config(page_title="DataFrame Demo", page_icon="📊") st.markdown("# DataFrame Demo") st.sidebar.header("DataFrame Demo") st.write( """This demo shows how to use `st.write` to visualize Pandas DataFrames. (Data courtesy of the [UN Data Explorer](http://data.un.org/Explorer.aspx).)""" ) @st.cache_data def get_UN_data(): AWS_BUCKET_URL = "http://streamlit-demo-data.s3-us-west-2.amazonaws.com" df = pd.read_csv(AWS_BUCKET_URL + "/agri.csv.gz") return df.set_index("Region") try: df = get_UN_data() countries = st.multiselect( "Choose countries", list(df.index), ["China", "United States of America"] ) if not countries: st.error("Please select at least one country.") else: data = df.loc[countries] data /= 1000000.0 st.write("### Gross Agricultural Production ($B)", data.sort_index()) data = data.T.reset_index() data = pd.melt(data, id_vars=["index"]).rename( columns={"index": "year", "value": "Gross Agricultural Product ($B)"} ) chart = ( alt.Chart(data) .mark_area(opacity=0.3) .encode( x="year:T", y=alt.Y("Gross Agricultural Product ($B):Q", stack=None), color="Region:N", ) ) st.altair_chart(chart, use_container_width=True) except URLError as e: st.error( """ **This demo requires internet access.** Connection error: %s """ % e.reason ) With our additional pages created, we can now put it all together in the final step below. Run the multipage app To run your newly converted multipage app, run: streamlit run Hello.py That’s it! The Hello.py script now corresponds to the main page of your app, and other scripts that Streamlit finds in the pages folder will also be present in the new page selector that appears in the sidebar. Built with Streamlit 🎈 Fullscreen open_in_new Next steps Congratulations! 🎉 If you've read this far, chances are you've learned to create both single-page and multipage apps. Where you go from here is entirely up to your creativity! We’re excited to see what you’ll build now that adding additional pages to your apps is easier than ever. Try adding more pages to the app we've just built as an exercise. Also, stop by the forum to show off your multipage apps with the Streamlit community! 🎈 Here are a few resources to help you get started: Deploy your app for free on Streamlit's Community Cloud . Post a question or share your multipage app on our community forum . Check out our documentation on Multipage apps . Read through Concepts for things like caching, theming, and adding statefulness to apps. Browse our API reference for examples of every Streamlit command. Previous: Create an app Next: Develop forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_Streamlit_to_Tableau_-_Streamlit_Docs.txt
Connect Streamlit to Tableau - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources / Tableau Connect Streamlit to Tableau Introduction This guide explains how to securely access data on Tableau from Streamlit Community Cloud. It uses the tableauserverclient library and Streamlit's Secrets management . Create a Tableau site push_pin Note If you already have a database that you want to use, feel free to skip to the next step . For simplicity, we are using the cloud version of Tableau here but this guide works equally well for self-hosted deployments. First, sign up for Tableau Online or log in. Create a workbook or run one of the example workbooks under "Dashboard Starters". Create personal access tokens While the Tableau API allows authentication via username and password, you should use personal access tokens for a production app. Go to your Tableau Online homepage , create an access token and note down the token name and secret. push_pin Note Personal access tokens will expire if not used after 15 consecutive days. Add token to your local app secrets Your local Streamlit app will read secrets from a file .streamlit/secrets.toml in your app's root directory. Create this file if it doesn't exist yet and add your token, the site name you created during setup, and the URL of your Tableau server like below: # .streamlit/secrets.toml [tableau] token_name = "xxx" token_secret = "xxx" server_url = "https://abc01.online.tableau.com/" site_id = "streamlitexample" # in your site's URL behind the server_url priority_high Important Add this file to .gitignore and don't commit it to your GitHub repo! Copy your app secrets to the cloud As the secrets.toml file above is not committed to GitHub, you need to pass its content to your deployed app (on Streamlit Community Cloud) separately. Go to the app dashboard and in the app's dropdown menu, click on Edit Secrets . Copy the content of secrets.toml into the text area. More information is available at Secrets management . Add tableauserverclient to your requirements file Add the tableauserverclient package to your requirements.txt file, preferably pinning its version (replace x.x.x with the version you want installed): # requirements.txt tableauserverclient==x.x.x Write your Streamlit app Copy the code below to your Streamlit app and run it. Note that this code just shows a few options of data you can get – explore the tableauserverclient library to find more! # streamlit_app.py import streamlit as st import tableauserverclient as TSC # Set up connection. tableau_auth = TSC.PersonalAccessTokenAuth( st.secrets["tableau"]["token_name"], st.secrets["tableau"]["personal_access_token"], st.secrets["tableau"]["site_id"], ) server = TSC.Server(st.secrets["tableau"]["server_url"], use_server_version=True) # Get various data. # Explore the tableauserverclient library for more options. # Uses st.cache_data to only rerun when the query changes or after 10 min. @st.cache_data(ttl=600) def run_query(): with server.auth.sign_in(tableau_auth): # Get all workbooks. workbooks, pagination_item = server.workbooks.get() workbooks_names = [w.name for w in workbooks] # Get views for first workbook. server.workbooks.populate_views(workbooks[0]) views_names = [v.name for v in workbooks[0].views] # Get image & CSV for first view of first workbook. view_item = workbooks[0].views[0] server.views.populate_image(view_item) server.views.populate_csv(view_item) view_name = view_item.name view_image = view_item.image # `view_item.csv` is a list of binary objects, convert to str. view_csv = b"".join(view_item.csv).decode("utf-8") return workbooks_names, views_names, view_name, view_image, view_csv workbooks_names, views_names, view_name, view_image, view_csv = run_query() # Print results. st.subheader("📓 Workbooks") st.write("Found the following workbooks:", ", ".join(workbooks_names)) st.subheader("👁️ Views") st.write( f"Workbook *{workbooks_names[0]}* has the following views:", ", ".join(views_names), ) st.subheader("🖼️ Image") st.write(f"Here's what view *{view_name}* looks like:") st.image(view_image, width=300) st.subheader("📊 Data") st.write(f"And here's the data for view *{view_name}*:") st.write(pd.read_csv(StringIO(view_csv))) See st.cache_data above? Without it, Streamlit would run the query every time the app reruns (e.g. on a widget interaction). With st.cache_data , it only runs when the query changes or after 10 minutes (that's what ttl is for). Watch out: If your database updates more frequently, you should adapt ttl or remove caching so viewers always see the latest data. Learn more in Caching . If everything worked out, your app should look like this (can differ based on your workbooks): Previous: Supabase Next: TiDB forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Animate_and_update_elements_-_Streamlit_Docs.txt
Animate and update elements - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps add App design remove Animate & update elements Button behavior and examples Dataframes Using custom classes Working with timezones ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / App design / Animate & update elements Animate and update elements Sometimes you display a chart or dataframe and want to modify it live as the app runs (for example, in a loop). Some elements have built-in methods to allow you to update them in-place without rerunning the app. Updatable elements include the following: st.empty containers can be written to in sequence and will always show the last thing written. They can also be cleared with an additional .empty() called like a method. st.dataframe , st.table , and many chart elements can be updated with the .add_rows() method which appends data. st.progress elements can be updated with additional .progress() calls. They can also be cleared with a .empty() method call. st.status containers have an .update() method to change their labels, expanded state, and status. st.toast messages can be updated in place with additional .toast() calls. st.empty containers st.empty can hold a single element. When you write any element to an st.empty container, Streamlit discards its previous content displays the new element. You can also st.empty containers by calling .empty() as a method. If you want to update a set of elements, use a plain container ( st.container() ) inside st.empty and write contents to the plain container. Rewrite the plain container and its contents as often as desired to update your app's display. The .add_rows() method st.dataframe , st.table , and all chart functions can be mutated using the .add_rows() method on their output. In the following example, we use my_data_element = st.line_chart(df) . You can try the example with st.table , st.dataframe , and most of the other simple charts by just swapping out st.line_chart . Note that st.dataframe only shows the first ten rows by default and enables scrolling for additional rows. This means adding rows is not as visually apparent as it is with st.table or the chart elements. import streamlit as st import pandas as pd import numpy as np import time df = pd.DataFrame(np.random.randn(15, 3), columns=(["A", "B", "C"])) my_data_element = st.line_chart(df) for tick in range(10): time.sleep(.5) add_df = pd.DataFrame(np.random.randn(1, 3), columns=(["A", "B", "C"])) my_data_element.add_rows(add_df) st.button("Regenerate") Previous: App design Next: Button behavior and examples forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.Page_-_Streamlit_Docs.txt
st.Page - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages remove st.navigation st.Page st.page_link link st.switch_page Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Navigation and pages / st.Page st.Page Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Configure a page for st.navigation in a multipage app. Call st.Page to initialize a StreamlitPage object, and pass it to st.navigation to declare a page in your app. When a user navigates to a page, st.navigation returns the selected StreamlitPage object. Call .run() on the returned StreamlitPage object to execute the page. You can only run the page returned by st.navigation , and you can only run it once per app rerun. A page can be defined by a Python file or Callable . Python files used as a StreamlitPage source will have __name__ == "__page__" . Functions used as a StreamlitPage source will have __name__ corresponding to the module they were imported from. Only the entrypoint file and functions defined within the entrypoint file have __name__ == "__main__" to adhere to Python convention. Function signature [source] st.Page(page, *, title=None, icon=None, url_path=None, default=False) Parameters page (str, Path, or callable) The page source as a Callable or path to a Python file. If the page source is defined by a Python file, the path can be a string or pathlib.Path object. Paths can be absolute or relative to the entrypoint file. If the page source is defined by a Callable , the Callable can't accept arguments. title (str or None) The title of the page. If this is None (default), the page title (in the browser tab) and label (in the navigation menu) will be inferred from the filename or callable name in page . For more information, see Overview of multipage apps . icon (str or None) An optional emoji or icon to display next to the page title and label. If icon is None (default), no icon is displayed next to the page label in the navigation menu, and a Streamlit icon is displayed next to the title (in the browser tab). If icon is a string, the following options are valid: A single-character emoji. For example, you can set icon="🚨" or icon="🔥" . Emoji short codes are not supported. An icon from the Material Symbols library (rounded style) in the format ":material/icon_name:" where "icon_name" is the name of the icon in snake case. For example, icon=":material/thumb_up:" will display the Thumb Up icon. Find additional icons in the Material Symbols font library. url_path (str or None) The page's URL pathname, which is the path relative to the app's root URL. If this is None (default), the URL pathname will be inferred from the filename or callable name in page . For more information, see Overview of multipage apps . The default page will have a pathname of "" , indicating the root URL of the app. If you set default=True , url_path is ignored. url_path can't include forward slashes; paths can't include subdirectories. default (bool) Whether this page is the default page to be shown when the app is loaded. If default is False (default), the page will have a nonempty URL pathname. However, if no default page is passed to st.navigation and this is the first page, this page will become the default page. If default is True , then the page will have an empty pathname and url_path will be ignored. Returns (StreamlitPage) The page object associated to the given script. Example import streamlit as st def page2(): st.title("Second page") pg = st.navigation([ st.Page("page1.py", title="First page", icon="🔥"), st.Page(page2, title="Second page", icon=":material/favorite:"), ]) pg.run() StreamlitPage Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake A page within a multipage Streamlit app. Use st.Page to initialize a StreamlitPage object. Class description [source] StreamlitPage(page, *, title=None, icon=None, url_path=None, default=False) Methods run () Execute the page. Attributes icon (str) The icon of the page. If no icon was declared in st.Page , this property returns "" . title (str) The title of the page. Unless declared otherwise in st.Page , the page title is inferred from the filename or callable name. For more information, see Overview of multipage apps . url_path (str) The page's URL pathname, which is the path relative to the app's root URL. Unless declared otherwise in st.Page , the URL pathname is inferred from the filename or callable name. For more information, see Overview of multipage apps . The default page will always have a url_path of "" to indicate the root URL (e.g. homepage). StreamlitPage.run Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Execute the page. When a page is returned by st.navigation , use the .run() method within your entrypoint file to render the page. You can only call this method on the page returned by st.navigation . You can only call this method once per run of your entrypoint file. Function signature [source] StreamlitPage.run() Previous: st.navigation Next: st.page_link forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
ModuleNotFoundError_No_module_named___Streamlit_Do.txt
ModuleNotFoundError No module named - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Knowledge base / Installing dependencies / ModuleNotFoundError No module named ModuleNotFoundError: No module named Problem You receive the error ModuleNotFoundError: No module named when you deploy an app on Streamlit Community Cloud . Solution This error occurs when you import a module on Streamlit Community Cloud that isn’t included in your requirements file. Any external Python dependencies that are not distributed with a standard Python installation should be included in your requirements file. E.g. You will see ModuleNotFoundError: No module named 'sklearn' if you don’t include scikit-learn in your requirements file and import sklearn in your app. Related forum posts: https://discuss.streamlit.io/t/getting-error-modulenotfounderror-no-module-named-beautifulsoup/9126 https://discuss.streamlit.io/t/modulenotfounderror-no-module-named-vega-datasets/16354 Previous: ImportError libGL.so.1 cannot open shared object file No such file or directory Next: ERROR No matching distribution found for forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
The_app_chrome_-_Streamlit_Docs.txt
The app chrome - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution remove Running your app Streamlit's architecture The app chrome Caching Session State Forms Fragments Widget behavior Multipage apps add App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Architecture & execution / The app chrome The app chrome Your Streamlit app has a few widgets in the top right to help you as you develop. These widgets also help your viewers as they use your app. We call this things “the app chrome”. The chrome includes a status area, toolbar, and app menu. Your app menu is configurable. By default, you can access developer options from the app menu when viewing an app locally or on Streamlit Community Cloud while logged into an account with administrative access. While viewing an app, click the icon in the upper-right corner to access the menu. Menu options The menu is split into two sections. The upper section contains options available to all viewers and the lower section contains options for developers. Read more about customizing this menu at the end of this page. Rerun You can manually trigger a rerun of your app by clicking " Rerun " from the app menu. This rerun will not reset your session. Your widget states and values stored in st.session_state will be preserved. As a shortcut, without opening the app menu, you can rerun your app by pressing " R " on your keyboard (if you aren't currently focused on an input element). Settings With the " Settings " option, you can control the appearance of your app while it is running. If viewing the app locally, you can set how your app responds to changes in your source code. See more about development flow in Basic concepts . You can also force your app to appear in wide mode, even if not set within the script using st.set_page_config . Theme settings After clicking " Settings " from the app menu, you can choose between " Light ", " Dark ", or " Use system setting " for the app's base theme. Click " Edit active theme " to modify the theme, color-by-color. Print Click " Print " or use keyboard shortcuts ( ⌘+P or Ctrl+P ) to open a print dialog. This option uses your browser's built-in print-to-pdf function. To modify the appearance of your print, you can do the following: Expand or collapse the sidebar before printing to respectively include or exclude it from the print. Resize the sidebar in your app by clicking and dragging its right border to achieve your desired width. You may need to enable " Background graphics " in your print dialog if you are printing in dark mode. You may need to disable wide mode in Settings or adjust the print scale to prevent elements from clipping off the page. Record a screencast You can easily make screen recordings right from your app! Screen recording is supported in the latest versions of Chrome, Edge, and Firefox. Ensure your browser is up-to-date for compatibility. Depending on your current settings, you may need to grant permission to your browser to record your screen or to use your microphone if recording a voiceover. While viewing your app, open the app menu from the upper-right corner. Click " Record a screencast ." If you want to record audio through your microphone, check " Also record audio ." Click " Start recording ." (You may be prompted by your OS to permit your browser to record your screen or use your microphone.) Select which tab, window, or monitor you want to record from the listed options. The interface will vary depending on your browser. Click " Share ." While recording, you will see a red circle on your app's tab and on the app menu icon. If you want to cancel the recording, click " Stop sharing " at the bottom of your app. When you are done recording, press " Esc " on your keyboard or click " Stop recording " from your app's menu. Follow your browser's instructions to save your recording. Your saved recording will be available where your browser saves downloads. The whole process looks like this: About You can conveniently check what version of Streamlit is running from the " About " option. Developers also have the option to customize the message shown here using st.set_page_config . Developer options By default, developer options only show when viewing an app locally or when viewing a Community Cloud app while logged in with administrative permission. You can customize the menu if you want to make these options available for all users. Clear cache Reset your app's cache by clicking " Clear cache " from the app's menu or by pressing " C " on your keyboard while not focused on an input element. This will remove all cached entries for @st.cache_data and @st.cache_resource . Deploy this app If you are running an app locally from within a git repo, you can deploy your app to Streamlit Community Cloud in a few easy clicks! Make sure your work has been pushed to your online GitHub repository before beginning. For the greatest convenience, make sure you have already created your Community Cloud account and are signed in. Click " Deploy " next to the app menu icon ( more_vert ). Click " Deploy now ." You will be taken to Community Cloud's "Deploy an app" page. Your app's repository, branch, and file name will be prefilled to match your current app! Learn more about deploying an app on Streamlit Community Cloud. The whole process looks like this: Customize the menu Using client.toolbarMode in your app's configuration , you can make the app menu appear in the following ways: "developer" — Show the developer options to all viewers. "viewer" — Hide the developer options from all viewers. "minimal" — Show only those options set externally. These options can be declared through st.set_page_config or populated through Streamlit Community Cloud. "auto" — This is the default and will show the developer options when accessed through localhost or through Streamlit Community Cloud when logged into an administrative account for the app. Otherwise, the developer options will not show. Previous: Streamlit's architecture Next: Caching forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Working_with_widgets_in_multipage_apps___Streamlit.txt
Working with widgets in multipage apps - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts remove CORE Architecture & execution add Multipage apps remove Overview Page and navigation Pages directory Working with widgets App design add ADDITIONAL Connections and secrets add Custom components add Configuration and theming add App testing add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Concepts / Multipage apps / Working with widgets Working with widgets in multipage apps When you create a widget in a Streamlit app, Streamlit generates a widget ID and uses it to make your widget stateful. As your app reruns with user interaction, Streamlit keeps track of the widget's value by associating its value to its ID. In particular, a widget's ID depends on the page where it's created. If you define an identical widget on two different pages, then the widget will reset to its default value when you switch pages. This guide explains three strategies to deal with the behavior if you'd like to have a widget remain stateful across all pages. If don't want a widget to appear on all pages, but you do want it to remain stateful when you navigate away from its page (and then back), Options 2 and 3 can be used. For detailed information about these strategies, see Understanding widget behavior . Option 1 (preferred): Execute your widget command in your entrypoint file When you define your multipage app with st.Page and st.navigation , your entrypoint file becomes a frame of common elements around your pages. When you execute a widget command in your entrypoint file, Streamlit associates the widget to your entrypoint file instead of a particular page. Since your entrypoint file is executed in every app rerun, any widget in your entrypoint file will remain stateful as your users switch between pages. This method does not work if you define your app with the pages/ directory. The following example includes a selectbox and slider in the sidebar that are rendered and stateful on all pages. The widgets each have an assigned key so you can access their values through Session State within a page. Directory structure: your-repository/ ├── page_1.py ├── page_2.py └── streamlit_app.py streamlit_app.py : import streamlit as st pg = st.navigation([st.Page("page_1.py"), st.Page("page_2.py")]) st.sidebar.selectbox("Group", ["A","B","C"], key="group") st.sidebar.slider("Size", 1, 5, key="size") pg.run() Option 2: Save your widget values into a dummy key in Session State If you want to navigate away from a widget and return to it while keeping its value, or if you want to use the same widget on multiple pages, use a separate key in st.session_state to save the value independently from the widget. In this example, a temporary key is used with a widget. The temporary key uses an underscore prefix. Hence, "_my_key" is used as the widget key, but the data is copied to "my_key" to preserve it between pages. import streamlit as st def store_value(): # Copy the value to the permanent key st.session_state["my_key"] = st.session_state["_my_key"] # Copy the saved value to the temporary key st.session_state["_my_key"] = st.session_state["my_key"] st.number_input("Number of filters", key="_my_key", on_change=store_value) If this is functionalized to work with multiple widgets, it could look something like this: import streamlit as st def store_value(key): st.session_state[key] = st.session_state["_"+key] def load_value(key): st.session_state["_"+key] = st.session_state[key] load_value("my_key") st.number_input("Number of filters", key="_my_key", on_change=store_value, args=["my_key"]) Option 3: Interrupt the widget clean-up process When Streamlit gets to the end of an app run, it will delete the data for any widgets that were not rendered. This includes data for any widget not associated to the current page. However, if you re-save a key-value pair in an app run, Streamlit will not associate the key-value pair to any widget until you execute a widget command again with that key. As a result, if you have the following code at the top of every page, any widget with the key "my_key" will retain its value wherever it's rendered (or not). Alternatively, if you are using st.navigation and st.Page , you can include this once in your entrypoint file before executing your page. if "my_key" in st.session_state: st.session_state.my_key = st.session_state.my_key Previous: Pages directory Next: App design forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Status_and_limitations_-_Streamlit_Docs.txt
Status and limitations - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app add Manage your app add Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Status and limitations Status and limitations of Community Cloud Community Cloud Status You can view the current status of Community Cloud at streamlitstatus.com . GitHub OAuth scope To deploy your app, Streamlit requires access to your app's source code in GitHub and the ability to manage the public keys associated with your repositories. The default GitHub OAuth scopes are sufficient to work with apps in public GitHub repositories. However, to access your private repositories, we create a read-only GitHub Deploy Key and then access your repo using an SSH key. When we create this key, GitHub notifies repo admins of the creation as a security measure. Streamlit requires the additional repo OAuth scope from GitHub to work with your private repos and manage deploy keys. We recognize that the repo scope provides Streamlit with extra permissions that we do not really need and which, as people who prize security, we'd rather not even be granted. This was the permission model available from GitHub when Community Cloud was created. However, we are working on adopting the new GitHub permission model to reduce uneeded permissions. Developer permissions Because of the OAuth limitations noted above, a developer must have administrative permissions to a repository to deploy apps from it. Repository file structure You can deploy multiple apps from your repository, and your entrypoint file(s) may be anywhere in your directory structure. However, Community Cloud initializes all apps from the root of your repository, even if the entrypoint file is in a subdirectory. This has the following consequences: Community Cloud only recognizes one .streamlit/configuration.toml file at the root (of each branch) of your repository. You must declare image, video, and audio file paths for Streamlit commands relative to the root of your repository. For example, st.image , st.logo , and the page_icon parameter in st.set_page_config expect file locations relative to your working directory (i.e. where you execute streamlit run ). Linux environments Community Cloud is built on Debian Linux. Community Cloud uses Debian 11 ("bullseye"). To browse available packages that can be installed, see the package list . All file paths must use forward-slash path separators. Python environments You cannot mix and match Python package managers for a single app. Community Cloud configures your app's Python environment based on the first environment configuration file it finds. For more information, see Other Python package managers . We recommend that you use the latest version of Streamlit to ensure full Community Cloud functionality. Be sure to take note of Streamlit's current requirements for package compatibility when planning your environment, especially protobuf>=3.20,<6 . If you pin streamlit< 1.20.0 , you must also pin altair<5 . Earlier versions of Streamlit did not correctly restrict Altair's version. A workaround script running on Community Cloud will forcibly install altair<5 if a newer version is detected. This could unintentionally upgrade Altair's dependencies in violation of your environment configuration. Newer versions of Streamlit support Altair version 5. Community Cloud only supports released versions of Python that are still receiving security updates. You may not use end-of-life, prerelease, or feature versions of Python. For more information, see Status of Python versions . Configuration The following configuration options are set within Community Cloud and will override any contrary setting in your config.toml file: [client] showErrorDetails = false [runner] fastReruns = true [server] runOnSave = true enableXsrfProtection = true [browser] gatherUsageStats = true IP addresses If you need to whitelist IP addresses for a connection, Community Cloud is currently served from the following IP addresses: priority_high Warning These IP addresses may change at any time without notice. 35.230.127.150 35.203.151.101 34.19.100.134 34.83.176.217 35.230.58.211 35.203.187.165 35.185.209.55 34.127.88.74 34.127.0.121 35.230.78.192 35.247.110.67 35.197.92.111 34.168.247.159 35.230.56.30 34.127.33.101 35.227.190.87 35.199.156.97 34.82.135.155 Other limitations When you print something to the Cloud logs, you may need to do a sys.stdout.flush() before it shows up. Community Cloud hosts all apps in the United States. This is currently not configurable. Community Cloud rate limits app updates from GitHub to no more than five per minute. Previous: Manage your account Next: Snowflake forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.write_and_magic_commands_-_Streamlit_Docs.txt
st.write and magic commands - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic remove st.write st.write_stream magic Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Write and magic st.write and magic commands Streamlit has two easy ways to display information into your app, which should typically be the first thing you try: st.write and magic. st.write Write arguments to the app. st.write("Hello **world**!") st.write(my_data_frame) st.write(my_mpl_figure) st.write_stream Write generators or streams to the app with a typewriter effect. st.write_stream(my_generator) st.write_stream(my_llm_stream) Magic Any time Streamlit sees either a variable or literal value on its own line, it automatically writes that to your app using st.write "Hello **world**!" my_data_frame my_mpl_figure Previous: API reference Next: st.write forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.map_-_Streamlit_Docs.txt
st.map - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements remove SIMPLE st.area_chart st.bar_chart st.line_chart st.map st.scatter_chart ADVANCED st.altair_chart st.bokeh_chart st.graphviz_chart st.plotly_chart st.pydeck_chart st.pyplot st.vega_lite_chart Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Chart elements / st.map st.map Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a map with a scatterplot overlaid onto it. This is a wrapper around st.pydeck_chart to quickly create scatterplot charts on top of a map, with auto-centering and auto-zoom. When using this command, Mapbox provides the map tiles to render map content. Note that Mapbox is a third-party product and Streamlit accepts no responsibility or liability of any kind for Mapbox or for any content or information made available by Mapbox. Mapbox requires users to register and provide a token before users can request map tiles. Currently, Streamlit provides this token for you, but this could change at any time. We strongly recommend all users create and use their own personal Mapbox token to avoid any disruptions to their experience. You can do this with the mapbox.token config option. The use of Mapbox is governed by Mapbox's Terms of Use. To get a token for yourself, create an account at https://mapbox.com . For more info on how to set config options, see https://docs.streamlit.io/develop/api-reference/configuration/config.toml . Function signature [source] st.map(data=None, *, latitude=None, longitude=None, color=None, size=None, zoom=None, use_container_width=True, width=None, height=None) Parameters data (Anything supported by st.dataframe) The data to be plotted. latitude (str or None) The name of the column containing the latitude coordinates of the datapoints in the chart. If None, the latitude data will come from any column named 'lat', 'latitude', 'LAT', or 'LATITUDE'. longitude (str or None) The name of the column containing the longitude coordinates of the datapoints in the chart. If None, the longitude data will come from any column named 'lon', 'longitude', 'LON', or 'LONGITUDE'. color (str or tuple or None) The color of the circles representing each datapoint. Can be: None, to use the default color. A hex string like "#ffaa00" or "#ffaa0088". An RGB or RGBA tuple with the red, green, blue, and alpha components specified as ints from 0 to 255 or floats from 0.0 to 1.0. The name of the column to use for the color. Cells in this column should contain colors represented as a hex string or color tuple, as described above. size (str or float or None) The size of the circles representing each point, in meters. This can be: None, to use the default size. A number like 100, to specify a single size to use for all datapoints. The name of the column to use for the size. This allows each datapoint to be represented by a circle of a different size. zoom (int) Zoom level as specified in https://wiki.openstreetmap.org/wiki/Zoom_levels . use_container_width (bool) Whether to override the map's native width with the width of the parent container. If use_container_width is True (default), Streamlit sets the width of the map to match the width of the parent container. If use_container_width is False , Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. width (int or None) Desired width of the chart expressed in pixels. If width is None (default), Streamlit sets the width of the chart to fit its contents according to the plotting library, up to the width of the parent container. If width is greater than the width of the parent container, Streamlit sets the chart width to match the width of the parent container. To use width , you must set use_container_width=False . height (int or None) Desired height of the chart expressed in pixels. If height is None (default), Streamlit sets the height of the chart to fit its contents according to the plotting library. Examples import streamlit as st import pandas as pd import numpy as np df = pd.DataFrame( np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4], columns=["lat", "lon"], ) st.map(df) Built with Streamlit 🎈 Fullscreen open_in_new You can also customize the size and color of the datapoints: st.map(df, size=20, color="#0044ff") And finally, you can choose different columns to use for the latitude and longitude components, as well as set size and color of each datapoint dynamically based on other columns: import streamlit as st import pandas as pd import numpy as np df = pd.DataFrame( { "col1": np.random.randn(1000) / 50 + 37.76, "col2": np.random.randn(1000) / 50 + -122.4, "col3": np.random.randn(1000) * 100, "col4": np.random.rand(1000, 4).tolist(), } ) st.map(df, latitude="col1", longitude="col2", size="col3", color="col4") Built with Streamlit 🎈 Fullscreen open_in_new element.add_rows Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Concatenate a dataframe to the bottom of the current one. Function signature [source] element.add_rows(data=None, **kwargs) Parameters data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None) Table to concat. Optional. **kwargs (pandas.DataFrame, numpy.ndarray, Iterable, dict, or None) The named dataset to concat. Optional. You can only pass in 1 dataset (including the one in the data parameter). Example import streamlit as st import pandas as pd import numpy as np df1 = pd.DataFrame( np.random.randn(50, 20), columns=("col %d" % i for i in range(20)) ) my_table = st.table(df1) df2 = pd.DataFrame( np.random.randn(50, 20), columns=("col %d" % i for i in range(20)) ) my_table.add_rows(df2) # Now the table shown in the Streamlit app contains the data for # df1 followed by the data for df2. You can do the same thing with plots. For example, if you want to add more data to a line chart: # Assuming df1 and df2 from the example above still exist... my_chart = st.line_chart(df1) my_chart.add_rows(df2) # Now the chart shown in the Streamlit app contains the data for # df1 followed by the data for df2. And for plots whose datasets are named, you can pass the data with a keyword argument where the key is the name: my_chart = st.vega_lite_chart( { "mark": "line", "encoding": {"x": "a", "y": "b"}, "datasets": { "some_fancy_name": df1, # <-- named dataset }, "data": {"name": "some_fancy_name"}, } ) my_chart.add_rows(some_fancy_name=df2) # <-- name used as keyword Previous: st.line_chart Next: st.scatter_chart forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.switch_page_-_Streamlit_Docs.txt
st.switch_page - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages remove st.navigation st.Page st.page_link link st.switch_page Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Navigation and pages / st.switch_page st.switch_page Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Programmatically switch the current page in a multipage app. When st.switch_page is called, the current page execution stops and the specified page runs as if the user clicked on it in the sidebar navigation. The specified page must be recognized by Streamlit's multipage architecture (your main Python file or a Python file in a pages/ folder). Arbitrary Python scripts cannot be passed to st.switch_page . Function signature [source] st.switch_page(page) Parameters page (str, Path, or st.Page) The file path (relative to the main script) or an st.Page indicating the page to switch to. Example Consider the following example given this file structure: your-repository/ ├── pages/ │ ├── page_1.py │ └── page_2.py └── your_app.py import streamlit as st if st.button("Home"): st.switch_page("your_app.py") if st.button("Page 1"): st.switch_page("pages/page_1.py") if st.button("Page 2"): st.switch_page("pages/page_2.py") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.page_link Next: Execution flow forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.tabs_-_Streamlit_Docs.txt
st.tabs - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers remove st.columns st.container st.dialog link st.empty st.expander st.form link st.popover st.sidebar st.tabs Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Layouts and containers / st.tabs st.tabs Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Insert containers separated into tabs. Inserts a number of multi-element containers as tabs. Tabs are a navigational element that allows users to easily move between groups of related content. To add elements to the returned containers, you can use the with notation (preferred) or just call methods directly on the returned object. See examples below. Warning All the content of every tab is always sent to and rendered on the frontend. Conditional rendering is currently not supported. Function signature [source] st.tabs(tabs) Parameters tabs (list of str) Creates a tab for each string in the list. The first tab is selected by default. The string is used as the name of the tab and can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. Returns (list of containers) A list of container objects. Examples You can use the with notation to insert any element into a tab: import streamlit as st tab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"]) with tab1: st.header("A cat") st.image("https://static.streamlit.io/examples/cat.jpg", width=200) with tab2: st.header("A dog") st.image("https://static.streamlit.io/examples/dog.jpg", width=200) with tab3: st.header("An owl") st.image("https://static.streamlit.io/examples/owl.jpg", width=200) Built with Streamlit 🎈 Fullscreen open_in_new Or you can just call methods directly on the returned objects: import streamlit as st import numpy as np tab1, tab2 = st.tabs(["📈 Chart", "🗃 Data"]) data = np.random.randn(10, 1) tab1.subheader("A tab with a chart") tab1.line_chart(data) tab2.subheader("A tab with the data") tab2.write(data) Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.sidebar Next: Chat elements forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Pre-release_features_-_Streamlit_Docs.txt
Pre-release features - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference remove Cheat sheet Release notes add Pre-release features Roadmap open_in_new web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Quick reference / Pre release features Pre-release features At Streamlit, we like to move quick while keeping things stable. In our latest effort to move even faster without sacrificing stability, we're offering our bold and fearless users two ways to try out Streamlit's bleeding-edge features: Experimental features Nightly releases Experimental Features Less stable Streamlit features have one naming convention: st.experimental_ . This distinction is a prefix we attach to our command names to make sure their status is clear to everyone. Here's a quick rundown of what you get from each naming convention: st : this is where our core features like st.write and st.dataframe live. If we ever make backward-incompatible changes to these, they will take place gradually and with months of announcements and warnings. experimental : this is where we'll put all new features that may or may not ever make it into Streamlit core. This gives you a chance to try the next big thing we're cooking up weeks or months before we're ready to stabilize its API. We don't know whether these features have a future, but we want you to have access to everything we're trying, and work with us to figure them out. Features with the experimental_ naming convention are things that we're still working on or trying to understand. If these features are successful, at some point they'll become part of Streamlit core. If unsuccessful, these features are removed without much notice. While in experimental, a feature's API and behaviors may not be stable, and it's possible they could change in ways that aren't backward-compatible. priority_high Warning Experimental features and their APIs may change or be removed at any time. The lifecycle of an experimental feature A feature is added with the experimental_ prefix. The feature is potentially tweaked over time, with possible API/behavior breakages. If successful, we promote the feature to Streamlit core and remove it from experimental_ : a. The feature's API stabilizes and the feature is cloned without the experimental_ prefix, so it exists as both st and experimental_ . At this point, users will see a warning when using the version of the feature with the experimental_ prefix -- but the feature will still work. b. At some point, the code of the experimental_ -prefixed feature is removed , but there will still be a stub of the function prefixed with experimental_ that shows an error with appropriate instructions. c. Finally, at a later date the experimental_ version is removed. If unsuccessful, the feature is removed without much notice and we leave a stub in experimental_ that shows an error with instructions. Nightly releases In addition to experimental features, we offer another way to try out Streamlit's newest features: nightly releases. At the end of each day (at night 🌛), our bots run automated tests against the latest Streamlit code and, if everything looks good, it publishes them as the streamlit-nightly package. This means the nightly build includes all our latest features, bug fixes, and other enhancements on the same day they land on our codebase. How does this differ from official releases? Official Streamlit releases go not only through both automated tests but also rigorous manual testing, while nightly releases only have automated tests. It's important to keep in mind that new features introduced in nightly releases often lack polish. In our official releases, we always make double-sure all new features are ready for prime time. How do I use the nightly release? All you need to do is install the streamlit-nightly package: pip uninstall streamlit pip install streamlit-nightly --upgrade priority_high Warning You should never have both streamlit and streamlit-nightly installed in the same environment! Why should I use the nightly release? Because you can't wait for official releases, and you want to help us find bugs early! Why shouldn't I use the nightly release? While our automated tests have high coverage, there's still a significant likelihood that there will be some bugs in the nightly code. Can I choose which nightly release I want to install? If you'd like to use a specific version, you can find the version number in our Release history . Specify the desired version using pip as usual: pip install streamlit-nightly==x.yy.zz-123456 . Can I compare changes between releases? If you'd like to review the changes for a nightly release, you can use the comparison tool on GitHub . Previous: Release notes Next: Roadmap forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.table_-_Streamlit_Docs.txt
st.table - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements remove st.dataframe st.data_editor st.column_config add st.table st.metric st.json Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Data elements / st.table star Tip Static tables with st.table are the most basic way to display dataframes. For the majority of cases, we recommend using st.dataframe to display interactive dataframes, and st.data_editor to let users edit dataframes. st.table Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display a static table. This differs from st.dataframe in that the table in this case is static: its entire contents are laid out directly on the page. Function signature [source] st.table(data=None) Parameters data (Anything supported by st.dataframe) The table data. Example import streamlit as st import pandas as pd import numpy as np df = pd.DataFrame( np.random.randn(10, 5), columns=("col %d" % i for i in range(5)) ) st.table(df) Built with Streamlit 🎈 Fullscreen open_in_new element.add_rows Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Concatenate a dataframe to the bottom of the current one. Function signature [source] element.add_rows(data=None, **kwargs) Parameters data (pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None) Table to concat. Optional. **kwargs (pandas.DataFrame, numpy.ndarray, Iterable, dict, or None) The named dataset to concat. Optional. You can only pass in 1 dataset (including the one in the data parameter). Example import streamlit as st import pandas as pd import numpy as np df1 = pd.DataFrame( np.random.randn(50, 20), columns=("col %d" % i for i in range(20)) ) my_table = st.table(df1) df2 = pd.DataFrame( np.random.randn(50, 20), columns=("col %d" % i for i in range(20)) ) my_table.add_rows(df2) # Now the table shown in the Streamlit app contains the data for # df1 followed by the data for df2. You can do the same thing with plots. For example, if you want to add more data to a line chart: # Assuming df1 and df2 from the example above still exist... my_chart = st.line_chart(df1) my_chart.add_rows(df2) # Now the chart shown in the Streamlit app contains the data for # df1 followed by the data for df2. And for plots whose datasets are named, you can pass the data with a keyword argument where the key is the name: my_chart = st.vega_lite_chart( { "mark": "line", "encoding": {"x": "a", "y": "b"}, "datasets": { "some_fancy_name": df1, # <-- named dataset }, "data": {"name": "some_fancy_name"}, } ) my_chart.add_rows(some_fancy_name=df2) # <-- name used as keyword Previous: st.column_config Next: st.metric forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Get_started_with_Streamlit_-_Streamlit_Docs.txt
Get started with Streamlit - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Get started Get started with Streamlit This Get Started guide explains how Streamlit works, how to install Streamlit on your preferred operating system, and how to create your first Streamlit app! downloading Installation helps you set up your development environment. Walk through installing Streamlit on Windows, macOS, or Linux. Alternatively, code right in your browser with GitHub Codespaces or Streamlit in Snowflake. description Fundamentals introduces you to Streamlit's data model and development flow. You'll learn what makes Streamlit the most powerful way to build data apps, including the ability to display and style data, draw charts and maps, add interactive widgets, customize app layouts, cache computation, and define themes. auto_awesome First steps walks you through creating apps using core features to fetch and cache data, draw charts, plot information on a map, and use interactive widgets to filter results. rocket_launch Use GitHub Codespaces if you want to skip past local installation and code right in your browser. This guide uses Streamlit Community Cloud to help you automatically configure a codespace. 30 Days of Streamlit 🎈 30 Days of Streamlit 🎈 is a free, self-paced 30 day challenge that teaches you how to build and deploy data apps with Streamlit. Complete the daily challenges, share your solutions with us on Twitter and LinkedIn, and stop by the forum with any questions! Start the challenge Next: Installation forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.expander_-_Streamlit_Docs.txt
st.expander - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers remove st.columns st.container st.dialog link st.empty st.expander st.form link st.popover st.sidebar st.tabs Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Layouts and containers / st.expander st.expander Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Insert a multi-element container that can be expanded/collapsed. Inserts a container into your app that can be used to hold multiple elements and can be expanded or collapsed by the user. When collapsed, all that is visible is the provided label. To add elements to the returned container, you can use the with notation (preferred) or just call methods directly on the returned object. See examples below. Warning Currently, you may not put expanders inside another expander. Function signature [source] st.expander(label, expanded=False, *, icon=None) Parameters label (str) A string to use as the header for the expander. The label can optionally contain GitHub-flavored Markdown of the following types: Bold, Italics, Strikethroughs, Inline Code, Links, and Images. Images display like icons, with a max height equal to the font height. Unsupported Markdown elements are unwrapped so only their children (text contents) render. Display unsupported elements as literal characters by backslash-escaping them. E.g., "1\. Not an ordered list" . See the body parameter of st.markdown for additional, supported Markdown directives. expanded (bool) If True, initializes the expander in "expanded" state. Defaults to False (collapsed). icon (str, None) An optional emoji or icon to display next to the expander label. If icon is None (default), no icon is displayed. If icon is a string, the following options are valid: A single-character emoji. For example, you can set icon="🚨" or icon="🔥" . Emoji short codes are not supported. An icon from the Material Symbols library (rounded style) in the format ":material/icon_name:" where "icon_name" is the name of the icon in snake case. For example, icon=":material/thumb_up:" will display the Thumb Up icon. Find additional icons in the Material Symbols font library. Examples You can use the with notation to insert any element into an expander import streamlit as st st.bar_chart({"data": [1, 5, 2, 6, 2, 1]}) with st.expander("See explanation"): st.write(''' The chart above shows some numbers I picked for you. I rolled actual dice for these, so they're *guaranteed* to be random. ''') st.image("https://static.streamlit.io/examples/dice.jpg") Built with Streamlit 🎈 Fullscreen open_in_new Or you can just call methods directly on the returned objects: import streamlit as st st.bar_chart({"data": [1, 5, 2, 6, 2, 1]}) expander = st.expander("See explanation") expander.write(''' The chart above shows some numbers I picked for you. I rolled actual dice for these, so they're *guaranteed* to be random. ''') expander.image("https://static.streamlit.io/examples/dice.jpg") Built with Streamlit 🎈 Fullscreen open_in_new Previous: st.empty Next: st.form forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st_experimental_get_query_params___Streamlit_Docs_.txt
st.experimental_get_query_params - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state remove st.cache_data st.cache_resource st.session_state st.query_params st.experimental_get_query_params delete st.experimental_set_query_params delete Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Caching and state / st.experimental_get_query_params st.experimental_get_query_params Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake delete Deprecation notice st.experimental_get_query_params was deprecated in version 1.30.0. Use st.query_params instead. Return the query parameters that is currently showing in the browser's URL bar. Function signature [source] st.experimental_get_query_params() Returns (dict) The current query parameters as a dict. "Query parameters" are the part of the URL that comes after the first "?". Example Let's say the user's web browser is at http://localhost:8501/?show_map=True&selected=asia&selected=america . Then, you can get the query parameters using the following: import streamlit as st st.experimental_get_query_params() {"show_map": ["True"], "selected": ["asia", "america"]} Note that the values in the returned dict are always lists. This is because we internally use Python's urllib.parse.parse_qs(), which behaves this way. And this behavior makes sense when you consider that every item in a query string is potentially a 1-element array. Previous: st.query_params Next: st.experimental_set_query_params forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Command-line_options_-_Streamlit_Docs.txt
Command-line options - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line remove streamlit run Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Command line Command-line interface When you install Streamlit, a command-line (CLI) tool gets installed as well. The purpose of this tool is to run Streamlit apps, change Streamlit configuration options, and help you diagnose and fix issues. To see all of the supported commands: streamlit --help Run Streamlit apps streamlit run your_script.py [-- script args] Runs your app. At any time you can stop the server with Ctrl+c . push_pin Note When passing your script some custom arguments, they must be passed after two dashes . Otherwise the arguments get interpreted as arguments to Streamlit itself. To see the Streamlit 'Hello, World!' example app, run streamlit hello . View Streamlit version To see what version of Streamlit is installed, just type: streamlit version View documentation streamlit docs Opens the Streamlit documentation (i.e. this website) in a web browser. Clear cache streamlit cache clear Clears persisted files from the on-disk Streamlit cache , if present. View all configuration options As described in Configuration , Streamlit has several configuration options. To view them all, including their current values, just type: streamlit config show Previous: App testing Next: streamlit run forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
App_dependencies_for_your_Community_Cloud_app___St.txt
App dependencies for your Community Cloud app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud remove Get started add Deploy your app remove File organization App dependencies Secrets management Deploy! Manage your app add Share your app add Manage your account add Status and limitations Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Deploy / Streamlit Community Cloud / Deploy your app / App dependencies App dependencies for your Community Cloud app The main reason that apps fail to build properly is because Streamlit Community Cloud can't find your dependencies! There are two kinds of dependencies your app might have: Python dependencies and external dependencies. Python dependencies are other Python packages (just like Streamlit!) that you import into your script. External dependencies are less common, but they include any other software your script needs to function properly. Because Community Cloud runs on Linux, these will be Linux dependencies installed with apt-get outside the Python environment. For your dependencies to be installed correctly, make sure you: Add a requirements file for Python dependencies. Optional: To manage any external dependencies, add a packages.txt file. push_pin Note Python requirements files should be placed either in the root of your repository or in the same directory as your app's entrypoint file. Add Python dependencies With each import statement in your script, you are bringing in a Python dependency. You need to tell Community Cloud how to install those dependencies through a Python package manager. We recommend using a requirements.txt file, which is based on pip . You should not include built-in Python libraries like math , random , or distutils in your requirements.txt file. These are a part of Python and aren't installed separately. Also, Community Cloud has streamlit installed by default. You don't strictly need to include streamlit unless you want to pin or restrict the version. If you deploy an app without a requirements.txt file, your app will run in an environment with just streamlit (and its dependencies) installed. priority_high Important The version of Python you use is important! Built-in libraries change between versions of Python and other libraries may have specific version requirements, too. Whenever Streamlit supports a new version of Python, Community Cloud quickly follows to default to that new version of Python. Always develop your app in the same version of Python you will use to deploy it. For more information about setting the version of Python when you deploy your app, see Optional: Configure secrets and Python version . If you have a script like the following, no extra dependencies would be needed since pandas and numpy are installed as direct dependencies of streamlit . Similarly, math and random are built into Python. import streamlit as st import pandas as pd import numpy as np import math import random st.write("Hi!") However, a valid requirements.txt file would be: streamlit pandas numpy Alternatively, if you needed to specify certain versions, another valid example would be: streamlit==1.24.1 pandas>2.0 numpy<=1.25.1 In the above example, streamlit is pinned to version 1.24.1 , pandas must be strictly greater than version 2.0, and numpy must be at-or-below version 1.25.1. Each line in your requirements.txt file is effectively what you would like to pip install into your cloud environment. star Tip To learn about limitations of Community Cloud's Python environments, see Community Cloud status and limitations . Other Python package managers There are other Python package managers in addition to pip . If you want to consider alternatives to using a requirements.txt file, Community Cloud will use the first dependency file it finds. Community Cloud will search the directory where your entrypoint file is, then it will search the root of your repository. In each location, dependency files are prioritized in the following order: Recognized Filename Python Package Manager uv.lock uv Pipfile pipenv environment.yml conda requirements.txt pip † pyproject.toml poetry † For efficiency, Community Cloud will attempt to process requirements.txt with uv , but will fall back to pip if needed. uv is generally faster and more efficient than pip . priority_high Warning You should only use one dependency file for your app. If you include more than one (e.g. requirements.txt and environment.yaml ), only the first file encountered will be used as described above, with any dependency file in your entrypoint file's directory taking precedence over any dependency file in the root of your repository. apt-get dependencies For many apps, a packages.txt file is not required. However, if your script requires any software to be installed that is not a Python package, you need a packages.txt file. Community Cloud is built on Debian Linux. Anything you want to apt-get install must go in your packages.txt file. To browse available packages that can be installed, see the Debian 11 ("bullseye") package list . If packages.txt exists in the root directory of your repository we automatically detect it, parse it, and install the listed packages. You can read more about apt-get in Linux documentation . Add apt-get dependencies to packages.txt — one package name per line. For example, mysqlclient is a Python package which requires additional software be installed to function. A valid packages.txt file to enable mysqlclient would be: build-essential pkg-config default-libmysqlclient-dev Previous: File organization Next: Secrets management forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Get_dataframe_row_selections_from_users___Streamli.txt
Get dataframe row-selections from users - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements remove CHARTS Annotate an Altair chart DATAFRAMES Get dataframe row-selections Execution flow add Connect to data sources add Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Elements / Get dataframe row selections Get dataframe row-selections from users Streamlit offers two commands for rendering beautiful, interactive dataframes in your app. If you need users to edit data, add rows, or delete rows, use st.data_editor . If you don't want users to change the data in your dataframe, use st.dataframe . Users can sort and search through data rendered with st.dataframe . Additionally, you can activate selections to work with users' row and column selections. This tutorial uses row selections, which were introduced in Streamlit version 1.35.0. For an older workaround using st.data_editor , see Get dataframe row-selections ( streamlit<1.35.0 ) . Applied concepts Use dataframe row selections to filter a dataframe. Prerequisites The following must be installed in your Python environment: streamlit>=1.35.0 You should have a clean working directory called your-repository . You should have a basic understanding of caching and st.dataframe . Summary In this example, you'll build an app that displays a table of members and their activity for an imaginary organization. Within the table, a user can select one or more rows to create a filtered view. Your app will show a combined chart that compares the selected employees. Here's a look at what you'll build: Complete code expand_more import numpy as np import pandas as pd import streamlit as st from faker import Faker @st.cache_data def get_profile_dataset(number_of_items: int = 20, seed: int = 0) -> pd.DataFrame: new_data = [] fake = Faker() np.random.seed(seed) Faker.seed(seed) for i in range(number_of_items): profile = fake.profile() new_data.append( { "name": profile["name"], "daily_activity": np.random.rand(25), "activity": np.random.randint(2, 90, size=12), } ) profile_df = pd.DataFrame(new_data) return profile_df column_configuration = { "name": st.column_config.TextColumn( "Name", help="The name of the user", max_chars=100, width="medium" ), "activity": st.column_config.LineChartColumn( "Activity (1 year)", help="The user's activity over the last 1 year", width="large", y_min=0, y_max=100, ), "daily_activity": st.column_config.BarChartColumn( "Activity (daily)", help="The user's activity in the last 25 days", width="medium", y_min=0, y_max=1, ), } select, compare = st.tabs(["Select members", "Compare selected"]) with select: st.header("All members") df = get_profile_dataset() event = st.dataframe( df, column_config=column_configuration, use_container_width=True, hide_index=True, on_select="rerun", selection_mode="multi-row", ) st.header("Selected members") people = event.selection.rows filtered_df = df.iloc[people] st.dataframe( filtered_df, column_config=column_configuration, use_container_width=True, ) with compare: activity_df = {} for person in people: activity_df[df.iloc[person]["name"]] = df.iloc[person]["activity"] activity_df = pd.DataFrame(activity_df) daily_activity_df = {} for person in people: daily_activity_df[df.iloc[person]["name"]] = df.iloc[person]["daily_activity"] daily_activity_df = pd.DataFrame(daily_activity_df) if len(people) > 0: st.header("Daily activity comparison") st.bar_chart(daily_activity_df) st.header("Yearly activity comparison") st.line_chart(activity_df) else: st.markdown("No members selected.") Built with Streamlit 🎈 Fullscreen open_in_new Build the example Initialize your app In your_repository , create a file named app.py . In a terminal, change directories to your_repository and start your app. streamlit run app.py Your app will be blank since you still need to add code. In app.py , write the following: import numpy as np import pandas as pd import streamlit as st from faker import Faker You'll be using these libraries as follows: You'll generate random member names with faker . You'll generate random activity data with numpy . You'll manipulate the data with pandas . Save your app.py file and view your running app. Click " Always rerun " or hit your " A " key in your running app. Your running preview will automatically update as you save changes to app.py . Your preview will still be blank. Return to your code. Build a function to create random member data To begin with, you'll define a function to randomly generate some member data. It's okay to skip this section if you just want to copy the function. Complete function to randomly generate member data expand_more @st.cache_data def get_profile_dataset(number_of_items: int = 20, seed: int = 0) -> pd.DataFrame: new_data = [] fake = Faker() np.random.seed(seed) Faker.seed(seed) for i in range(number_of_items): profile = fake.profile() new_data.append( { "name": profile["name"], "daily_activity": np.random.rand(25), "activity": np.random.randint(2, 90, size=12), } ) profile_df = pd.DataFrame(new_data) return profile_df Use an @st.cache_data decorator and start your function definition. @st.cache_data def get_profile_dataset(number_of_items: int = 20, seed: int = 0) -> pd.DataFrame: The @st.cache_data decorator turns get_profile_dataset() into a cached function. Streamlit saves the output of a cached function to reuse when the cached function is called again with the same inputs. This keeps your app performant when rerunning as part of Streamlit's execution model. For more information, see Caching . The get_profile_dataset function has two parameters to configure the size of the data set and the seed for random generation. This example will use the default values (20 members in the set with a seed of 0). The function will return a pandas.DataFrame . Initialize an empty list to store data. new_data = [] Initialize the random generators. fake = Faker() random.seed(seed) Faker.seed(seed) Iterate through a range to generate new member data as a dictionary and append it to your list. for i in range(number_of_items): profile = fake.profile() new_data.append( { "name": profile["name"], "daily_activity": np.random.rand(25), "activity": np.random.randint(2, 90, size=12), } ) For daily_activity , you're generating an array of length 25. These values are floats in the interval [0,1) . For activity , you're generating an array of length 12. These values are integers in the interval [2,90) . Convert your list of dictionaries to a single pandas.DataFrame and return it. profile_df = pd.DataFrame(new_data) return profile_df Optional: Test out your function by calling it and displaying the data. st.dataframe(get_profile_dataset()) Save your app.py file to see the preview. Delete this line before you continue. Display your data with multi-row selections enabled Define your column configuration to format your data. column_configuration = { "name": st.column_config.TextColumn( "Name", help="The name of the user", max_chars=100, width="medium" ), "activity": st.column_config.LineChartColumn( "Activity (1 year)", help="The user's activity over the last 1 year", width="large", y_min=0, y_max=100, ), "daily_activity": st.column_config.BarChartColumn( "Activity (daily)", help="The user's activity in the last 25 days", width="medium", y_min=0, y_max=1, ), } For each column of your dataframe, this defines nicely formatted column name, tooltip, and column width. You'll use a line chart to show yearly activity, and a bar chart to show daily activity. Insert a header to identify the data you will display. st.header("All members") Store your data in a convenient variable. df = get_profile_dataset() Display your dataframe with selections activated. event = st.dataframe( df, column_config=column_configuration, use_container_width=True, hide_index=True, on_select="rerun", selection_mode="multi-row", ) By setting on_selection="rerun" , you've activated selections for the dataframe. selection_mode="multi_row" specifies the type of selections allowed (multiple rows, no columns). event stores the selection data from the user. Selections can be accessed from the event.selection attribute. Display the selected data Insert a header to identify the subset of data you will display. st.header("Selected members") Get the list of selected rows and filter your dataframe. people = event.selection.rows filtered_df = df.iloc[people] Row selections are returned by positional index. You should use pandas methods .iloc[] or .iat[] to retrieve rows. Display the selected rows in a new dataframe. st.dataframe( filtered_df, column_config=column_configuration, use_container_width=True, ) For consistency, reuse the existing column configuration. Optional: Save your file and test it out. Try selecting some rows in your app, and then return to your code. Combine activity data for the selected rows Create an empty dictionary to store (yearly) activity data. activity_df = {} Iterate through selected rows and save each member's activity in the dictionary indexed by their name. for person in people: activity_df[df.iloc[person]["name"]] = df.iloc[person]["activity"] Convert the activity dictionary into a pandas.DataFrame . activity_df = pd.DataFrame(activity_df) Repeat the previous three steps similarly for daily activity. daily_activity_df = {} for person in people: daily_activity_df[df.iloc[person]["name"]] = df.iloc[person]["daily_activity"] daily_activity_df = pd.DataFrame(daily_activity_df) Optional: Test out your combined data by displaying it. st.dataframe(activity_df) st.dataframe(daily_activity_df) Save your app.py file to see the preview. Delete these two lines before you continue. Use charts to visualize the activity comparison Start a conditional block to check if anyone is currently selected. if len(people) > 0: Since no members are selected when the app loads, this check will prevent empty charts from being displayed. Add a header to identify your first chart. st.header("Daily activity comparison") Show the daily activity comparison in a bar chart. st.bar_chart(daily_activity_df) Similarly, for yearly activity, add a header and line chart. st.header("Yearly activity comparison") st.line_chart(activity_df) Complete the conditional block with a default message to show when no members are selected. else: st.markdown("No members selected.") Make it pretty You should have a functioning app at this point. Now you can beautify it. In this section, you'll separate the selection UI from the comparison by using st.tabs . Immediately after the column configuration definition, insert two tabs. select, compare = st.tabs(["Select members", "Compare selected"]) Indent the code following the line in the previous step and group it into the two new tabs. with select: # Add select tab ############################################# st.header("All members") df = get_profile_dataset() event = st.dataframe( df, column_config=column_configuration, use_container_width=True, hide_index=True, on_select="rerun", selection_mode="multi-row", ) st.header("Selected members") people = event.selection.rows filtered_df = df.iloc[people] st.dataframe( filtered_df, column_config=column_configuration, use_container_width=True, ) with compare: # Add compare tab ########################################### activity_df = {} for person in people: activity_df[df.iloc[person]["name"]] = df.iloc[person]["activity"] activity_df = pd.DataFrame(activity_df) daily_activity_df = {} for person in people: daily_activity_df[df.iloc[person]["name"]] = df.iloc[person]["daily_activity"] daily_activity_df = pd.DataFrame(daily_activity_df) if len(people) > 0: st.header("Daily activity comparison") st.bar_chart(daily_activity_df) st.header("Yearly activity comparison") st.line_chart(activity_df) else: st.markdown("No members selected.") Save your file and try out your completed example. Previous: Annotate an Altair chart Next: Get dataframe row-selections (streamlit<1.35.0) forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Build_a_basic_LLM_chat_app_-_Streamlit_Docs.txt
Build a basic LLM chat app - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources add Multipage apps add Work with LLMs remove Build a basic LLM chat app Build an LLM app using LangChain Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Work with LLMs / Build a basic LLM chat app Build a basic LLM chat app Introduction The advent of large language models like GPT has revolutionized the ease of developing chat-based applications. Streamlit offers several Chat elements , enabling you to build Graphical User Interfaces (GUIs) for conversational agents or chatbots. Leveraging session state along with these elements allows you to construct anything from a basic chatbot to a more advanced, ChatGPT-like experience using purely Python code. In this tutorial, we'll start by walking through Streamlit's chat elements, st.chat_message and st.chat_input . Then we'll proceed to construct three distinct applications, each showcasing an increasing level of complexity and functionality: First, we'll Build a bot that mirrors your input to get a feel for the chat elements and how they work. We'll also introduce session state and how it can be used to store the chat history. This section will serve as a foundation for the rest of the tutorial. Next, you'll learn how to Build a simple chatbot GUI with streaming . Finally, we'll Build a ChatGPT-like app that leverages session state to remember conversational context, all within less than 50 lines of code. Here's a sneak peek of the LLM-powered chatbot GUI with streaming we'll build in this tutorial: Built with Streamlit 🎈 Fullscreen open_in_new Play around with the above demo to get a feel for what we'll build in this tutorial. A few things to note: There's a chat input at the bottom of the screen that's always visible. It contains some placeholder text. You can type in a message and press Enter or click the run button to send it. When you enter a message, it appears as a chat message in the container above. The container is scrollable, so you can scroll up to see previous messages. A default avatar is displayed to your messages' left. The assistant's responses are streamed to the frontend and are displayed with a different default avatar. Before we start building, let's take a closer look at the chat elements we'll use. Chat elements Streamlit offers several commands to help you build conversational apps. These chat elements are designed to be used in conjunction with each other, but you can also use them separately. st.chat_message lets you insert a chat message container into the app so you can display messages from the user or the app. Chat containers can contain other Streamlit elements, including charts, tables, text, and more. st.chat_input lets you display a chat input widget so the user can type in a message. For an overview of the API, check out this video tutorial by Chanin Nantasenamat ( @dataprofessor ), a Senior Developer Advocate at Streamlit. st.chat_message st.chat_message lets you insert a multi-element chat message container into your app. The returned container can contain any Streamlit element, including charts, tables, text, and more. To add elements to the returned container, you can use with notation. st.chat_message 's first parameter is the name of the message author, which can be either "user" or "assistant" to enable preset styling and avatars, like in the demo above. You can also pass in a custom string to use as the author name. Currently, the name is not shown in the UI but is only set as an accessibility label. For accessibility reasons, you should not use an empty string. Here's an minimal example of how to use st.chat_message to display a welcome message: import streamlit as st with st.chat_message("user"): st.write("Hello 👋") Notice the message is displayed with a default avatar and styling since we passed in "user" as the author name. You can also pass in "assistant" as the author name to use a different default avatar and styling, or pass in a custom name and avatar. See the API reference for more details. import streamlit as st import numpy as np with st.chat_message("assistant"): st.write("Hello human") st.bar_chart(np.random.randn(30, 3)) Built with Streamlit 🎈 Fullscreen open_in_new While we've used the preferred with notation in the above examples, you can also just call methods directly in the returned objects. The below example is equivalent to the one above: import streamlit as st import numpy as np message = st.chat_message("assistant") message.write("Hello human") message.bar_chart(np.random.randn(30, 3)) So far, we've displayed predefined messages. But what if we want to display messages based on user input? st.chat_input st.chat_input lets you display a chat input widget so the user can type in a message. The returned value is the user's input, which is None if the user hasn't sent a message yet. You can also pass in a default prompt to display in the input widget. Here's an example of how to use st.chat_input to display a chat input widget and show the user's input: import streamlit as st prompt = st.chat_input("Say something") if prompt: st.write(f"User has sent the following prompt: {prompt}") Built with Streamlit 🎈 Fullscreen open_in_new Pretty straightforward, right? Now let's combine st.chat_message and st.chat_input to build a bot the mirrors or echoes your input. Build a bot that mirrors your input In this section, we'll build a bot that mirrors or echoes your input. More specifically, the bot will respond to your input with the same message. We'll use st.chat_message to display the user's input and st.chat_input to accept user input. We'll also use session state to store the chat history so we can display it in the chat message container. First, let's think about the different components we'll need to build our bot: Two chat message containers to display messages from the user and the bot, respectively. A chat input widget so the user can type in a message. A way to store the chat history so we can display it in the chat message containers. We can use a list to store the messages, and append to it every time the user or bot sends a message. Each entry in the list will be a dictionary with the following keys: role (the author of the message), and content (the message content). import streamlit as st st.title("Echo Bot") # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] # Display chat messages from history on app rerun for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) In the above snippet, we've added a title to our app and a for loop to iterate through the chat history and display each message in the chat message container (with the author role and message content). We've also added a check to see if the messages key is in st.session_state . If it's not, we initialize it to an empty list. This is because we'll be adding messages to the list later on, and we don't want to overwrite the list every time the app reruns. Now let's accept user input with st.chat_input , display the user's message in the chat message container, and add it to the chat history. # React to user input if prompt := st.chat_input("What is up?"): # Display user message in chat message container with st.chat_message("user"): st.markdown(prompt) # Add user message to chat history st.session_state.messages.append({"role": "user", "content": prompt}) We used the := operator to assign the user's input to the prompt variable and checked if it's not None in the same line. If the user has sent a message, we display the message in the chat message container and append it to the chat history. All that's left to do is add the chatbot's responses within the if block. We'll use the same logic as before to display the bot's response (which is just the user's prompt) in the chat message container and add it to the history. response = f"Echo: {prompt}" # Display assistant response in chat message container with st.chat_message("assistant"): st.markdown(response) # Add assistant response to chat history st.session_state.messages.append({"role": "assistant", "content": response}) Putting it all together, here's the full code for our simple chatbot GUI and the result: View full code expand_more import streamlit as st st.title("Echo Bot") # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] # Display chat messages from history on app rerun for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) # React to user input if prompt := st.chat_input("What is up?"): # Display user message in chat message container st.chat_message("user").markdown(prompt) # Add user message to chat history st.session_state.messages.append({"role": "user", "content": prompt}) response = f"Echo: {prompt}" # Display assistant response in chat message container with st.chat_message("assistant"): st.markdown(response) # Add assistant response to chat history st.session_state.messages.append({"role": "assistant", "content": response}) Built with Streamlit 🎈 Fullscreen open_in_new While the above example is very simple, it's a good starting point for building more complex conversational apps. Notice how the bot responds instantly to your input. In the next section, we'll add a delay to simulate the bot "thinking" before responding. Build a simple chatbot GUI with streaming In this section, we'll build a simple chatbot GUI that responds to user input with a random message from a list of pre-determind responses. In the next section , we'll convert this simple toy example into a ChatGPT-like experience using OpenAI. Just like previously, we still require the same components to build our chatbot. Two chat message containers to display messages from the user and the bot, respectively. A chat input widget so the user can type in a message. And a way to store the chat history so we can display it in the chat message containers. Let's just copy the code from the previous section and add a few tweaks to it. import streamlit as st import random import time st.title("Simple chat") # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] # Display chat messages from history on app rerun for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) # Accept user input if prompt := st.chat_input("What is up?"): # Display user message in chat message container with st.chat_message("user"): st.markdown(prompt) # Add user message to chat history st.session_state.messages.append({"role": "user", "content": prompt}) The only difference so far is we've changed the title of our app and added imports for random and time . We'll use random to randomly select a response from a list of responses and time to add a delay to simulate the chatbot "thinking" before responding. All that's left to do is add the chatbot's responses within the if block. We'll use a list of responses and randomly select one to display. We'll also add a delay to simulate the chatbot "thinking" before responding (or stream its response). Let's make a helper function for this and insert it at the top of our app. # Streamed response emulator def response_generator(): response = random.choice( [ "Hello there! How can I assist you today?", "Hi, human! Is there anything I can help you with?", "Do you need help?", ] ) for word in response.split(): yield word + " " time.sleep(0.05) Back to writing the response in our chat interface, we'll use st.write_stream to write out the streamed response with a typewriter effect. # Display assistant response in chat message container with st.chat_message("assistant"): response = st.write_stream(response_generator()) # Add assistant response to chat history st.session_state.messages.append({"role": "assistant", "content": response}) Above, we've added a placeholder to display the chatbot's response. We've also added a for loop to iterate through the response and display it one word at a time. We've added a delay of 0.05 seconds between each word to simulate the chatbot "thinking" before responding. Finally, we append the chatbot's response to the chat history. As you've probably guessed, this is a naive implementation of streaming. We'll see how to implement streaming with OpenAI in the next section . Putting it all together, here's the full code for our simple chatbot GUI and the result: View full code expand_more import streamlit as st import random import time # Streamed response emulator def response_generator(): response = random.choice( [ "Hello there! How can I assist you today?", "Hi, human! Is there anything I can help you with?", "Do you need help?", ] ) for word in response.split(): yield word + " " time.sleep(0.05) st.title("Simple chat") # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] # Display chat messages from history on app rerun for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) # Accept user input if prompt := st.chat_input("What is up?"): # Add user message to chat history st.session_state.messages.append({"role": "user", "content": prompt}) # Display user message in chat message container with st.chat_message("user"): st.markdown(prompt) # Display assistant response in chat message container with st.chat_message("assistant"): response = st.write_stream(response_generator()) # Add assistant response to chat history st.session_state.messages.append({"role": "assistant", "content": response}) Built with Streamlit 🎈 Fullscreen open_in_new Play around with the above demo to get a feel for what we've built. It's a very simple chatbot GUI, but it has all the components of a more sophisticated chatbot. In the next section, we'll see how to build a ChatGPT-like app using OpenAI. Build a ChatGPT-like app Now that you've understood the basics of Streamlit's chat elements, let's make a few tweaks to it to build our own ChatGPT-like app. You'll need to install the OpenAI Python library and get an API key to follow along. Install dependencies First let's install the dependencies we'll need for this section: pip install openai streamlit Add OpenAI API key to Streamlit secrets Next, let's add our OpenAI API key to Streamlit secrets . We do this by creating .streamlit/secrets.toml file in our project directory and adding the following lines to it: # .streamlit/secrets.toml OPENAI_API_KEY = "YOUR_API_KEY" Write the app Now let's write the app. We'll use the same code as before, but we'll replace the list of responses with a call to the OpenAI API. We'll also add a few more tweaks to make the app more ChatGPT-like. import streamlit as st from openai import OpenAI st.title("ChatGPT-like clone") # Set OpenAI API key from Streamlit secrets client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"]) # Set a default model if "openai_model" not in st.session_state: st.session_state["openai_model"] = "gpt-3.5-turbo" # Initialize chat history if "messages" not in st.session_state: st.session_state.messages = [] # Display chat messages from history on app rerun for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) # Accept user input if prompt := st.chat_input("What is up?"): # Add user message to chat history st.session_state.messages.append({"role": "user", "content": prompt}) # Display user message in chat message container with st.chat_message("user"): st.markdown(prompt) All that's changed is that we've added a default model to st.session_state and set our OpenAI API key from Streamlit secrets. Here's where it gets interesting. We can replace our emulated stream with the model's responses from OpenAI: # Display assistant response in chat message container with st.chat_message("assistant"): stream = client.chat.completions.create( model=st.session_state["openai_model"], messages=[ {"role": m["role"], "content": m["content"]} for m in st.session_state.messages ], stream=True, ) response = st.write_stream(stream) st.session_state.messages.append({"role": "assistant", "content": response}) Above, we've replaced the list of responses with a call to OpenAI().chat.completions.create . We've set stream=True to stream the responses to the frontend. In the API call, we pass the model name we hardcoded in session state and pass the chat history as a list of messages. We also pass the role and content of each message in the chat history. Finally, OpenAI returns a stream of responses (split into chunks of tokens), which we iterate through and display each chunk. Putting it all together, here's the full code for our ChatGPT-like app and the result: View full code expand_more from openai import OpenAI import streamlit as st st.title("ChatGPT-like clone") client = OpenAI(api_key=st.secrets["OPENAI_API_KEY"]) if "openai_model" not in st.session_state: st.session_state["openai_model"] = "gpt-3.5-turbo" if "messages" not in st.session_state: st.session_state.messages = [] for message in st.session_state.messages: with st.chat_message(message["role"]): st.markdown(message["content"]) if prompt := st.chat_input("What is up?"): st.session_state.messages.append({"role": "user", "content": prompt}) with st.chat_message("user"): st.markdown(prompt) with st.chat_message("assistant"): stream = client.chat.completions.create( model=st.session_state["openai_model"], messages=[ {"role": m["role"], "content": m["content"]} for m in st.session_state.messages ], stream=True, ) response = st.write_stream(stream) st.session_state.messages.append({"role": "assistant", "content": response}) Built with Streamlit 🎈 Fullscreen open_in_new Congratulations! You've built your own ChatGPT-like app in less than 50 lines of code. We're very excited to see what you'll build with Streamlit's chat elements. Experiment with different models and tweak the code to build your own conversational apps. If you build something cool, let us know on the Forum or check out some other Generative AI apps for inspiration. 🎈 Previous: Work with LLMs Next: Build an LLM app using LangChain forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.latex_-_Streamlit_Docs.txt
st.latex - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements remove HEADINGS & BODY st.title st.header st.subheader st.markdown FORMATTED TEXT st.caption st.code st.divider st.echo st.latex st.text UTILITIES st.html link Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Text elements / st.latex st.latex Streamlit Version Version 1.41.0 Version 1.40.0 Version 1.39.0 Version 1.38.0 Version 1.37.0 Version 1.36.0 Version 1.35.0 Version 1.34.0 Version 1.33.0 Version 1.32.0 Version 1.31.0 Version 1.30.0 Version 1.29.0 Version 1.28.0 Version 1.27.0 Version 1.26.0 Version 1.25.0 Version 1.24.0 Version 1.23.0 Version 1.22.0 Version 1.21.0 Version 1.20.0 Streamlit in Snowflake Display mathematical expressions formatted as LaTeX. Supported LaTeX functions are listed at https://katex.org/docs/supported.html . Function signature [source] st.latex(body, *, help=None) Parameters body (str or SymPy expression) The string or SymPy expression to display as LaTeX. If str, it's a good idea to use raw Python strings since LaTeX uses backslashes a lot. help (str) An optional tooltip that gets displayed next to the LaTeX expression. Example import streamlit as st st.latex(r''' a + ar + a r^2 + a r^3 + \cdots + a r^{n-1} = \sum_{k=0}^{n-1} ar^k = a \left(\frac{1-r^{n}}{1-r}\right) ''') Previous: st.echo Next: st.text forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Use_core_features_to_work_with_Streamlit_s_executi.txt
Use core features to work with Streamlit's execution model - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow remove FRAGMENTS Rerun your app from a fragment Create a multiple-container fragment Start and stop a streaming fragment Connect to data sources add Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Execution flow Use core features to work with Streamlit's execution model Fragments Trigger a full-script rerun from inside a fragment Call st.rerun from inside a fragment to trigger a full-script rerun when a condition is met. Create a fragment across multiple containers Use a fragment to write to multiple containers across your app. Start and stop a streaming fragment Use a fragment to live-stream data. Use a button to start and stop the live-streaming. Previous: Elements Next: Rerun your app from a fragment forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Connect_Streamlit_to_AWS_S3_-_Streamlit_Docs.txt
Connect Streamlit to AWS S3 - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials remove Elements add Execution flow add Connect to data sources remove AWS S3 BigQuery Firestore open_in_new Google Cloud Storage Microsoft SQL Server MongoDB MySQL Neon PostgreSQL Private Google Sheet Public Google Sheet Snowflake Supabase Tableau TiDB TigerGraph Multipage apps add Work with LLMs add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / Tutorials / Connect to data sources / AWS S3 Connect Streamlit to AWS S3 Introduction This guide explains how to securely access files on AWS S3 from Streamlit Community Cloud. It uses Streamlit FilesConnection , the s3fs library and optionally Streamlit's Secrets management . Create an S3 bucket and add a file push_pin Note If you already have a bucket that you want to use, feel free to skip to the next step . First, sign up for AWS or log in. Go to the S3 console and create a new bucket: Navigate to the upload section of your new bucket: And note down the "AWS Region" for later. In this example, it's us-east-1 , but it may differ for you. Next, upload the following CSV file, which contains some example data: myfile.csv Create access keys Go to the AWS console , create access keys as shown below and copy the "Access Key ID" and "Secret Access Key": star Tip Access keys created as a root user have wide-ranging permissions. In order to make your AWS account more secure, you should consider creating an IAM account with restricted permissions and using its access keys. More information here . Set up your AWS credentials locally Streamlit FilesConnection and s3fs will read and use your existing AWS credentials and configuration if available - such as from an ~/.aws/credentials file or environment variables. If you don't already have this set up, or plan to host the app on Streamlit Community Cloud, you should specify the credentials from a file .streamlit/secrets.toml in your app's root directory or your home directory. Create this file if it doesn't exist yet and add to it the access key ID, access key secret, and the AWS default region you noted down earlier, as shown below: # .streamlit/secrets.toml AWS_ACCESS_KEY_ID = "xxx" AWS_SECRET_ACCESS_KEY = "xxx" AWS_DEFAULT_REGION = "xxx" priority_high Important Be sure to replace xxx above with the values you noted down earlier, and add this file to .gitignore so you don't commit it to your GitHub repo! Copy your app secrets to the cloud To host your app on Streamlit Community Cloud, you will need to pass your credentials to your deployed app via secrets. Go to the app dashboard and in the app's dropdown menu, click on Edit Secrets . Copy the content of secrets.toml above into the text area. More information is available at Secrets management . Add FilesConnection and s3fs to your requirements file Add the FilesConnection and s3fs packages to your requirements.txt file, preferably pinning the versions (replace x.x.x with the version you want installed): # requirements.txt s3fs==x.x.x st-files-connection Write your Streamlit app Copy the code below to your Streamlit app and run it. Make sure to adapt the name of your bucket and file. Note that Streamlit automatically turns the access keys from your secrets file into environment variables, where s3fs searches for them by default. # streamlit_app.py import streamlit as st from st_files_connection import FilesConnection # Create connection object and retrieve file contents. # Specify input format is a csv and to cache the result for 600 seconds. conn = st.connection('s3', type=FilesConnection) df = conn.read("testbucket-jrieke/myfile.csv", input_format="csv", ttl=600) # Print results. for row in df.itertuples(): st.write(f"{row.Owner} has a :{row.Pet}:") See st.connection above? This handles secrets retrieval, setup, result caching and retries. By default, read() results are cached without expiring. In this case, we set ttl=600 to ensure the file contents is cached for no longer than 10 minutes. You can also set ttl=0 to disable caching. Learn more in Caching . If everything worked out (and you used the example file given above), your app should look like this: Previous: Connect to data sources Next: BigQuery forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Text_elements_-_Streamlit_Docs.txt
Text elements - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements remove HEADINGS & BODY st.title st.header st.subheader st.markdown FORMATTED TEXT st.caption st.code st.divider st.echo st.latex st.text UTILITIES st.html link Data elements add Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Text elements Text elements Streamlit apps usually start with a call to st.title to set the app's title. After that, there are 2 heading levels you can use: st.header and st.subheader . Pure text is entered with st.text , and Markdown with st.markdown . We also offer a "swiss-army knife" command called st.write , which accepts multiple arguments, and multiple data types. And as described above, you can also use magic commands in place of st.write . Headings and body text Markdown Display string formatted as Markdown. st.markdown("Hello **world**!") Title Display text in title formatting. st.title("The app title") Header Display text in header formatting. st.header("This is a header") Subheader Display text in subheader formatting. st.subheader("This is a subheader") Formatted text Caption Display text in small font. st.caption("This is written small caption text") Code block Display a code block with optional syntax highlighting. st.code("a = 1234") Echo Display some code on the app, then execute it. Useful for tutorials. with st.echo(): st.write('This code will be printed') Preformatted text Write fixed-width and preformatted text. st.text("Hello world") LaTeX Display mathematical expressions formatted as LaTeX. st.latex("\int a x^2 \,dx") Divider Display a horizontal rule. st.divider() Third-party components These are featured components created by our lovely community. For more examples and inspiration, check out our Components Gallery and Streamlit Extras ! Previous Tags Add tags to your Streamlit apps. Created by @gagan3012 . st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') NLU Apply text mining on a dataframe. Created by @JohnSnowLabs . nlu.load('sentiment').predict('I love NLU! <3') Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) Annotated text Display annotated text in Streamlit apps. Created by @tvst . annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") Drawable Canvas Provides a sketching canvas using Fabric.js . Created by @andfanilo . st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) Tags Add tags to your Streamlit apps. Created by @gagan3012 . st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') NLU Apply text mining on a dataframe. Created by @JohnSnowLabs . nlu.load('sentiment').predict('I love NLU! <3') Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) Annotated text Display annotated text in Streamlit apps. Created by @tvst . annotated_text("This ", ("is", "verb"), " some ", ("annotated", "adj"), ("text", "noun"), " for those of ", ("you", "pronoun"), " who ", ("like", "verb"), " this sort of ", ("thing", "noun"), ".") Drawable Canvas Provides a sketching canvas using Fabric.js . Created by @andfanilo . st_canvas(fill_color="rgba(255, 165, 0, 0.3)", stroke_width=stroke_width, stroke_color=stroke_color, background_color=bg_color, background_image=Image.open(bg_image) if bg_image else None, update_streamlit=realtime_update, height=150, drawing_mode=drawing_mode, point_display_radius=point_display_radius if drawing_mode == 'point' else 0, key="canvas",) Tags Add tags to your Streamlit apps. Created by @gagan3012 . st_tags(label='# Enter Keywords:', text='Press enter to add more', value=['Zero', 'One', 'Two'], suggestions=['five', 'six', 'seven', 'eight', 'nine', 'three', 'eleven', 'ten', 'four'], maxtags = 4, key='1') NLU Apply text mining on a dataframe. Created by @JohnSnowLabs . nlu.load('sentiment').predict('I love NLU! <3') Streamlit Extras A library with useful Streamlit extras. Created by @arnaudmiribel . mention(label="An awesome Streamlit App", icon="streamlit", url="https://extras.streamlit.app",) Next Previous: Write and magic Next: st.title forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
Argh__This_app_has_gone_over_its_resource_limits__.txt
Argh. This app has gone over its resource limits - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Knowledge base / Deployment issues / Argh. This app has gone over its resource limits Argh. This app has gone over its resource limits Sorry! It means you've hit the resource limits of your Streamlit Community Cloud account. There are a few things you can change in your app to make it less resource-hungry: Reboot your app (temporary fix) Use st.cache_data or st.cache_resource to load models or data only once Restrict the cache size with ttl or max_entries Move big datasets to a database Profile your app's memory usage Check out our blog post on "Common app problems: Resource limits" for more in-depth tips prevent your app from hitting the resource limits of the Streamlit Community Cloud. Related forum posts: https://discuss.streamlit.io/t/common-app-problems-resource-limits/16969 https://blog.streamlit.io/common-app-problems-resource-limits/ We offer free resource increases only to support nonprofits or educational organizations on a case-by-case basis. If you are a nonprofit or educational organization, please complete this form and we will review your submission as soon as possible. Once the increase is completed, you will receive an email from the Streamlit marketing team with a confirmation that the increase has been applied. Previous: App is not loading when running remotely Next: How do I share apps with viewers outside my organization? forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI
st.column_config_-_Streamlit_Docs.txt
st.column_config - Streamlit Docs Documentation search Search rocket_launch Get started Installation add Fundamentals add First steps add code Develop Concepts add API reference remove PAGE ELEMENTS Write and magic add Text elements add Data elements remove st.dataframe st.data_editor st.column_config remove Column Text column Number column Checkbox column Selectbox column Datetime column Date column Time column List column Link column Image column Area chart column Line chart column Bar chart column Progress column st.table st.metric st.json Chart elements add Input widgets add Media elements add Layouts and containers add Chat elements add Status elements add Third-party components open_in_new APPLICATION LOGIC Navigation and pages add Execution flow add Caching and state add Connections and secrets add Custom components add Utilities add Configuration add TOOLS App testing add Command line add Tutorials add Quick reference add web_asset Deploy Concepts add Streamlit Community Cloud add Snowflake Other platforms add school Knowledge base FAQ Installing dependencies Deployment issues Home / Develop / API reference / Data elements / st.column_config Column configuration When working with data in Streamlit, the st.column_config class is a powerful tool for configuring data display and interaction. Specifically designed for the column_config parameter in st.dataframe and st.data_editor , it provides a suite of methods to tailor your columns to various data types - from simple text and numbers to lists, URLs, images, and more. Whether it's translating temporal data into user-friendly formats or utilizing charts and progress bars for clearer data visualization, column configuration not only provides the user with an enriched data viewing experience but also ensures that you're equipped with the tools to present and interact with your data, just the way you want it. Column Configure a generic column. Column("Streamlit Widgets", width="medium", help="Streamlit **widget** commands 🎈") Text column Configure a text column. TextColumn("Widgets", max_chars=50, validate="^st\.[a-z_]+$") Number column Configure a number column. NumberColumn("Price (in USD)", min_value=0, format="$%d") Checkbox column Configure a checkbox column. CheckboxColumn("Your favorite?", help="Select your **favorite** widgets") Selectbox column Configure a selectbox column. SelectboxColumn("App Category", options=["🤖 LLM", "📈 Data Viz"]) Datetime column Configure a datetime column. DatetimeColumn("Appointment", min_value=datetime(2023, 6, 1), format="D MMM YYYY, h:mm a") Date column Configure a date column. DateColumn("Birthday", max_value=date(2005, 1, 1), format="DD.MM.YYYY") Time column Configure a time column. TimeColumn("Appointment", min_value=time(8, 0, 0), format="hh:mm a") List column Configure a list column. ListColumn("Sales (last 6 months)", width="medium") Link column Configure a link column. LinkColumn("Trending apps", max_chars=100, validate="^https://.*$") Image column Configure an image column. ImageColumn("Preview Image", help="The preview screenshots") Area chart column Configure an area chart column. AreaChartColumn("Sales (last 6 months)" y_min=0, y_max=100) Line chart column Configure a line chart column. LineChartColumn("Sales (last 6 months)" y_min=0, y_max=100) Bar chart column Configure a bar chart column. BarChartColumn("Marketing spend" y_min=0, y_max=100) Progress column Configure a progress column. ProgressColumn("Sales volume", min_value=0, max_value=1000, format="$%f") Previous: st.data_editor Next: Column forum Still have questions? Our forums are full of helpful information and Streamlit experts. Home Contact Us Community © 2025 Snowflake Inc. Cookie policy forum Ask AI