diff --git a/content/develop/api-reference/_index.md b/content/develop/api-reference/_index.md index df2448bb7..c69e62784 100644 --- a/content/develop/api-reference/_index.md +++ b/content/develop/api-reference/_index.md @@ -1845,14 +1845,38 @@ rain(emoji="🎈", font_size=54, - + -

Switch page

+screenshot -Programmatically navigates to a specified page. +

Navigation

+ +Configure the available pages in a multipage app. ```python -st.switch_page("pages/my_page.py") +st.navigation({ + "Your account" : [log_out, settings], + "Reports" : [overview, usage], + "Tools" : [search] +}) +``` + +
+ + + +screenshot + +

Page

+ +Define a page in a multipage app. + +```python +home = st.Page( + "home.py", + title="Home", + icon=":material/home:" +) ```
@@ -1872,6 +1896,18 @@ st.page_link("pages/profile.py", label="My profile")
+ + +

Switch page

+ +Programmatically navigates to a specified page. + +```python +st.switch_page("pages/my_page.py") +``` + +
+
### Execution flow diff --git a/content/develop/api-reference/caching-and-state/_index.md b/content/develop/api-reference/caching-and-state/_index.md index 99ea9ecbe..5028ea4a1 100644 --- a/content/develop/api-reference/caching-and-state/_index.md +++ b/content/develop/api-reference/caching-and-state/_index.md @@ -84,23 +84,6 @@ st.query_params.clear() - - -> This command was deprecated in version 1.18.0. Use `st.cache_data` or `st.cache_resource` instead. - -

Caching

- -Function decorator to memoize function executions. - -```python -@st.cache(ttl=3600) -def run_long_computation(arg1, arg2): - # Do stuff here - return computation_output -``` - -
- > This command was deprecated in version 1.18.0. Use `st.cache_data` instead. diff --git a/content/develop/api-reference/caching-and-state/cache.md b/content/develop/api-reference/caching-and-state/cache.md deleted file mode 100644 index 1e324f53e..000000000 --- a/content/develop/api-reference/caching-and-state/cache.md +++ /dev/null @@ -1,36 +0,0 @@ ---- -title: st.cache -slug: /develop/api-reference/caching-and-state/st.cache -description: st.cache is used to memoize function executions. ---- - -# st.cache - -When you mark a function with Streamlit’s cache annotation, it tells Streamlit -that whenever the function is called it should check three things: - -1. The name of the function -2. The actual code that makes up the body of the function -3. The input parameters that you called the function with - -If this is the first time Streamlit has seen those three items, with those exact -values, and in that exact combination, it runs the function and stores the -result in a local cache. - -Then, next time the function is called, if those three values have not changed -Streamlit knows it can skip executing the function altogether. Instead, it just -reads the output from the local cache and passes it on to the caller. - -The main limitation is that Streamlit’s cache feature doesn’t know about -changes that take place outside the body of the annotated function. - -For more information about the Streamlit cache, its configuration parameters, -and its limitations, see [Caching](/develop/concepts/architecture/caching). - - - - - -`st.cache` 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**. - - diff --git a/content/develop/api-reference/command-line/run.md b/content/develop/api-reference/command-line/run.md index 0bcb7cd57..1a5bb9cca 100644 --- a/content/develop/api-reference/command-line/run.md +++ b/content/develop/api-reference/command-line/run.md @@ -13,7 +13,7 @@ streamlit run [-- config options] [script args] ### Arguments -``: The path to your entrypoint file for your Streamlit app. Your entrypoint file is your app's homepage. +``: The path to your entrypoint file for your Streamlit app. In a multipage app with `st.navigation`, your entrypoint file acts as a router between your pages. Otherwise, your entrypoint file is your app's homepage. ### Options diff --git a/content/develop/api-reference/custom-components/html.md b/content/develop/api-reference/custom-components/html.md index 05e1b9dd3..219d29036 100644 --- a/content/develop/api-reference/custom-components/html.md +++ b/content/develop/api-reference/custom-components/html.md @@ -4,50 +4,3 @@ slug: /develop/api-reference/custom-components/st.components.v1.html --- - -#### Example - -```python -import streamlit as st -import streamlit.components.v1 as components - -# bootstrap 4 collapse example -components.html( - """ - - - -
-
-
-
- -
-
-
-
- Collapsible Group Item #1 content -
-
-
-
-
-
- -
-
-
-
- Collapsible Group Item #2 content -
-
-
-
- """, - height=600, -) -``` diff --git a/content/develop/api-reference/custom-components/iframe.md b/content/develop/api-reference/custom-components/iframe.md index 4b6d2446e..921a981d8 100644 --- a/content/develop/api-reference/custom-components/iframe.md +++ b/content/develop/api-reference/custom-components/iframe.md @@ -4,13 +4,3 @@ slug: /develop/api-reference/custom-components/st.components.v1.iframe --- - -#### Example - -```python -import streamlit as st -import streamlit.components.v1 as components - -# embed streamlit docs in a streamlit app -components.iframe("https://example.com", height=500) -``` diff --git a/content/develop/api-reference/navigation/_index.md b/content/develop/api-reference/navigation/_index.md index 0d0332efc..1d363e4fb 100644 --- a/content/develop/api-reference/navigation/_index.md +++ b/content/develop/api-reference/navigation/_index.md @@ -7,6 +7,42 @@ slug: /develop/api-reference/navigation + + +screenshot + +

Navigation

+ +Configure the available pages in a multipage app. + +```python +st.navigation({ + "Your account" : [log_out, settings], + "Reports" : [overview, usage], + "Tools" : [search] +}) +``` + +
+ + + +screenshot + +

Page

+ +Define a page in a multipage app. + +```python +home = st.Page( + "home.py", + title="Home", + icon=":material/home:" +) +``` + +
+ screenshot diff --git a/content/develop/api-reference/navigation/navigation.md b/content/develop/api-reference/navigation/navigation.md new file mode 100644 index 000000000..fed9f1cc1 --- /dev/null +++ b/content/develop/api-reference/navigation/navigation.md @@ -0,0 +1,7 @@ +--- +title: st.navigation +slug: /develop/api-reference/navigation/st.navigation +description: st.navigation declares the set of available pages to select in a multipage app +--- + + diff --git a/content/develop/api-reference/navigation/page.md b/content/develop/api-reference/navigation/page.md new file mode 100644 index 000000000..6bbcc27e9 --- /dev/null +++ b/content/develop/api-reference/navigation/page.md @@ -0,0 +1,11 @@ +--- +title: st.Page +slug: /develop/api-reference/navigation/st.page +description: st.Page initializes a StreamlitPage object for multipage apps +--- + + + + + + diff --git a/content/develop/concepts/architecture/fragments.md b/content/develop/concepts/architecture/fragments.md index 19e13a18a..588a57d79 100644 --- a/content/develop/concepts/architecture/fragments.md +++ b/content/develop/concepts/architecture/fragments.md @@ -81,6 +81,7 @@ Streamlit ignores fragment return values during fragment reruns, so defining ret - Elements drawn in the main body of your fragment are cleared and redrawn in place during a fragment rerun. Repeated fragment reruns will not cause additional elements to appear. - Elements drawn to containers outside the main body of fragment will not be cleared with each fragment rerun. Instead, Streamlit will draw them additively and these elements will accumulate until the next full-script rerun. +- A fragment can't draw widgets in containers outside of the main body of the fragment. Widgets can only go in the main body of a fragment. To prevent elements from accumulating in outside containers, use [`st.empty`](/develop/api-reference/layout/st.empty) containers. For a related tutorial, see [Create a fragment across multiple containers](/develop/tutorials/execution-flow/create-a-multiple-container-fragment). @@ -145,3 +146,5 @@ Caching saves you from unnecessarily running a piece of your app while the rest - Fragments can't detect a change in input values. It is best to use Session State for dynamic input and output for fragment functions. - Calling fragments within fragments is unsupported. - Using caching and fragments on the same function is unsupported. +- Using fragments within callback functions is unsupported. +- Fragments can't render widgets in externally-created containers; widgets can only be in the main body of a fragment. diff --git a/content/develop/concepts/architecture/old_cache_primitives.md b/content/develop/concepts/architecture/old_cache_primitives.md deleted file mode 100644 index 4cfcecfa7..000000000 --- a/content/develop/concepts/architecture/old_cache_primitives.md +++ /dev/null @@ -1,179 +0,0 @@ ---- -title: Experimental cache primitives -slug: /develop/concepts/architecture/experimental-cache-primitives ---- - - - -The experimental cache primitives described on this page were deprecated in version 1.18.0. Use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead. Learn more in [Caching](/develop/concepts/architecture/caching). - - - -# Experimental cache primitives - -## Overview - -Streamlit's unique execution model is a part of what makes it a joy to use: your code executes from top to bottom like a simple script for every interaction. There's no need to think about models, views, controllers, or anything of the sort. - -Whenever your code re-executes, a decorator called [`@st.cache`](/develop/api-reference/caching-and-state/st.cache)β€”which is a powerful primitive for memoization and state storage capabilitiesβ€”provides a caching mechanism that allows your app to stay performant even when loading data from the web, manipulating large datasets, or performing expensive computations. - -However, we've found that [`@st.cache`](/develop/concepts/architecture/caching) is hard to use and not fast. You're either faced with cryptic errors like `InternalHashError` or `UnhashableTypeError`. Or you need to understand concepts like [`hash_funcs`](/develop/concepts/architecture/caching#the-hash_funcs-parameter) and [`allow_output_mutation`](/develop/concepts/architecture/caching#example-1-pass-a-database-connection-around). - -Our solutions include two new primitives: [**`st.experimental_memo`**](/develop/api-reference/caching-and-state/st.experimental_memo) and [**`st.experimental_singleton`**](/develop/api-reference/caching-and-state/st.experimental_singleton). They're conceptually simpler and much, much faster. In some of our internal tests on caching large dataframes, `@st.experimental_memo` has outperformed `@st.cache` by an order of magnitude. That's over 10X faster! πŸš€ - -Let's take a look at the use-cases these _two_ experimental APIs serve, and how they're a significant improvement over `@st.cache`. - -## Problem - -`@st.cache` was serving the following use-cases: - -1. Storing computation results given different kinds of inputs. In Computer Science literature, this is called [**memoization**](https://en.wikipedia.org/wiki/Memoization). -2. Initializing an object exactly once, and reusing that same instance on each rerun for the Streamlit server's lifetime. This is called the [**singleton pattern**](https://en.wikipedia.org/wiki/Singleton_pattern). -3. Storing global state to be shared and modified across multiple Streamlit sessions (and, since Streamlit is threaded, you need to pay special attention to thread-safety). - -As a result of `@st.cache` trying to cover too many use-cases under a single unified API, it's both slow and complex. - -## Solution - -While `@st.cache` tries to solve two very different problems simultaneously (caching data and sharing global singleton objects), these new primitives simplify things by dividing the problem across two different APIs. As a result, they are faster and simpler. - -### `@st.experimental_memo` - -Use [`@st.experimental_memo`](/develop/api-reference/caching-and-state/st.experimental_memo) to store expensive computation which can be "cached" or "memoized" in the traditional sense. It has almost the exact same API as the existing `@st.cache`, so you can often blindly replace one for the other: - -```python -import streamlit as st - -@st.experimental_memo -def factorial(n): - if n < 1: - return 1 - return n * factorial(n - 1) - -f10 = factorial(10) -f9 = factorial(9) # Returns instantly! -``` - -#### Properties - -- Unlike `@st.cache`, this returns cached items by value, not by reference. This means that you no longer have to worry about accidentally mutating the items stored in the cache. Behind the scenes, this is done by using Python's `pickle()` function to serialize/deserialize cached values. -- Although this uses a custom hashing solution for generating cache keys (like `@st.cache`), it does **_not_** use `hash_funcs` as an escape hatch for unhashable parameters. Instead, we allow you to ignore unhashable parameters (e.g. database connections) by prefixing them with an underscore. - -For example: - -```python -import streamlit as st -import pandas as pd -from sqlalchemy.orm import sessionmaker - -@st.experimental_memo -def get_page(_sessionmaker, page_size, page): - """Retrieve rows from the RNA database, and cache them. - - Parameters - ---------- - _sessionmaker : a SQLAlchemy session factory. Because this arg name is - prefixed with "_", it won't be hashed. - page_size : the number of rows in a page of result - page : the page number to retrieve - - Returns - ------- - pandas.DataFrame - A DataFrame containing the retrieved rows. Mutating it won't affect - the cache. - """ - with _sessionmaker() as session: - query = ( - session - .query(RNA.id, RNA.seq_short, RNA.seq_long, RNA.len, RNA.upi) - .order_by(RNA.id) - .offset(page_size * page) - .limit(page_size) - ) - - return pd.read_sql(query.statement, query.session.bind) -``` - -### `@st.experimental_singleton` - -[`@st.experimental_singleton`](/develop/api-reference/caching-and-state/st.experimental_singleton) is a key-value store that's shared across all sessions of a Streamlit app. It's great for storing heavyweight singleton objects across sessions (like TensorFlow/Torch/Keras sessions and/or database connections). - -Example usage: - -```python -import streamlit as st -from sqlalchemy.orm import sessionmaker - -@st.experimental_singleton -def get_db_sessionmaker(): - # This is for illustration purposes only - DB_URL = "your-db-url" - engine = create_engine(DB_URL) - return sessionmaker(engine) - -dbsm = get_db_sessionmaker() -``` - -#### How this compares to `@st.cache`: - -- Like `@st.cache`, **this returns items by reference.** -- You can return any object type, including objects that are not serializable. -- Unlike `@st.cache`, this decorator does not have additional logic to check whether you are unexpectedly mutating the cached object. That logic was slow and produced confusing error messages. So, instead, we're hoping that by calling this decorator "singleton," we're nudging you to the correct behavior. -- This does not follow the computation graph. -- You don't have to worry about `hash_funcs`! Just prefix your arguments with an underscore to ignore them. - - - -Singleton objects can be used concurrently by every user connected to your app, and _you are responsible for ensuring that `@st.singleton` objects are thread-safe_. (Most objects you'd want to stick inside an `@st.singleton` annotation are probably already safeβ€”but you should verify this.) - - - -### Which to use: memo or singleton? - -Decide between `@st.experimental_memo` and `@st.experimental_singleton` based on your function's _return type_. Functions that return _data_ should use `memo`. Functions that return _non-data objects_ should use `singleton`. - -For example: - -- Dataframe computation (pandas, numpy, etc): this is *dataβ€”*use `memo` -- Storing downloaded data: `memo` -- Calculating pi to n digits: `memo` -- Tensorflow session: this is a *non-data objectβ€”*use `singleton` -- Database connection: `singleton` - -### Clear memo and singleton caches procedurally - -You can clear caches of functions decorated with `@st.experimental_memo` and `@st.experimental_singleton` _in code_. For example, you can do the following: - -```python -@st.experimental_memo -def square(x): - return x**2 - -if st.button("Clear Square"): - # Clear square's memoized values: - square.clear() - -if st.button("Clear All"): - # Clear values from *all* memoized functions: - st.experimental_memo.clear() -``` - -Pressing the "Clear Square" button will clear `square()`'s memoized values. Pressing the "Clear All" button will clear memoized values from all functions decorated with `@st.experimental_memo`. - -In summary: - -- Any function annotated with `@st.experimental_memo` or `@st.experimental_singleton` gets its own `clear()` function automatically. -- Additionally, you can use [`st.experimental_memo.clear()`](/develop/api-reference/caching-and-state/st.experimental_memo.clear) and [`st.experimental_singleton.clear()`](/develop/api-reference/caching-and-state/st.experimental_singleton.clear) to clear _all_ memo and singleton caches, respectively. - - - -The commands are **experimental**, so they're governed by our [experimental API process](/develop/quick-reference/prerelease#experimental). - - - -These specialized **memoization** and **singleton** commands represent a big step in Streamlit's evolution, with the potential to _entirely replace_ `@st.cache` at some point in 2022. - -Yes, today you may use `@st.cache` for storing data you pulled in from a database connection (for a Tensorflow session, for caching the results of a long computation like changing the datetime values on a pandas dataframe, etc.). But these are very different things, so we made two new functions that will make it much faster! πŸ’¨ - -Please help us out by testing these commands in real apps and leaving comments in [the Streamlit forums](https://discuss.streamlit.io/). diff --git a/content/develop/concepts/architecture/old_caching.md b/content/develop/concepts/architecture/old_caching.md deleted file mode 100644 index 1c925bd2b..000000000 --- a/content/develop/concepts/architecture/old_caching.md +++ /dev/null @@ -1,465 +0,0 @@ ---- -title: Optimize performance with st.cache -slug: /develop/concepts/architecture/st.cache ---- - - - -`st.cache` was deprecated in version 1.18.0. Use [`st.cache_data`](/develop/api-reference/caching-and-state/st.cache_data) or [`st.cache_resource`](/develop/api-reference/caching-and-state/st.cache_resource) instead. Learn more in [Caching](/develop/concepts/architecture/caching). - - - -# Optimize performance with st.cache - -Streamlit provides a caching mechanism that allows your app to stay performant even when loading data from the web, manipulating large datasets, or performing expensive computations. This is done with the [`@st.cache`](/develop/api-reference/caching-and-state/st.cache) decorator. - -When you mark a function with the [`@st.cache`](/develop/api-reference/caching-and-state/st.cache) decorator, it tells Streamlit that whenever the function is called it needs to check a few things: - -1. The input parameters that you called the function with -2. The value of any external variable used in the function -3. The body of the function -4. The body of any function used inside the cached function - -If this is the first time Streamlit has seen these four components with these exact values and in this exact combination and order, it runs the function and stores the result in a local cache. Then, next time the cached function is called, if none of these components changed, Streamlit will just skip executing the function altogether and, instead, return the output previously stored in the cache. - -The way Streamlit keeps track of changes in these components is through hashing. Think of the cache as an in-memory key-value store, where the key is a hash of all of the above and the value is the actual output object passed by reference. - -Finally, [`@st.cache`](/develop/api-reference/caching-and-state/st.cache) supports arguments to configure the cache's behavior. You can find more information on those in our [API reference](/develop/api-reference). - -Let's take a look at a few examples that illustrate how caching works in a Streamlit app. - -## Example 1: Basic usage - -For starters, let's take a look at a sample app that has a function that performs an expensive, long-running computation. Without caching, this function is rerun each time the app is refreshed, leading to a poor user experience. Copy this code into a new app and try it out yourself: - -```python -import streamlit as st -import time - -def expensive_computation(a, b): - time.sleep(2) # πŸ‘ˆ This makes the function take 2s to run - return a * b - -a = 2 -b = 21 -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -Try pressing **R** to rerun the app, and notice how long it takes for the result to show up. This is because `expensive_computation(a, b)` is being re-executed every time the app runs. This isn't a great experience. - -Let's add the [`@st.cache`](/develop/api-reference/caching-and-state/st.cache) decorator: - -```python -import streamlit as st -import time - -@st.cache # πŸ‘ˆ Added this -def expensive_computation(a, b): - time.sleep(2) # This makes the function take 2s to run - return a * b - -a = 2 -b = 21 -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -Now run the app again and you'll notice that it is much faster every time you press R to rerun. To understand what is happening, let's add an st.write inside the function: - -```python -import streamlit as st -import time - -@st.cache(suppress_st_warning=True) # πŸ‘ˆ Changed this -def expensive_computation(a, b): - # πŸ‘‡ Added this - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return a * b - -a = 2 -b = 21 -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -Now when you rerun the app the text "Cache miss" appears on the first run, but not on any subsequent runs. That's because the cached function is only being executed once, and every time after that you're actually hitting the cache. - - - -You may have noticed that we've added the `suppress_st_warning` keyword to the `@st.cache` decorators. That's because the cached function above uses a Streamlit command itself (`st.write` in this case), and when Streamlit sees that, it shows a warning that your command will only execute when you get a cache miss. More often than not, when you see that warning it's because there's a bug in your code. However, in our case we're using the `st.write` command to demonstrate when the cache is being missed, so the behavior Streamlit is warning us about is exactly what we want. As a result, we are passing in `suppress_st_warning=True` to turn that warning off. - - - -## Example 2: When the function arguments change - -Without stopping the previous app server, let's change one of the arguments to our cached function: - -```python -import streamlit as st -import time - -@st.cache(suppress_st_warning=True) -def expensive_computation(a, b): - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return a * b - -a = 2 -b = 210 # πŸ‘ˆ Changed this -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -Now the first time you rerun the app it's a cache miss. This is evidenced by the "Cache miss" text showing up and the app taking 2s to finish running. After that, if you press **R** to rerun, it's always a cache hit. That is, no such text shows up and the app is fast again. - -This is because Streamlit notices whenever the arguments **a** and **b** change and determines whether the function should be re-executed and re-cached. - -## Example 3: When the function body changes - -Without stopping and restarting your Streamlit server, let's remove the widget from our app and modify the function's code by adding a `+ 1` to the return value. - -```python -import streamlit as st -import time - -@st.cache(suppress_st_warning=True) -def expensive_computation(a, b): - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return a * b + 1 # πŸ‘ˆ Added a +1 at the end here - -a = 2 -b = 210 -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -The first run is a "Cache miss", but when you press **R** each subsequent run is a cache hit. This is because on first run, Streamlit detected that the function body changed, reran the function, and put the result in the cache. - - - -If you change the function back the result will already be in the Streamlit cache from a previous run. Try it out! - - - -## Example 4: When an inner function changes - -Let's make our cached function depend on another function internally: - -```python -import streamlit as st -import time - -def inner_func(a, b): - st.write("inner_func(", a, ",", b, ") ran") - return a * b - -@st.cache(suppress_st_warning=True) -def expensive_computation(a, b): - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return inner_func(a, b) + 1 - -a = 2 -b = 210 -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -What you see is the usual: - -1. The first run results in a cache miss. -1. Every subsequent rerun results in a cache hit. - -But now let's try modifying the `inner_func()`: - -```python -import streamlit as st -import time - -def inner_func(a, b): - st.write("inner_func(", a, ",", b, ") ran") - return a ** b # πŸ‘ˆ Changed the * to ** here - -@st.cache(suppress_st_warning=True) -def expensive_computation(a, b): - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return inner_func(a, b) + 1 - -a = 2 -b = 21 -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -Even though `inner_func()` is not annotated with [`@st.cache`](/develop/api-reference/caching-and-state/st.cache), when we edit its body we cause a "Cache miss" in the outer `expensive_computation()`. - -That's because Streamlit always traverses your code and its dependencies to verify that the cached values are still valid. This means that while developing your app you can edit your code freely without worrying about the cache. Any change you make to your app, Streamlit should do the right thing! - -Streamlit is also smart enough to only traverse dependencies that belong to your app, and skip over any dependency that comes from an installed Python library. - -## Example 5: Use caching to speed up your app across users - -Going back to our original function, let's add a widget to control the value of `b`: - -```python -import streamlit as st -import time - -@st.cache(suppress_st_warning=True) -def expensive_computation(a, b): - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return a * b - -a = 2 -b = st.slider("Pick a number", 0, 10) # πŸ‘ˆ Changed this -res = expensive_computation(a, b) - -st.write("Result:", res) -``` - -What you'll see: - -- If you move the slider to a number Streamlit hasn't seen before, you'll have a cache miss again. And every subsequent rerun with the same number will be a cache hit, of course. -- If you move the slider back to a number Streamlit has seen before, the cache is hit and the app is fast as expected. - -In computer science terms, what is happening here is that [`@st.cache`](/develop/api-reference/caching-and-state/st.cache) is [memoizing](https://en.wikipedia.org/wiki/Memoization) `expensive_computation(a, b)`. - -But now let's go one step further! Try the following: - -1. Move the slider to a number you haven't tried before, such as 9. -2. Pretend you're another user by opening another browser tab pointing to your Streamlit app (usually at http://localhost:8501) -3. In the new tab, move the slider to 9. - -Notice how this is actually a cache hit! That is, you don't actually see the "Cache miss" text on the second tab even though that second user never moved the slider to 9 at any point prior to this. - -This happens because the Streamlit cache is global to all users. So everyone contributes to everyone else's performance. - -## Example 6: Mutating cached values - -As mentioned in the [overview](#optimize-performance-with-stcache) section, the Streamlit cache stores items by reference. This allows the Streamlit cache to support structures that aren't memory-managed by Python, such as TensorFlow objects. However, it can also lead to unexpected behavior β€” which is why Streamlit has a few checks to guide developers in the right direction. Let's look into those checks now. - -Let's write an app that has a cached function which returns a mutable object, and then let's follow up by mutating that object: - -```python -import streamlit as st -import time - -@st.cache(suppress_st_warning=True) -def expensive_computation(a, b): - st.write("Cache miss: expensive_computation(", a, ",", b, ") ran") - time.sleep(2) # This makes the function take 2s to run - return {"output": a * b} # πŸ‘ˆ Mutable object - -a = 2 -b = 21 -res = expensive_computation(a, b) - -st.write("Result:", res) - -res["output"] = "result was manually mutated" # πŸ‘ˆ Mutated cached value - -st.write("Mutated result:", res) -``` - -When you run this app for the first time, you should see three messages on the screen: - -``` -Cache miss: expensive_computation(...) ran -Result: {output: 42} -Mutated result: {output: "result was manually mutated"} -``` - -No surprises here. But now notice what happens when you rerun you app (i.e. press **R**): - -``` -Result: {output: "result was manually mutated"} -Mutated result: {output: "result was manually mutated"} -Cached object mutated. (...) -``` - -So what's up? - -What's going on here is that Streamlit caches the output `res` by reference. When you mutated `res["output"]` outside the cached function you ended up inadvertently modifying the cache. This means every subsequent call to `expensive_computation(2, 21)` will return the wrong value! - -Since this behavior is usually not what you'd expect, Streamlit tries to be helpful and show you a warning, along with some ideas about how to fix your code. - -In this specific case, the fix is just to not mutate `res["output"]` outside the cached function. There was no good reason for us to do that anyway! Another solution would be to clone the result value with `res = deepcopy(expensive_computation(2, 21))`. Check out the section entitled [Fixing caching issues](/knowledge-base/using-streamlit/caching-issues) for more information on these approaches and more. - -## Advanced caching - -In [caching](/develop/concepts/architecture/caching), you learned about the Streamlit cache, which is accessed with the [`@st.cache`](/develop/api-reference/caching-and-state/st.cache) decorator. In this article you'll see how Streamlit's caching functionality is implemented, so that you can use it to improve the performance of your Streamlit apps. - -The cache is a key-value store, where the key is a hash of: - -1. The input parameters that you called the function with -1. The value of any external variable used in the function -1. The body of the function -1. The body of any function used inside the cached function - -And the value is a tuple of: - -- The cached output -- A hash of the cached output (you'll see why soon) - -For both the key and the output hash, Streamlit uses a specialized hash function that knows how to traverse code, hash special objects, and can have its [behavior customized by the user](#the-hash_funcs-parameter). - -For example, when the function `expensive_computation(a, b)`, decorated with [`@st.cache`](/develop/api-reference/caching-and-state/st.cache), is executed with `a=2` and `b=21`, Streamlit does the following: - -1. Computes the cache key -1. If the key is found in the cache, then: - - Extracts the previously-cached (output, output_hash) tuple. - - Performs an **Output Mutation Check**, where a fresh hash of the output is computed and compared to the stored `output_hash`. - - If the two hashes are different, shows a **Cached Object Mutated** warning. (Note: Setting `allow_output_mutation=True` disables this step). -1. If the input key is not found in the cache, then: - - Executes the cached function (i.e. `output = expensive_computation(2, 21)`). - - Calculates the `output_hash` from the function's `output`. - - Stores `key β†’ (output, output_hash)` in the cache. -1. Returns the output. - -If an error is encountered an exception is raised. If the error occurs while hashing either the key or the output an `UnhashableTypeError` error is thrown. If you run into any issues, see [fixing caching issues](/knowledge-base/using-streamlit/caching-issues). - -### The hash_funcs parameter - -As described above, Streamlit's caching functionality relies on hashing to calculate the key for cached objects, and to detect unexpected mutations in the cached result. - -For added expressive power, Streamlit lets you override this hashing process using the `hash_funcs` argument. Suppose you define a type called `FileReference` which points to a file in the filesystem: - -```python -class FileReference: - def __init__(self, filename): - self.filename = filename - - -@st.cache -def func(file_reference): - ... -``` - -By default, Streamlit hashes custom classes like `FileReference` by recursively navigating their structure. In this case, its hash is the hash of the filename property. As long as the file name doesn't change, the hash will remain constant. - -However, what if you wanted to have the hasher check for changes to the file's modification time, not just its name? This is possible with [`@st.cache`](/develop/api-reference/caching-and-state/st.cache)'s `hash_funcs` parameter: - -```python -class FileReference: - def __init__(self, filename): - self.filename = filename - -def hash_file_reference(file_reference): - filename = file_reference.filename - return (filename, os.path.getmtime(filename)) - -@st.cache(hash_funcs={FileReference: hash_file_reference}) -def func(file_reference): - ... -``` - -Additionally, you can hash `FileReference` objects by the file's contents: - -```python -class FileReference: - def __init__(self, filename): - self.filename = filename - -def hash_file_reference(file_reference): - with open(file_reference.filename) as f: - return f.read() - -@st.cache(hash_funcs={FileReference: hash_file_reference}) -def func(file_reference): - ... -``` - - - -Because Streamlit's hash function works recursively, you don't have to hash the contents inside `hash_file_reference` Instead, you can return a primitive type, in this case the contents of the file, and Streamlit's internal hasher will compute the actual hash from it. - - - -### Typical hash functions - -While it's possible to write custom hash functions, let's take a look at some of the tools that Python provides out of the box. Here's a list of some hash functions and when it makes sense to use them. - -Python's [`id`](https://docs.python.org/3/library/functions.html#id) function | [Example](#example-1-pass-a-database-connection-around) - -- Speed: Fast -- Use case: If you're hashing a singleton object, like an open database connection or a TensorFlow session. These are objects that will only be instantiated once, no matter how many times your script reruns. - -`lambda _: None` | [Example](#example-2-turn-off-hashing-for-a-specific-type) - -- Speed: Fast -- Use case: If you want to turn off hashing of this type. This is useful if you know the object is not going to change. - -Python's [`hash()`](https://docs.python.org/3/library/functions.html#hash) function | [Example](#example-3-use-pythons-hash-function) - -- Speed: Can be slow based the size of the object being cached -- Use case: If Python already knows how to hash this type correctly. - -Custom hash function | [Example](#the-hash_funcs-parameter) - -- Speed: N/a -- Use case: If you'd like to override how Streamlit hashes a particular type. - -### Example 1: Pass a database connection around - -Suppose we want to open a database connection that can be reused across multiple runs of a Streamlit app. For this you can make use of the fact that cached objects are stored by reference to automatically initialize and reuse the connection: - -```python -@st.cache(allow_output_mutation=True) -def get_database_connection(): - return db.get_connection() -``` - -With just 3 lines of code, the database connection is created once and stored in the cache. Then, every subsequent time `get_database_connection` is called, the already-created connection object is reused automatically. In other words, it becomes a singleton. - - - -Use the `allow_output_mutation=True` flag to suppress the immutability check. This prevents Streamlit from trying to hash the output connection, and also turns off Streamlit's mutation warning in the process. - - - -What if you want to write a function that receives a database connection as input? For that, you'll use `hash_funcs`: - -```python -@st.cache(hash_funcs={DBConnection: id}) -def get_users(connection): - # Note: We assume that connection is of type DBConnection. - return connection.execute_sql('SELECT * from Users') -``` - -Here, we use Python's built-in `id` function, because the connection object is coming from the Streamlit cache via the `get_database_connection` function. This means that the same connection instance is passed around every time, and therefore it always has the same id. However, if you happened to have a second connection object around that pointed to an entirely different database, it would still be safe to pass it to `get_users` because its id is guaranteed to be different than the first id. - -These design patterns apply any time you have an object that points to an external resource, such as a database connection or Tensorflow session. - -### Example 2: Turn off hashing for a specific type - -You can turn off hashing entirely for a particular type by giving it a custom hash function that returns a constant. One reason that you might do this is to avoid hashing large, slow-to-hash objects that you know are not going to change. For example: - -```python -@st.cache(hash_funcs={pd.DataFrame: lambda _: None}) -def func(huge_constant_dataframe): - ... -``` - -When Streamlit encounters an object of this type, it always converts the object into `None`, no matter which instance of `FooType` its looking at. This means all instances are hash to the same value, which effectively cancels out the hashing mechanism. - -### Example 3: Use Python's hash() function - -Sometimes, you might want to use Python’s default hashing instead of Streamlit's. For example, maybe you've encountered a type that Streamlit is unable to hash, but it's hashable with Python's built-in `hash()` function: - -```python -@st.cache(hash_funcs={FooType: hash}) -def func(...): - ... -``` diff --git a/content/develop/concepts/multipage-apps/_index.md b/content/develop/concepts/multipage-apps/_index.md index c5426286b..1d44e5b9b 100644 --- a/content/develop/concepts/multipage-apps/_index.md +++ b/content/develop/concepts/multipage-apps/_index.md @@ -8,11 +8,35 @@ description: Streamlit provides a simple way to create multipage apps. + + +
Overview of multipage apps
+ +Streamlit provides multiple ways to define multipage apps. Understand the terminology and basic comparison between methods. + +
+ + + +
Define multipage apps with st.Page and st.navigation
+ +Learn about the preferred method for defining multipage apps. `st.Page` and `st.navigation` give you flexibility to organize your project directory and label your pages as you please. + +
+ -
Creating multipage apps using the pages/ directory (MPA v1)
+
Creating multipage apps using the pages/ directory
+ +Define your multipage apps through directory structure. Place additional Python files in a `pages/` directory alongside your entrypoint file and pages are automatically shown in a navigation widget inside your app's sidebar. + +
+ + + +
Working with widgets in multipage apps
-Streamlit provides a frictionless way to create multipage apps. Place additional Python files in a `pages/` directory alongside your entrypoint file and pages are automatically shown in a navigation widget inside your app's sidebar. +Understand how widget identity is tied to pages. Learn strategies to get the behavior you want out of widgets.
diff --git a/content/develop/concepts/multipage-apps/overview.md b/content/develop/concepts/multipage-apps/overview.md new file mode 100644 index 000000000..a5ad1769d --- /dev/null +++ b/content/develop/concepts/multipage-apps/overview.md @@ -0,0 +1,112 @@ +--- +title: Overview of multipage apps +slug: /develop/concepts/multipage-apps/overview +description: Understand Streamlit's features for creating multipage apps +--- + +# Overview of multipage apps + +Streamlit provides two built-in mechanisms for creating multipage apps. The simplest method is to use a `pages/` directory. However, the preferred and more customizable method is to use `st.navigation`. + +## `st.Page` and `st.navigation` + +If you want maximum flexibility in defining your multipage app, we recommend using `st.Page` and `st.navigation`. With `st.Page` you can declare any Python file or `Callable` as a page in your app. Furthermore, you can define common elements for your pages in your entrypoint file (the file you pass to `streamlit run`). With these methods, your entrypoint file becomes like a picture frame shared by all your pages. + +You must include `st.navigation` in your entrypoint file to configure your app's navigation menu. This is also how your entrypoint file serves as the router between your pages. + +## `pages/` directory + +If you're looking for a quick and simple solution, just place a `pages/` directory next to your entrypoint file. For every Python file in your `pages/` directory, Streamlit will create an additional page for your app. Streamlit determines the page labels and URLs from the file name and automatically populates a navigation menu at the top of your app's sidebar. + +``` +your_working_directory/ +β”œβ”€β”€ pages/ +β”‚ β”œβ”€β”€ a_page.py +β”‚ └── another_page.py +└── your_homepage.py +``` + +Streamlit determines the page order in navigation from the filenames. You can use numerical prefixes in the filenames to adjust page order. For more information, see [How pages are sorted in the sidebar](/develop/concepts/multipage-apps/pages-directory#how-pages-are-sorted-in-the-sidebar). If you want to customize your navigation menu with this option, you can deactivate the default navigation through [configuration](/develop/api-reference/configuration/config.toml) (`client.showSidebarNavigation = false`). Then, you can use `st.page_link` to manually contruct a custom navigation menu. With `st.page_link`, you can change the page label and icon in your navigation menu, but you can't change the URLs of your pages. + +## Page terminology + +A page has four identifying pieces as follows: + +- **Page source**: This is a Python file or callable function with the page's source code. +- **Page label**: This is how the page is identified within the navigation menu. See looks_one. +- **Page title**: This is the content of the HTML `` element and how the page is identified within a browser tab. See <i style={{ verticalAlign: "-.25em" }} class="material-icons-sharp">looks_two</i>. +- **Page URL pathname**: This is the relative path of the page from the root URL of the app. See <i style={{ verticalAlign: "-.25em" }} class="material-icons-sharp">looks_3</i>. + +Additionly, a page can have two icons as follows: + +- **Page favicon**: This is the icon next to your page title within a browser tab. See <i style={{ verticalAlign: "-.25em" }} class="material-icons-sharp">looks_4</i>. +- **Page icon**: This is the icon next to your page label in the navigation menu. See <i style={{ verticalAlign: "-.25em" }} class="material-icons-sharp">looks_5</i>. + +Typically, the page icon and favicon are the same, but it's possible make them different. + +<div style={{ maxWidth: '564px', margin: 'auto' }}> +<Image caption="1. Page label, 2.Page titles, 3. Page URL pathname, 4.Page favicon, 5. Page icon" src="/images/page_parts.jpg" frame /> +</div> + +## Automatic page labels and URLs + +If you use `st.Page` without declaring the page title or URL pathname, Streamlit falls back on automatically determining the page label, title, and URL pathname in the same manner as when you use a `pages/` directory with the default navigation menu. This section describes this naming convention which is shared between the two approaches to multipage apps. + +### Parts of filenames and callables + +Filenames are composed of four different parts as follows (in order): + +1. `number`: A non-negative integer. +2. `separator`: Any combination of underscore (`"_"`), dash (`"-"`), and space (`" "`). +3. `identifier`: Everything up to, but not including, `".py"`. +4. `".py"` + +For callables, the function name is the `identifier`, including any leading or trailing underscores. + +### How Streamlit converts filenames into labels and titles + +Within the navigation menu, Streamlit displays page labels and titles as follows: + +1. If your page has an `identifier`, Streamlit displays the `identifier`. Any underscores within the page's `identifier` are treated as spaces. Therefore, leading and trailing underscores are not shown. Sequential underscores appear as a single space. +2. Otherwise, if your page has a `number` but does not have an `identifier`, Streamlit displays the `number`, unmodified. Leading zeros are included, if present. +3. Otherwise, if your page only has a `separator` with no `number` and no `identifier`, Streamlit will not display the page in the sidebar navigation. + +The following filenames and callables would all display as "Awesome page" in the sidebar navigation. + +- `"Awesome page.py"` +- `"Awesome_page.py"` +- `"02Awesome_page.py"` +- `"--Awesome_page.py"` +- `"1_Awesome_page.py"` +- `"33 - Awesome page.py"` +- `Awesome_page()` +- `_Awesome_page()` +- `__Awesome_page__()` + +### How Streamlit converts filenames into URL pathnames + +Your app's homepage is associated to the root URL of app. For all other pages, their `identifier` or `number` becomes their URL pathname as follows: + +- If your page has an `identifier` that came from a filename, Streamlit uses the `identifier` with one modification. Streamlit condenses each consecutive grouping of spaces (`" "`) and underscores (`"_"`) to a single underscore. +- Otherwise, if your page has an `identifier` that came from the name of a callable, Streamlit uses the `identifier` unmodified. +- Otherwise, if your page has a `number` but does not have an `identifier`, Streamlit uses the `number`. Leading zeros are included, if present. + +For each filename in the list above, the URL pathname would be "Awesome_page" relative to the root URL of the app. For example, if your app was running on `localhost` port `8501`, the full URL would be `localhost:8501/awesome_page`. For the last two callables, however, the pathname would include the leading and trailing underscores to match the callable name exactly. + +## Navigating between pages + +The primary way users navigate between pages is through the navigation widget. Both methods for defining multipage apps include a default navigation menu that appears in the sidebar. When a user clicks this navigation widget, the app reruns and loads the selected page. Optionally, you can hide the default navigation UI and build your own with [`st.page_link`](/develop/api-reference/widgets/st.page_link). For more information, see [Build a custom navigation menu with `st.page_link`](/develop/tutorials/multipage/st.page_link-nav). + +If you need to programmatically switch pages, use [`st.switch_page`](/develop/api-reference/navigation/st.switch_page). + +Users can also navigate between pages using URLs as noted above. When multiple files have the same URL pathname, Streamlit picks the first one (based on the ordering in the navigation menu. Users can view a specific page by visiting the page's URL. + +<Important> + Navigating between pages by URL creates a new browser session. In particular, clicking markdown links to other pages resets ``st.session_state``. In order to retain values in ``st.session_state``, handle page switching through Streamlit navigation commands and widgets, like ``st.navigation``, ``st.switch_page``, ``st.page_link``, and the built-in navigation menu. +</Important> + +If a user tries to access a URL for a page that does not exist, they will see a modal like the one below, saying the user has requested a page that was not found. + +<div style={{ maxWidth: '75%', margin: 'auto' }}> +<Image alt="Page not found" src="/images/mpa-page-not-found.png" /> +</div> diff --git a/content/develop/concepts/multipage-apps/page-and-navigation.md b/content/develop/concepts/multipage-apps/page-and-navigation.md new file mode 100644 index 000000000..fa62abe12 --- /dev/null +++ b/content/develop/concepts/multipage-apps/page-and-navigation.md @@ -0,0 +1,153 @@ +--- +title: Define multipage apps with st.Page and st.navigation +slug: /develop/concepts/multipage-apps/page-and-navigation +description: Understand the most flexible and preferred method for defining multipage apps +--- + +# 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](/develop/concepts/multipage-apps/overview#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`:** + +```python +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](/develop/concepts/multipage-apps/overview#automatic-page-labels-and-urls). 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`:** + +```python +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() +``` + +<div style={{ maxWidth: '564px', margin: 'auto' }}> +<Image src="/images/mpa-v2-use-set-page-config.jpg" frame /> +</div> + +## 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`:** + +```python +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() +``` + +<div style={{ maxWidth: '564px', margin: 'auto' }}> +<Image src="/images/mpa-v2-page-sections.jpg" frame /> +</div> + +### 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](/develop/tutorials/multipage/dynamic-navigation). + +### 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`. diff --git a/content/develop/concepts/multipage-apps/page_directory.md b/content/develop/concepts/multipage-apps/page_directory.md index 93cff8d9e..f274802db 100644 --- a/content/develop/concepts/multipage-apps/page_directory.md +++ b/content/develop/concepts/multipage-apps/page_directory.md @@ -6,11 +6,13 @@ description: Streamlit provides a simple way to create multipage apps. # Creating multipage apps using the `pages/` directory -As your app grows large, it becomes useful to organize your script into multiple pages. This makes your app easier to manage as a developer and easier to navigate as a user. Streamlit provides a frictionless way to create multipage apps. Pages are automatically shown in a navigation widget inside your app's sidebar. If a user clicks on a page in the sidebar, Streamlit navigates to that page without reloading the frontend β€” making app browsing incredibly fast! In this guide, let’s learn how to create multipage apps. +The most customizable method for declaring multipage apps is using [Page and navigation](/develop/concepts/multipage-apps/page-and-navigation). However, Streamlit also provides a frictionless way to create multipage apps where pages are automatically recognized and shown in a navigation widget inside your app's sidebar. This method uses the `pages/` directory. -## Structuring your multipage app +This page assumes you understand the [Page terminology](/develop/concepts/multipage-apps/overview#page-terminology) presented in the overview. -Streamlit identifies pages in a multipage app by directory structure and filenames. The file you pass to `streamlit run` is called your entrypoint file. This is your app's homepage. When you have a `pages/` directory next to your entrypoint file, Streamlit will identify each Python file within it as a page. The following example has three pages. `your_homepage.py` is the entrypoint file and homepage. +## App structure + +When you use the `pages/` directory, Streamlit identifies pages in your multipage app by directory structure and filenames. Your entrypoint file (the file you pass to `streamlit run`), is your app's homepage. When you have a `pages/` directory next to your entrypoint file, Streamlit will identify each Python file within it as a page. The following example has three pages. `your_homepage.py` is the entrypoint file and homepage. ``` your_working_directory/ @@ -28,40 +30,16 @@ streamlit run your_homepage.py Only `.py` files in the `pages/` directory will be identified as pages. Streamlit ignores all other files in the `pages/` directory and its subdirectories. Streamlit also ignores Python files in subdirectories of `pages/`. -Keep reading to learn how filenames are displayed and ordered in your app's navigation. - -## Naming and ordering your pages - -The entrypoint file is your app's homepage and the first page users will see when visiting your app. Once you've added pages to your app, the entrypoint file appears as the topmost page in the sidebar. Streamlit determines the page label and ordering of each page from your filenames. Labels may differ from the page title set in [`st.set_page_config`](/develop/api-reference/configuration/st.set_page_config). - -### Filenames for pages - -Filenames are composed of four different parts as follows: - -1. `number`. A non-negative integer. -2. `separator`. Any combination of underscore (`"_"`), dash (`"-"`), and space (`" "`). -3. `label`. Everything up to, but not including, `".py"`. -4. `".py"` - -### How Streamlit converts filenames into page labels - -Streamlit displays page labels as follows: - -1. If your filename contains a `label`, Streamlit displays the `label` in the left navigation. Any underscores within the page's `label` are treated as spaces. -2. If your filename contains a `number` but does not contain a `label`, Streamlit displays the `number` instead. -3. If your filename contains only a `separator` with no `number` and no `label`, Streamlit will not display the page in the sidebar navigation. +<Important> -The following filenames would all display as "Awesome homepage" in the sidebar navigation. +If you call `st.navigation` in your app (in any session), Streamlit will switch to using the newer, Page-and-navigation multipage structure. In this case, the `pages/` directory will be ignored across all sessions. You will not be able to revert back to the `pages/` directory unless you restart you app. -- `"Awesome homepage.py"` -- `"Awesome_homepage.py"` -- `"02Awesome_homepage.py"` -- `"--Awesome_homepage.py"` -- `"1_Awesome_homepage.py"` -- `"33 - Awesome homepage.py"` +</Important> ### How pages are sorted in the sidebar +See the overview to understand how Streamlit assigns [Automatic page labels and URLs](/develop/concepts/multipage-apps/overview#automatic-page-labels-and-urls) based on the `number`, `separator`, `identifier`, and `".py"` extension that constitute a filename. + The entrypoint file is always displayed first. The remaining pages are sorted as follows: - Files that have a `number` appear before files without a `number`. @@ -86,26 +64,6 @@ Emojis can be used to make your page names more fun! For example, a file named ` </Tip> -## Navigating between pages - -Pages are automatically shown in a sidebar navigation UI. When a user clicks on a page in the sidebar UI, Streamlit navigates to that page without reloading the entire frontend β€” making app browsing incredibly fast! Optionally, you can hide the default navigation UI and build your own with [`st.page_link`](/develop/api-reference/widgets/st.page_link). For more information, see [Build a custom navigation menu with `st.page_link`](/develop/tutorials/multipage/st.page_link-nav). - -If you need to programmatically switch pages, use [`st.switch_page`](/develop/api-reference/navigation/st.switch_page). - -Users can also navigate between pages using URLs. Pages have their own URLs, defined by the file's `label`. When multiple files have the same `label`, Streamlit picks the first one (based on the ordering [described above](#how-pages-are-sorted-in-the-sidebar)). Users can view a specific page by visiting the page's URL. - -<Important> - -Navigating between pages by URL creates a new browser session and clears `st.session_state`. In particular, clicking markdown links to other -pages resets `st.session_state`. In order to retain values in `st.session_state`, a user must use the sidebar navigation or other Streamlit -widgets to switch pages. - -</Important> - -If a user tries to access a URL for a page that does not exist, they will see a modal like the one below, saying the user has requested a page that was not found in the app’s `pages/` directory. - -<Image src="/images/mpa-page-not-found.png" /> - ## Notes and limitations - Pages support run-on-save. diff --git a/content/develop/concepts/multipage-apps/widgets.md b/content/develop/concepts/multipage-apps/widgets.md new file mode 100644 index 000000000..96178d81e --- /dev/null +++ b/content/develop/concepts/multipage-apps/widgets.md @@ -0,0 +1,82 @@ +--- +title: Working with widgets in multipage apps +slug: /develop/concepts/multipage-apps/widgets +description: Understand how widgets interact with pages +--- + +# 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](/develop/concepts/architecture/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`:** + +```python +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. + +```python +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: + +```python +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. + +```python +if "my_key" in st.session_state: + st.session_state.my_key = st.session_state.my_key +``` diff --git a/content/develop/quick-references/api-cheat-sheet.md b/content/develop/quick-references/api-cheat-sheet.md index c71b64759..789fea019 100644 --- a/content/develop/quick-references/api-cheat-sheet.md +++ b/content/develop/quick-references/api-cheat-sheet.md @@ -5,7 +5,7 @@ slug: /develop/quick-reference/cheat-sheet # Streamlit API cheat sheet -This is a summary of the docs, as of [Streamlit v1.35.0](https://pypi.org/project/streamlit/1.35.0/). +This is a summary of the docs, as of [Streamlit v1.35.0](https://pypi.org/project/streamlit/1.36.0/). <Masonry> @@ -89,7 +89,7 @@ st.title("My title") st.header("My header") st.subheader("My sub") st.code("for i in range(8): foo()") -* optional kwarg unsafe_allow_html = True +st.html("<p>Hi!</p>") ``` </CodeTile> @@ -129,6 +129,7 @@ st.logo("logo.jpg") ```python 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) @@ -161,15 +162,15 @@ event = st.vega_lite_chart( <CodeTile> -#### Add widgets to sidebar +#### Add elements to sidebar ```python # Just add it after st.sidebar: ->>> a = st.sidebar.radio("Select one:", [1, 2]) +a = st.sidebar.radio("Select one:", [1, 2]) # Or use "with" notation: ->>> with st.sidebar: ->>> st.radio("Select one:", [1, 2]) +with st.sidebar: + st.radio("Select one:", [1, 2]) ``` </CodeTile> @@ -180,17 +181,20 @@ event = st.vega_lite_chart( ```python # Two equal columns: ->>> col1, col2 = st.columns(2) ->>> col1.write("This is column 1") ->>> col2.write("This is column 2") +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, 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]) +with col1: + st.radio("Select one:", [1, 2]) ``` </CodeTile> @@ -201,13 +205,13 @@ event = st.vega_lite_chart( ```python # Insert containers separated into tabs: ->>> tab1, tab2 = st.tabs(["Tab 1", "Tab2"]) ->>> tab1.write("this is tab 1") ->>> tab2.write("this is tab 2") +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]) +with tab1: + st.radio("Select one:", [1, 2]) ``` </CodeTile> @@ -217,14 +221,14 @@ event = st.vega_lite_chart( #### Expandable containers ```python ->>> expand = st.expander("My label") ->>> expand.write("Inside the expander.") ->>> pop = st.popover("Button label") ->>> pop.checkbox("Show all") +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]) +with expand: + st.radio("Select one:", [1, 2]) ``` </CodeTile> @@ -241,27 +245,34 @@ 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") +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.experimental_dialog("Welcome!") ->>> def modal_dialog(): ->>> st.write("Hello") ->>> ->>> modal_dialog() +@st.experimental_dialog("Welcome!") +def modal_dialog(): + st.write("Hello") + +modal_dialog() # Define a fragment ->>> @st.experimental_fragment ->>> def fragment_function(): ->>> df = get_data() ->>> st.line_chart(df) ->>> st.button("Update") ->>> ->>> fragment_function() +@st.experimental_fragment +def fragment_function(): + df = get_data() + st.line_chart(df) + st.button("Update") + +fragment_function() ``` </CodeTile> @@ -293,15 +304,15 @@ 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) +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) +st.slider("Pick a number", 0, 100, disabled=True) ``` </CodeTile> @@ -312,16 +323,16 @@ st.color_picker("Pick a color") ```python # Insert a chat message container. ->>> with st.chat_message("user"): ->>> st.write("Hello πŸ‘‹") ->>> st.line_chart(np.random.randn(30, 3)) +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") +with st.container(): + st.chat_input("Say something") ``` Learn how to [Build a basic LLM chat app](/develop/tutorials/llms/build-conversational-apps) @@ -335,13 +346,13 @@ Learn how to [Build a basic LLM chat app](/develop/tutorials/llms/build-conversa ```python # Add rows to a dataframe after # showing it. ->>> element = st.dataframe(df1) ->>> element.add_rows(df2) +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) +element = st.line_chart(df1) +element.add_rows(df2) ``` </CodeTile> @@ -351,8 +362,8 @@ Learn how to [Build a basic LLM chat app](/develop/tutorials/llms/build-conversa #### Display code ```python ->>> with st.echo(): ->>> st.write("Code will be executed and printed") +with st.echo(): + st.write("Code will be executed and printed") ``` </CodeTile> @@ -363,15 +374,15 @@ Learn how to [Build a basic LLM chat app](/develop/tutorials/llms/build-conversa ```python # Replace any single element. ->>> element = st.empty() ->>> element.line_chart(...) ->>> element.text_input(...) # Replaces previous. +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". +elements = st.container() +elements.line_chart(...) +st.write("Hello") +elements.text_input(...) # Appears above "Hello". st.help(pandas.DataFrame) st.get_option(key) @@ -395,11 +406,11 @@ 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) +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) ``` </CodeTile> @@ -412,62 +423,46 @@ conn = st.connection("snowflake") ```python # E.g. Dataframe computation, storing downloaded data, etc. ->>> @st.cache_data -... def foo(bar): -... # Do something expensive and return data -... return data +@st.cache_data +def foo(bar): + # Do something expensive and return data + return data # Executes foo ->>> d1 = foo(ref1) +d1 = foo(ref1) # Does not execute foo # Returns cached item by value, d1 == d2 ->>> d2 = foo(ref1) +d2 = foo(ref1) # Different arg, so function foo executes ->>> d3 = foo(ref2) +d3 = foo(ref2) # Clear the cached value for foo(ref1) ->>> foo.clear(ref1) +foo.clear(ref1) # Clear all cached entries for this function ->>> foo.clear() +foo.clear() # Clear values from *all* in-memory or on-disk cached functions ->>> st.cache_data.clear() +st.cache_data.clear() ``` ###### Cache global resources ```python # E.g. TensorFlow session, database connection, etc. ->>> @st.cache_resource -... def foo(bar): -... # Create and return a non-data object -... return session +@st.cache_resource +def foo(bar): + # Create and return a non-data object + return session # Executes foo ->>> s1 = foo(ref1) +s1 = foo(ref1) # Does not execute foo # Returns cached item by reference, s1 == s2 ->>> s2 = foo(ref1) +s2 = foo(ref1) # Different arg, so function foo executes ->>> s3 = foo(ref2) +s3 = foo(ref2) # Clear the cached value for foo(ref1) ->>> foo.clear(ref1) +foo.clear(ref1) # Clear all cached entries for this function ->>> foo.clear() +foo.clear() # Clear all global resources from cache ->>> st.cache_resource.clear() -``` - -###### Deprecated caching - -```python ->>> @st.cache -... def foo(bar): -... # Do something expensive in here... -... return data ->>> # Executes foo ->>> d1 = foo(ref1) ->>> # Does not execute foo ->>> # Returns cached item by reference, d1 == d2 ->>> d2 = foo(ref1) ->>> # Different arg, so function foo executes ->>> d3 = foo(ref2) +st.cache_resource.clear() ``` </CodeTile> @@ -478,19 +473,19 @@ conn = st.connection("snowflake") ```python # Show a spinner during a process ->>> with st.spinner(text="In progress"): ->>> time.sleep(3) ->>> st.success("Done") +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) +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") +with st.status("Authenticating...") as s: + time.sleep(2) + st.write("Some long response.") + s.update(label="Response") st.balloons() st.snow() @@ -512,12 +507,12 @@ st.exception(e) ```python # Show different content based on the user's email address. ->>> if st.user.email == "jane@email.com": ->>> display_jane_content() ->>> elif st.user.email == "adam@foocorp.io": ->>> display_adam_content() ->>> else: ->>> st.write("Please contact us to get access!") +if st.user.email == "jane@email.com": + display_jane_content() +elif st.user.email == "adam@foocorp.io": + display_adam_content() +else: + st.write("Please contact us to get access!") ``` </CodeTile> diff --git a/content/develop/quick-references/changelog.md b/content/develop/quick-references/changelog.md index f4fcf172d..1641c103a 100644 --- a/content/develop/quick-references/changelog.md +++ b/content/develop/quick-references/changelog.md @@ -19,6 +19,47 @@ pip install --upgrade streamlit </Tip> +## **Version 1.36.0** + +_Release date: June 20, 2024_ + +**Highlights** + +- 🧭 Introducing [`st.navigation`](/develop/api-reference/navigation/st.navigation) and [`st.Page`](/develop/api-reference/navigation/st.page) for a new way to define multipage apps! Check out the [docs](/develop/concepts/multipage-apps/overview) to learn more. + +**Notable Changes** + +- πŸ“ŠΒ [`st.bar_chart`](/develop/api-reference/charts/st.bar_chart) can render charts horizontally. +- ℹ️ [`st.expander`](/develop/api-reference/layout/st.expander) supports adding an icon next to its label. +- πŸ—οΈΒ [`st.columns`](/develop/api-reference/layout/st.columns) lets you set vertical alignment. +- πŸ“² Custom components support callback functions ([#8633](https://github.com/streamlit/streamlit/pull/8633), [#3977](https://github.com/streamlit/streamlit/issues/3977)). +- πŸ“₯ Fragments no longer support rendering widgets outside of their main body ([#8756](https://github.com/streamlit/streamlit/pull/8756)). +- 🏷️ You can now customize axis labels for [`st.area_chart`](/develop/api-reference/charts/st.area_chart), [`st.bar_chart`](/develop/api-reference/charts/st.bar_chart), [`st.line_chart`](/develop/api-reference/charts/st.line_chart), and [`st.scatter_chart`](/develop/api-reference/charts/st.scatter_chart). +- βŒ› The caching parameter `experimental_allow_widgets` is deprecated ([#8817](https://github.com/streamlit/streamlit/pull/8817)). +- ❌ Streamlit no longer supports legacy caching. `st.cache` is now an alias for `st.cache_data` and `st.cache_resource` ([#8737](https://github.com/streamlit/streamlit/pull/8737)). +- ⬆️ Streamlit supports `protobuf` version 5 ([#8627](https://github.com/streamlit/streamlit/pull/8627)). + +**Other Changes** + +- ✨ Streamlit Hello uses `st.navigation` and `st.Page`, the new, preferred method for declaring multipage apps ([#8806](https://github.com/streamlit/streamlit/pull/8806)). +- 🧹 Streamlit no longer appends "Β· Streamlit" to the page title of apps, unless running on Community Cloud ([#8900](https://github.com/streamlit/streamlit/pull/8900)). +- πŸ¦‹Β Streamlit magic and `st.write` use `st.json` to display `st.secrets` ([#8659](https://github.com/streamlit/streamlit/pull/8659), [#2905](https://github.com/streamlit/streamlit/issues/2905)). +- πŸ”Β Streamlit doesn't automatically check for newer version on PyPi ([#8841](https://github.com/streamlit/streamlit/pull/8841), [#8453](https://github.com/streamlit/streamlit/issues/8453)). +- 🐌 Bug fix: Custom component functions require importing `streamlit.components.v1` ([#8666](https://github.com/streamlit/streamlit/pull/8666), [#8644](https://github.com/streamlit/streamlit/issues/8644)). +- πŸ•ΈοΈΒ Bug fix: Reverted change to handle Altairs `resolve_scale` method since it caused a regression ([#8845](https://github.com/streamlit/streamlit/pull/8845), [#8642](https://github.com/streamlit/streamlit/issues/8642)). +- πŸ¦—Β Bug fix: Images in Markdown do not overflow the Markdown container ([#8794](https://github.com/streamlit/streamlit/pull/8794)). +- πŸ¦‚Β Bug fix: Clarified the error message for `st.selectbox` when `index` is larger than the size of `options` ([#8775](https://github.com/streamlit/streamlit/pull/8775), [#8771](https://github.com/streamlit/streamlit/issues/8771)). +- 🦟 Bug fix: Streamlit correctly handles non-widget elements with IDs ([#8770](https://github.com/streamlit/streamlit/pull/8770), [#8768](https://github.com/streamlit/streamlit/issues/8768)). +- 🦠 Bug fix: Docstrings correctly identify when `use_container_width=True` is the default ([#8809](https://github.com/streamlit/streamlit/pull/8809)). +- πŸͺ°Β Bug fix: Streamlit has a consistent minimum element height for better vertical alignment ([#8797](https://github.com/streamlit/streamlit/pull/8797), [#8835](https://github.com/streamlit/streamlit/pull/8835), [#8027](https://github.com/streamlit/streamlit/issues/8027), [#8706](https://github.com/streamlit/streamlit/issues/8706)). +- πŸͺ³Β Bug fix: Added check to ensure `SessionInfo` is initialized before performing actions ([#8779](https://github.com/streamlit/streamlit/pull/8779), [#8321](https://github.com/streamlit/streamlit/issues/8321), [#7549](https://github.com/streamlit/streamlit/issues/7549)). +- πŸ•·οΈΒ Bug fix: Dataframe use raw numbers without formatting by default ([#8708](https://github.com/streamlit/streamlit/pull/8708), [#8695](https://github.com/streamlit/streamlit/issues/8695)). +- 🐞 Bug fix: Updated the error message for disallowed writes to Session State ([#8720](https://github.com/streamlit/streamlit/pull/8720), [#8715](https://github.com/streamlit/streamlit/issues/8715)). +- 🐝 Bug fix: Streamlit doesn't initialize `LocalSourcesWatcher` if file watching is disabled ([#8741](https://github.com/streamlit/streamlit/pull/8741), [#8738](https://github.com/streamlit/streamlit/issues/8738)). +- 🐜 Bug fix: `st.experimental_dialog` no longer has an invalid default value for `title` ([#8729](https://github.com/streamlit/streamlit/pull/8729)). +- πŸͺ²Β Bug fix: Removed deprecated kwargs in [`ast.Call`](http://ast.Call) to prevent type error ([#8711](https://github.com/streamlit/streamlit/pull/8711)). Thanks, [JelleZijlstra](https://github.com/JelleZijlstra)! +- πŸ›Β Bug fix: `st.experimental_dialog` is explicitly exported to avoid a type checking error ([#8728](https://github.com/streamlit/streamlit/pull/8728), [#8712](https://github.com/streamlit/streamlit/issues/8712)). + ## **Version 1.35.0** _Release date: May 23, 2024_ diff --git a/content/develop/tutorials/multipage-apps/_index.md b/content/develop/tutorials/multipage-apps/_index.md index c777f588d..153317b83 100644 --- a/content/develop/tutorials/multipage-apps/_index.md +++ b/content/develop/tutorials/multipage-apps/_index.md @@ -7,11 +7,11 @@ slug: /develop/tutorials/multipage <TileContainer layout="list"> -<RefCard href="/develop/tutorials/multipage/st.page_link-nav"> +<RefCard href="/develop/tutorials/multipage/dynamic-navigation"> -<h5>Build a custom navigation menu with `st.page_link`</h5> +<h5>Create a dynamic navigation menu</h5> -Create a dynamic, user-dependant navigation menu to replace the default sidebar navigation. +Create a dynamic, user-dependant navigation menu with `st.navigation`. </RefCard> diff --git a/content/develop/tutorials/multipage-apps/dynamic-navigation.md b/content/develop/tutorials/multipage-apps/dynamic-navigation.md new file mode 100644 index 000000000..e58099a87 --- /dev/null +++ b/content/develop/tutorials/multipage-apps/dynamic-navigation.md @@ -0,0 +1,409 @@ +--- +title: Create a dynamic navigation menu +slug: /develop/tutorials/multipage/dynamic-navigation +description: Streamlit makes it easy to build a custom navigation menu in your multipage app. +--- + +# Create a dynamic navigation menu + +`st.navigation` makes it easy to build dynamic navigation menus. You can change the set of pages passed to `st.navigation` with each rerun, which changes the navigation menu to match. This is a convenient feature for creating custom, role-based navigation menus. + +This tutorial uses `st.navigation` and `st.Page`, which were introduced in Streamlit version 1.36.0. For an older workaround using the `pages/` directory and `st.page_link`, see [Build a custom navigation menu with `st.page_link`](/develop/tutorials/multipage/st.page_link-nav). + +## Applied concepts + +- Use `st.navigation` and `st.Page` to define a multipage app. +- Create a dynamic, role-based navigation menu. + +## Prerequisites + +- The following must be installed in your Python environment: + + ``` + streamlit>=1.36.0 + ``` + +- You should have a clean working directory called `your-repository`. +- You should have a basic understanding of `st.navigation` and `st.Page`. + +## Summary + +In this example, we'll build a dynamic navigation menu for a multipage app that depends on the current user's role. You'll abstract away the use of username and credentials to simplify the example. Instead, you'll use a selectbox to let users choose a role and log in. + +The entrypoint file, `streamlit_app.py` will handle user authentication. The other pages will be stubs representing account management (`settings.py`) and specific pages associated to three roles: Requester, Responder, and Admin. Requesters can access the account and request pages. Responders can access the account and respond pages. Admins can access all pages. + +Here's a look at what we'll build: + +<Collapse title="Complete code" expanded={false}> + +**Directory structure:** + +``` +your-repository/ +β”œβ”€β”€ admin +β”‚ β”œβ”€β”€ admin_1.py +β”‚ └── admin_2.py +β”œβ”€β”€ images +β”‚ β”œβ”€β”€ horizontal_blue.png +β”‚ └── icon_blue.png +β”œβ”€β”€ request +β”‚ β”œβ”€β”€ request_1.py +β”‚ └── request_2.py +β”œβ”€β”€ respond +β”‚ β”œβ”€β”€ respond_1.py +β”‚ └── respond_2.py +β”œβ”€β”€ settings.py +└── streamlit_app.py +``` + +**`streamlit_app.py`:** + +```python +import streamlit as st + +if "role" not in st.session_state: + st.session_state.role = None + +ROLES = [None, "Requester", "Responder", "Admin"] + + +def login(): + + st.header("Log in") + role = st.selectbox("Choose your role", ROLES) + + if st.button("Log in"): + st.session_state.role = role + st.rerun() + + +def logout(): + st.session_state.role = None + st.rerun() + + +role = st.session_state.role + +logout_page = st.Page(logout, title="Log out", icon=":material/logout:") +settings = st.Page("settings.py", title="Settings", icon=":material/settings:") +request_1 = st.Page( + "request/request_1.py", + title="Request 1", + icon=":material/help:", + default=(role == "Requester"), +) +request_2 = st.Page( + "request/request_2.py", title="Request 2", icon=":material/bug_report:" +) +respond_1 = st.Page( + "respond/respond_1.py", + title="Respond 1", + icon=":material/healing:", + default=(role == "Responder"), +) +respond_2 = st.Page( + "respond/respond_2.py", title="Respond 2", icon=":material/handyman:" +) +admin_1 = st.Page( + "admin/admin_1.py", + title="Admin 1", + icon=":material/person_add:", + default=(role == "Admin"), +) +admin_2 = st.Page("admin/admin_2.py", title="Admin 2", icon=":material/security:") + +account_pages = [logout_page, settings] +request_pages = [request_1, request_2] +respond_pages = [respond_1, respond_2] +admin_pages = [admin_1, admin_2] + +st.title("Request manager") +st.logo("images/horizontal_blue.png", icon_image="images/icon_blue.png") + +page_dict = {} +if st.session_state.role in ["Requester", "Admin"]: + page_dict["Request"] = request_pages +if st.session_state.role in ["Responder", "Admin"]: + page_dict["Respond"] = respond_pages +if st.session_state.role == "Admin": + page_dict["Admin"] = admin_pages + +if len(page_dict) > 0: + pg = st.navigation({"Account": account_pages} | page_dict) +else: + pg = st.navigation([st.Page(login)]) + +pg.run() +``` + +</Collapse> + +<Cloud name="doc-dynamic-navigation" height="600px" /> + +## Build the example + +### Initialize your app + +1. In `your_repository`, create a file named `streamlit_app.py`. +1. In a terminal, change directories to `your_repository` and start your app. + + ```bash + streamlit run streamlit_app.py + ``` + + Your app will be blank since you still need to add code. + +1. In `streamlit_app.py`, write the following: + + ```python + import streamlit as st + ``` + +1. Save your `streamlit_app.py` file and view your running app. +1. Click "**Always rerun**" or hit your "**A**" key in your running app. + + Your running preview will automatically update as you save changes to `streamlit_app.py`. Your preview will still be blank. Return to your code. + +### Add your page and image files + +1. In `your_repositoy`, create a file named `settings.py`. + +1. In `settings.py` add the following stub. + + ```python + import streamlit as st + + st.header("Settings") + st.write(f"You are logged in as {st.session_state.role}.") + ``` + + In later steps, you'll create an authentication method that saves the current user's role to `st.session_state.role`. Since you'll be blocking access to this page until a user is logged in, you don't need to initialize the `"role"` key in Session State for this page. + +1. Create similar stubs by changing the value of `st.header` for the following six pages: + + ``` + your-repository/ + β”œβ”€β”€ admin + β”‚ β”œβ”€β”€ admin_1.py + β”‚ └── admin_2.py + β”œβ”€β”€ request + β”‚ β”œβ”€β”€ request_1.py + β”‚ └── request_2.py + └── respond + β”œβ”€β”€ respond_1.py + └── respond_2.py + ``` + + For example, `admin/admin_1.py` should be the following: + + ```python + import streamlit as st + + st.header("Admin 1") + st.write(f"You are logged in as {st.session_state.role}.") + ``` + +1. Create an `images` subdirectory in `your-repository` and add the following two files: + + - [horizontal_blue.png](/images/horizontal_blue.png) + - [icon_blue.png](/images/icon_blue.png) + + You now have all the files needed to build your app. + +### Initialize global values + +1. Return to `streamlit_app.py` and initialize `"role"` in Session State. + + ```python + if "role" not in st.session_state: + st.session_state.role = None + ``` + + You will use this value to gatekeep access to your app. This represents the role of the current, authenticated user. + +1. Define the available roles. + + ```python + ROLES = [None, "Requester", "Responder", "Admin"] + ``` + + `None` is included as a role since that is the value corresponding to an unauthenticated user. + +### Define your user authentication pages + +`st.navigation` lets you define pages from Python functions. Here, you'll define the login and logout pages from Python functions. + +1. Begin your login page (function definition). + + ```python + def login(): + ``` + +1. Add a header for the page. + + ```python + st.header("Log in") + ``` + +1. Create a selectbox for the user to choose a role. + + ```python + role = st.selectbox("Choose your role", ROLES) + ``` + +1. Add a button to commit the user role to Session State. + + ```python + if st.button("Log in"): + st.session_state.role = role + st.rerun() + ``` + + This is an abstraction of an authentication workflow. When a user clicks the button, Streamlit saves the role to Session State and reruns the app. In later steps, you'll add logic to direct users to a role's default page when the value changes in `st.session_state.role`. This completes your login page function. + +1. Begin your logout page (function definition). + + ```python + def logout(): + ``` + +1. Immediately set the role to `None` and rerun the app. + + ```python + st.session_state.role = None + st.rerun() + ``` + + Since the lougout page function immediately updates Session State and reruns, a user will never view this page. The page will execute in a fraction of a second and, upon rerunning, the app will send the user to the login page. Therefore, no additional elements are rendered on the page. If desired, you can change this page to also include a button, similar to the login page. A button would allow users to confirm they really intend to log out. + +### Define all your pages + +1. As a convenience, save `st.session_state.role` to a variable. + + ```python + role = st.session_state.role + ``` + +1. Define your account pages. + + ```python + logout_page = st.Page(logout, title="Log out", icon=":material/logout:") + settings = st.Page("settings.py", title="Settings", icon=":material/settings:") + ``` + + This gives each page a nice title and icon to make your navigation menu look neat and clean. + +1. Define your request pages. + + ```python + request_1 = st.Page( + "request/request_1.py", + title="Request 1", + icon=":material/help:", + default=(role == "Requester"), + ) + request_2 = st.Page( + "request/request_2.py", title="Request 2", icon=":material/bug_report:" + ) + ``` + + If you don't manually declare a default page in `st.navigation`, then the first page will automatically be the default. The first page in the menu will be "Log out" within an "Account" section of the menu. Therefore, you'll need to tell Streamlit what page each user should be directed to by default. + + This code dynamically sets `default=True` when the role is "Requester" and sets it to `False`, otherwise. + +1. Define your remaining pages. + + ```python + respond_1 = st.Page( + "respond/respond_1.py", + title="Respond 1", + icon=":material/healing:", + default=(role == "Responder"), + ) + respond_2 = st.Page( + "respond/respond_2.py", title="Respond 2", icon=":material/handyman:" + ) + admin_1 = st.Page( + "admin/admin_1.py", + title="Admin 1", + icon=":material/person_add:", + default=(role == "Admin"), + ) + admin_2 = st.Page("admin/admin_2.py", title="Admin 2", icon=":material/security:") + ``` + + Similar to the request pages, the `default` parameter is set for the other roles' default pages. + +1. Group your pages into convenient lists. + + ```python + account_pages = [logout_page, settings] + request_pages = [request_1, request_2] + respond_pages = [respond_1, respond_2] + admin_pages = [admin_1, admin_2] + ``` + + These are all the pages available to logged-in users. + +### Define your common elements and navigation + +1. Add a title to show on all pages. + + ```python + st.title("Request manager") + ``` + + Since you're calling the title command in your entrypoint file, this title will be visible on all pages. Elements created in your entrypoint file create a frame of common elements around all your pages. + +1. Add a logo to your app. + + ```python + st.logo("images/horizontal_blue.png", icon_image="images/icon_blue.png") + ``` + + Once again, since you're calling this command in your entrypoint file, you won't need to also call it within each page. + +1. Initialize a dictionary of page lists. + + ```python + page_dict = {} + ``` + + In the next step, you'll check the user's role and add pages to the dictionary that the user is allowed to access. When `st.navigation` receives a dictionary of page lists, it creates a navigation menu with groups of pages and section headers. + +1. Build the dictionary of allowed pages by checking the user's role. + + ```python + if st.session_state.role in ["Requester", "Admin"]: + page_dict["Request"] = request_pages + if st.session_state.role in ["Responder", "Admin"]: + page_dict["Respond"] = respond_pages + if st.session_state.role == "Admin": + page_dict["Admin"] = admin_pages + ``` + +1. Check if the user is allowed to access any pages and add the account pages if they are. + + ```python + if len(page_dict) > 0: + pg = st.navigation({"Account": account_pages} | page_dict) + ``` + + If `page_dict` is not empty, then the user is logged in. The `|` operator merges the two dictionaries, adding the account pages to the beginning. + +1. Fallback to the login page if the user isn't logged in. + + ```python + else: + pg = st.navigation([st.Page(login)]) + ``` + +1. Execute the page returned by `st.navigation`. + + ```python + pg.run() + ``` + +1. Save your `streamlit_app.py` file and view your app! + + Try logging in, switching pages, and logging out. Try again with a different role. diff --git a/content/menu.md b/content/menu.md index bbe58282f..baae93671 100644 --- a/content/menu.md +++ b/content/menu.md @@ -49,12 +49,6 @@ site_menu: url: /develop/concepts/architecture/app-chrome - category: Develop / Concepts / Architecture & execution / Caching url: /develop/concepts/architecture/caching - - category: Develop / Concepts / Architecture & execution / Optimize performance with st.cache - url: /develop/concepts/architecture/st.cache - visible: false - - category: Develop / Concepts / Architecture & execution / Experimental cache primitives - url: /develop/concepts/architecture/experimental-cache-primitives - visible: false - category: Develop / Concepts / Architecture & execution / Session State url: /develop/concepts/architecture/session-state - category: Develop / Concepts / Architecture & execution / Forms @@ -65,8 +59,14 @@ site_menu: url: /develop/concepts/architecture/widget-behavior - category: Develop / Concepts / Multipage apps url: /develop/concepts/multipage-apps - - category: Develop / Concepts / Multipage apps / Pages directory (v1) + - category: Develop / Concepts / Multipage apps / Overview + url: /develop/concepts/multipage-apps/overview + - category: Develop / Concepts / Multipage apps / Page and navigation + url: /develop/concepts/multipage-apps/page-and-navigation + - category: Develop / Concepts / Multipage apps / Pages directory url: /develop/concepts/multipage-apps/pages-directory + - category: Develop / Concepts / Multipage apps / Working with widgets + url: /develop/concepts/multipage-apps/widgets - category: Develop / Concepts / App design url: /develop/concepts/design - category: Develop / Concepts / App design / Animate & update elements @@ -452,6 +452,12 @@ site_menu: - category: Develop / API reference / APPLICATION LOGIC - category: Develop / API reference / Navigation and pages url: /develop/api-reference/navigation + - category: Develop / API reference / Navigation and pages / st.navigation + url: /develop/api-reference/navigation/st.navigation + isVersioned: true + - category: Develop / API reference / Navigation and pages / st.Page + url: /develop/api-reference/navigation/st.page + isVersioned: true - category: Develop / API reference / Navigation and pages / st.page_link url: https://docs.streamlit.io/develop/api-reference/widgets/st.page_link isVersioned: true @@ -491,10 +497,6 @@ site_menu: - category: Develop / API reference / Caching and state / st.cache_resource url: /develop/api-reference/caching-and-state/st.cache_resource isVersioned: true - - category: Develop / API reference / Caching and state / st.cache - url: /develop/api-reference/caching-and-state/st.cache - isVersioned: true - isDeprecated: true - category: Develop / API reference / Caching and state / st.experimental_memo url: /develop/api-reference/caching-and-state/st.experimental_memo isVersioned: true @@ -666,8 +668,11 @@ site_menu: url: /develop/tutorials/databases/tigergraph - category: Develop / Tutorials / Multipage apps url: /develop/tutorials/multipage + - category: Develop / Tutorials / Multipage apps / Dynamic navigation + url: /develop/tutorials/multipage/dynamic-navigation - category: Develop / Tutorials / Multipage apps / Build navigation with st.page_link url: /develop/tutorials/multipage/st.page_link-nav + visible: false - category: Develop / Tutorials / Work with LLMs url: /develop/tutorials/llms - category: Develop / Tutorials / Work with LLMs / Build a basic LLM chat app diff --git a/pages/index.js b/pages/index.js index 6b00c6369..0bf6aace4 100644 --- a/pages/index.js +++ b/pages/index.js @@ -192,66 +192,66 @@ export default function Home({ window, menu }) { <TileContainer> <RefCard size="third" - href="/develop/api-reference/data/st.dataframe" + href="/develop/concepts/multipage-apps/overview" > - <i className="material-icons-sharp">table_chart</i> - <h4>Row and column selections</h4> + <i className="material-icons-sharp">auto_stories</i> + <h4>Multipage apps v2</h4> <p> - Get row and column selections from users to make your - dataframes even more interactive. + Introducing <code>st.navigation</code> and{" "} + <code>st.Page</code>, the new, preferred way to declare + multipage apps! </p> </RefCard> <RefCard size="third" - href="/develop/api-reference/charts/st.plotly_chart" + href="/develop/api-reference/charts/st.bar_chart" > - <i className="material-icons-sharp">query_stats</i> - <h4>Chart selections</h4> + <i className="material-icons-sharp">align_horizontal_left</i> + <h4>Horizontal bar charts</h4> <p> - Make your charts more dynamic by using point selections in - Plotly, Altair, and Vega-Lite charts. - </p> - </RefCard> - <RefCard size="third" href="/develop/api-reference/media/st.logo"> - <i className="material-icons-sharp">diamond</i> - <h4>App logos</h4> - <p> - Add a logo to your app with <code>st.logo</code>. + Create horizontal bar charts with <code>st.bar_chart</code>. </p> </RefCard> <RefCard size="third" - href="/develop/api-reference/widgets/st.page_link" + href="/develop/api-reference/layout/st.expander" > <i className="material-icons-sharp">info</i> - <h4>Google Material Symbols</h4> + <h4>Icons for expanders</h4> <p> - <code>st.page_link</code> now supports Material Symbols as a - page icon. + Add icons to your <code>st.expander</code> labels. </p> </RefCard> <RefCard size="third" - href="/develop/api-reference/execution-flow/st.dialog" + href="/develop/api-reference/layout/st.columns" > - <i className="material-icons-sharp">crop_7_5</i> - <h4>Modal dialogs</h4> + <i className="material-icons-sharp">align_vertical_bottom</i> + <h4>Vertical alignment</h4> <p> - Introducing <code>st.experimental_dialog</code> to create - modal dialogs that can rerun independently from the rest of - your app. + Set the vertical alignment for <code>st.columns</code>. </p> </RefCard> <RefCard size="third" - href="/develop/api-reference/text/st.markdown" + href="/develop/api-reference/charts/st.line_chart" > - <i className="material-icons-sharp">highlight</i> - <h4>Markdown support for text highlighting</h4> + <i className="material-icons-sharp">show_chart</i> + <h4>Axis labels</h4> <p> - You can set the background color for you text in markdown. + <code>st.area_chart</code>, <code>st.bar_chart</code>,{" "} + <code>st.line_chart</code>, and <code>st.scatter_chart</code>{" "} + let you set axis labels. </p> </RefCard> + <RefCard + size="third" + href="https://github.com/streamlit/streamlit/pull/8633" + > + <i className="material-icons-sharp">call</i> + <h4>Custom component callbacks</h4> + <p>Custom components now support callback functions.</p> + </RefCard> {/* <Tile size="half" background="unset" diff --git a/public/_redirects b/public/_redirects index 84401085d..f71c8cbfb 100644 --- a/public/_redirects +++ b/public/_redirects @@ -887,7 +887,6 @@ /library/api-reference/performance/st.cache_resource.clear /develop/api-reference/caching-and-state/st.cache_resource /library/api-reference/performance/st.experimental_memo.clear /develop/api-reference/caching-and-state/st.experimental_memo /library/api-reference/performance/st.experimental_singleton.clear /develop/api-reference/caching-and-state/st.experimental_singleton -/st.connections.snowflakeconnection-configuration /develop/api-reference/connections/st.connections.snowflakeconnection#configuration /knowledge-base/deploy/how-to-delete-your-streamlit-community-cloud-account /deploy/streamlit-community-cloud/manage-your-account/delete-your-account /knowledge-base/deploy/how-to-update-account-admin-settings-on-streamlit-community-cloud /deploy/streamlit-community-cloud/get-started/explore-your-workspace#invite-other-developers-to-your-workspace /knowledge-base/deploy/custom-subdomains /deploy/streamlit-community-cloud/deploy-your-app#custom-subdomains @@ -1133,4 +1132,12 @@ /knowledge-base/components/how-streamlit-components-differ-base-package /develop/concepts/custom-components/limitations /knowledge-base/components/not-possibe-streamlit-components /develop/concepts/custom-components/limitations /deploy/streamlit-community-cloud/troubleshooting /deploy/streamlit-community-cloud/status -/knowledge-base/using-streamlit/how-to-get-row-selections /develop/tutorials/elements/dataframe-row-selections \ No newline at end of file +/knowledge-base/using-streamlit/how-to-get-row-selections /develop/tutorials/elements/dataframe-row-selections +/develop/concepts/architecture/st.cache /develop/concepts/architecture/caching +/develop/concepts/architecture/experimental-cache-primitives /develop/concepts/architecture/caching +/develop/api-reference/caching-and-state/st.cache /develop/api-reference/caching-and-state/st.cache_data + +# Deep links included in streamlit/streamlit source code +/st.connections.snowflakeconnection-configuration /develop/api-reference/connections/st.connections.snowflakeconnection#configuration +/st.page.automatic-page-labels /develop/concepts/multipage-apps/overview#how-streamlit-converts-filenames-into-labels-and-titles +/st.page.automatic-page-urls /develop/concepts/multipage-apps/overview#how-streamlit-converts-filenames-into-url-pathnames \ No newline at end of file diff --git a/public/images/api/navigation.jpg b/public/images/api/navigation.jpg new file mode 100644 index 000000000..4e8e23e5e Binary files /dev/null and b/public/images/api/navigation.jpg differ diff --git a/public/images/api/page.jpg b/public/images/api/page.jpg new file mode 100644 index 000000000..e7b7195ff Binary files /dev/null and b/public/images/api/page.jpg differ diff --git a/public/images/horizontal_blue.png b/public/images/horizontal_blue.png new file mode 100644 index 000000000..05a00969d Binary files /dev/null and b/public/images/horizontal_blue.png differ diff --git a/public/images/icon_blue.png b/public/images/icon_blue.png new file mode 100644 index 000000000..96bce1171 Binary files /dev/null and b/public/images/icon_blue.png differ diff --git a/public/images/mpa-page-not-found.png b/public/images/mpa-page-not-found.png index d05e68cb5..b47a67d75 100644 Binary files a/public/images/mpa-page-not-found.png and b/public/images/mpa-page-not-found.png differ diff --git a/public/images/mpa-v2-page-sections.jpg b/public/images/mpa-v2-page-sections.jpg new file mode 100644 index 000000000..f31691e8c Binary files /dev/null and b/public/images/mpa-v2-page-sections.jpg differ diff --git a/public/images/mpa-v2-use-set-page-config.jpg b/public/images/mpa-v2-use-set-page-config.jpg new file mode 100644 index 000000000..9ea327dfd Binary files /dev/null and b/public/images/mpa-v2-use-set-page-config.jpg differ diff --git a/public/images/page_parts.jpg b/public/images/page_parts.jpg new file mode 100644 index 000000000..0792ff8da Binary files /dev/null and b/public/images/page_parts.jpg differ diff --git a/python/api-examples-source/charts.video3/requirements.txt b/python/api-examples-source/charts.video3/requirements.txt index b98577ed0..d6ec53ffe 100644 --- a/python/api-examples-source/charts.video3/requirements.txt +++ b/python/api-examples-source/charts.video3/requirements.txt @@ -1,2 +1,2 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 webvtt-py \ No newline at end of file diff --git a/python/api-examples-source/execution.fragment.py b/python/api-examples-source/execution.fragment.py index 03dd9791b..e2f7fa183 100644 --- a/python/api-examples-source/execution.fragment.py +++ b/python/api-examples-source/execution.fragment.py @@ -1,7 +1,7 @@ import streamlit as st -if "script_runs" not in st.session_state: - st.session_state.script_runs = 0 +if "app_runs" not in st.session_state: + st.session_state.app_runs = 0 st.session_state.fragment_runs = 0 @@ -12,8 +12,8 @@ def fragment(): st.write(f"Fragment says it ran {st.session_state.fragment_runs} times.") -st.session_state.script_runs += 1 +st.session_state.app_runs += 1 fragment() -st.button("Rerun full script") -st.write(f"Full script says it ran {st.session_state.script_runs} times.") -st.write(f"Full script sees that fragment ran {st.session_state.fragment_runs} times.") +st.button("Rerun full app") +st.write(f"Full app says it ran {st.session_state.app_runs} times.") +st.write(f"Full app sees that fragment ran {st.session_state.fragment_runs} times.") diff --git a/python/api-examples-source/guides/requirements.txt b/python/api-examples-source/guides/requirements.txt index 9e4fed292..928232198 100644 --- a/python/api-examples-source/guides/requirements.txt +++ b/python/api-examples-source/guides/requirements.txt @@ -1 +1 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/api-examples-source/hello/requirements.txt b/python/api-examples-source/hello/requirements.txt index 7b098c8ad..ce484d763 100644 --- a/python/api-examples-source/hello/requirements.txt +++ b/python/api-examples-source/hello/requirements.txt @@ -8,4 +8,4 @@ numpy==1.23.5 scipy altair==4.2.0 pydeck==0.8.0 -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/api-examples-source/mpa-hello/requirements.txt b/python/api-examples-source/mpa-hello/requirements.txt index f7ce5752f..c4cfed0d0 100644 --- a/python/api-examples-source/mpa-hello/requirements.txt +++ b/python/api-examples-source/mpa-hello/requirements.txt @@ -4,4 +4,4 @@ scipy altair==4.2.0 pydeck==0.8.0 opencv-python-headless==4.6.0.66 -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/api-examples-source/requirements.txt b/python/api-examples-source/requirements.txt index 72b587ff4..dcdf997d0 100644 --- a/python/api-examples-source/requirements.txt +++ b/python/api-examples-source/requirements.txt @@ -11,4 +11,4 @@ pydeck==0.8.0 Faker==19.1.0 openai==1.3.0 vega_datasets -streamlit-nightly +streamlit==1.36.0 diff --git a/python/api-examples-source/st-experimental-connection/1.22/st-experimental-connection/requirements.txt b/python/api-examples-source/st-experimental-connection/1.22/st-experimental-connection/requirements.txt index bedafb5f6..b1577d99d 100644 --- a/python/api-examples-source/st-experimental-connection/1.22/st-experimental-connection/requirements.txt +++ b/python/api-examples-source/st-experimental-connection/1.22/st-experimental-connection/requirements.txt @@ -1,4 +1,4 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 toml sqlalchemy==1.4 duckdb diff --git a/python/api-examples-source/theming/requirements.txt b/python/api-examples-source/theming/requirements.txt index 8346c69a5..f17cd79c1 100644 --- a/python/api-examples-source/theming/requirements.txt +++ b/python/api-examples-source/theming/requirements.txt @@ -1,4 +1,4 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 vega_datasets altair==4.2.0 plotly==5.13.0 \ No newline at end of file diff --git a/python/api-examples-source/tutorials/custom-navigation/requirements.txt b/python/api-examples-source/tutorials/custom-navigation/requirements.txt index 9e4fed292..928232198 100644 --- a/python/api-examples-source/tutorials/custom-navigation/requirements.txt +++ b/python/api-examples-source/tutorials/custom-navigation/requirements.txt @@ -1 +1 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/api-examples-source/tutorials/dynamic-navigation/streamlit_app.py b/python/api-examples-source/tutorials/dynamic-navigation/streamlit_app.py index f0bcc0c31..596a88ee6 100644 --- a/python/api-examples-source/tutorials/dynamic-navigation/streamlit_app.py +++ b/python/api-examples-source/tutorials/dynamic-navigation/streamlit_app.py @@ -3,19 +3,13 @@ if "role" not in st.session_state: st.session_state.role = None -DEFAULT_PAGES = { - None: None, - "Requester": "request/request_1.py", - "Responder": "respond/respond_1.py", - "Admin": "admin/admin_1.py", -} +ROLES = [None, "Requester", "Responder", "Admin"] def login(): - roles = DEFAULT_PAGES.keys() st.header("Log in") - role = st.selectbox("Choose your role", roles) + role = st.selectbox("Choose your role", ROLES) if st.button("Log in"): st.session_state.role = role @@ -35,7 +29,7 @@ def logout(): "request/request_1.py", title="Request 1", icon=":material/help:", - default=(DEFAULT_PAGES[role] == "request/request_1.py"), + default=(role == "Requester"), ) request_2 = st.Page( "request/request_2.py", title="Request 2", icon=":material/bug_report:" @@ -44,7 +38,7 @@ def logout(): "respond/respond_1.py", title="Respond 1", icon=":material/healing:", - default=(DEFAULT_PAGES[role] == "respond/respond_1.py"), + default=(role == "Responder"), ) respond_2 = st.Page( "respond/respond_2.py", title="Respond 2", icon=":material/handyman:" @@ -53,7 +47,7 @@ def logout(): "admin/admin_1.py", title="Admin 1", icon=":material/person_add:", - default=(DEFAULT_PAGES[role] == "admin/admin_1.py"), + default=(role == "Admin"), ) admin_2 = st.Page("admin/admin_2.py", title="Admin 2", icon=":material/security:") @@ -65,7 +59,7 @@ def logout(): st.title("Request manager") st.logo( "python/api-examples-source/tutorials/dynamic-navigation/images/horizontal_blue.png", - icon_image="python/api-examples-source/tutorials/dynamic-navigation/images/icon_blue.png" + icon_image="python/api-examples-source/tutorials/dynamic-navigation/images/icon_blue.png", ) page_dict = {} @@ -81,4 +75,4 @@ def logout(): else: pg = st.navigation([st.Page(login)]) -pg.run() \ No newline at end of file +pg.run() diff --git a/python/api-examples-source/tutorials/elements/charts/requirements.txt b/python/api-examples-source/tutorials/elements/charts/requirements.txt index 05bd5108b..fc17dc996 100644 --- a/python/api-examples-source/tutorials/elements/charts/requirements.txt +++ b/python/api-examples-source/tutorials/elements/charts/requirements.txt @@ -1,2 +1,2 @@ vega_datasets -streamlit==1.35.0 \ No newline at end of file +streamlit==1.36.0 \ No newline at end of file diff --git a/python/api-examples-source/tutorials/elements/dataframes/requirements.txt b/python/api-examples-source/tutorials/elements/dataframes/requirements.txt index d17d4fd86..36c8f202e 100644 --- a/python/api-examples-source/tutorials/elements/dataframes/requirements.txt +++ b/python/api-examples-source/tutorials/elements/dataframes/requirements.txt @@ -1,2 +1,2 @@ Faker -streamlit==1.35.0 \ No newline at end of file +streamlit==1.36.0 \ No newline at end of file diff --git a/python/api-examples-source/tutorials/requirements.txt b/python/api-examples-source/tutorials/requirements.txt index 9e4fed292..928232198 100644 --- a/python/api-examples-source/tutorials/requirements.txt +++ b/python/api-examples-source/tutorials/requirements.txt @@ -1 +1 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/api-examples-source/utilities.html.py b/python/api-examples-source/utilities.html.py index 4e72600e9..d03f75974 100644 --- a/python/api-examples-source/utilities.html.py +++ b/python/api-examples-source/utilities.html.py @@ -1,11 +1,3 @@ import streamlit as st -code = """ -<style> - p { - color: red; - } -</style> -""" -st.html(code) -st.markdown("Lorem ipsum") +st.html("<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>") diff --git a/python/api-examples-source/utilities.switch_page/requirements.txt b/python/api-examples-source/utilities.switch_page/requirements.txt index 9e4fed292..928232198 100644 --- a/python/api-examples-source/utilities.switch_page/requirements.txt +++ b/python/api-examples-source/utilities.switch_page/requirements.txt @@ -1 +1 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/api-examples-source/widget.page_link/requirements.txt b/python/api-examples-source/widget.page_link/requirements.txt index 9e4fed292..928232198 100644 --- a/python/api-examples-source/widget.page_link/requirements.txt +++ b/python/api-examples-source/widget.page_link/requirements.txt @@ -1 +1 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 diff --git a/python/generate.py b/python/generate.py index 717383cb4..a730e9127 100644 --- a/python/generate.py +++ b/python/generate.py @@ -23,6 +23,8 @@ from streamlit.elements.plotly_chart import PlotlyState, PlotlySelectionState from streamlit.elements.vega_charts import VegaLiteState from streamlit.elements.arrow import DataframeState, DataframeSelectionState +from streamlit.navigation import page +from streamlit.navigation.page import StreamlitPage VERSION = streamlit.__version__ DEBUG = False @@ -125,7 +127,6 @@ def get_attribute_dict_dict(obj, objname, signature_prefix=None): description = {} # Get the object's docstring or an empty string if it doesn't have one docstring = getattr(obj, "__doc__", "") - docstring = docstring.replace(" Attributes\n", " Parameters\n") # Set the object's name description["name"] = objname if signature_prefix is None: @@ -264,7 +265,8 @@ def get_docstring_dict( arguments = get_sig_string_without_annots(obj) if arguments is None: arguments = "" - description["signature"] = f"{signature_prefix}.{objname}({arguments})" + # Strip "." in case key_prefix=="" + description["signature"] = f"{signature_prefix}.{objname}({arguments})".strip(".") description["is_class"] = True # Get the class's methods methods = inspect.getmembers(obj, inspect.isfunction) @@ -446,6 +448,9 @@ def get_obj_docstring_dict(obj, key_prefix, signature_prefix, only_include=None) # Iterate over the names of the members of the object for membername in dir(obj): + if DEBUG > 1: + print(f"Looking up {membername}") + # Skip members starting with an underscore if membername.startswith("_"): continue @@ -478,7 +483,8 @@ def get_obj_docstring_dict(obj, key_prefix, signature_prefix, only_include=None) is_class_method=False, is_property=True, ) - fullname = "{}.{}".format(key_prefix, membername) + # Strip "." in case key_prefix=="" + fullname = f"{key_prefix}.{membername}".strip(".") obj_docstring_dict[fullname] = member_docstring_dict else: # Skip members that are not callable @@ -487,12 +493,14 @@ def get_obj_docstring_dict(obj, key_prefix, signature_prefix, only_include=None) # memo and singleton are callable objects rather than functions # See: https://github.com/streamlit/streamlit/pull/4263 - # Replace the member with its decorator object - while member in streamlit.runtime.caching.__dict__.values(): + # Replace the member with its decorator object except st.cache + # which is deprecated + while (member in streamlit.runtime.caching.__dict__.values() and member != streamlit.cache): member = member._decorator # Create the full name of the member using key_prefix and membername - fullname = "{}.{}".format(key_prefix, membername) + # Strip "." in case key_prefix=="" + fullname = f"{key_prefix}.{membername}".strip(".") # Call get_function_docstring_dict to get metadata of the current member is_class = inspect.isclass( @@ -573,8 +581,8 @@ def get_streamlit_docstring_dict(): ], streamlit.column_config: ["streamlit.column_config", "st.column_config"], components: ["streamlit.components.v1", "st.components.v1"], - streamlit.delta_generator.DeltaGenerator: ["DeltaGenerator", "element", "add_rows"], # Only store docstring for element.add_rows - StatusContainer: ["StatusContainer", "StatusContainer", "update"], # Only store docstring for StatusContainer.update + streamlit.delta_generator.DeltaGenerator: ["DeltaGenerator", "element", ["add_rows"]], # Only store docstring for element.add_rows + StatusContainer: ["StatusContainer", "StatusContainer", ["update"]], # Only store docstring for StatusContainer.update streamlit.testing.v1: ["streamlit.testing.v1", "st.testing.v1"], AppTest: ["AppTest", "AppTest"], element_tree: [ @@ -583,6 +591,8 @@ def get_streamlit_docstring_dict(): ], streamlit.user_info.UserInfoProxy: ["streamlit.experimental_user", "st.experimental_user"], CachedFunc: ["CachedFunc", "CachedFunc"], + page: ["", "", ["StreamlitPage"]], + StreamlitPage: ["StreamlitPage", "StreamlitPage"], } proxy_obj_key = { streamlit.user_info.UserInfoProxy: ["streamlit.experimental_user", "st.experimental_user"], @@ -600,6 +610,7 @@ def get_streamlit_docstring_dict(): if DEBUG: print(f"Fetching {obj}") module_docstring_dict.update(get_obj_docstring_dict(obj, *key)) + # Proxy objects for obj, key in proxy_obj_key.items(): if DEBUG: print(f"Fetching {obj}") @@ -616,7 +627,6 @@ def get_streamlit_docstring_dict(): if DEBUG: print(f"Fetching {obj}") docstring = getattr(obj, "__doc__", "") - docstring = docstring.replace(" Attributes\n", " Parameters\n") member_docstring_dict = get_attribute_dict_dict(obj, key[0].split(".")[-1]) member_docstring_dict["is_attribute_dict"] = True module_docstring_dict.update({key[0]: member_docstring_dict}) @@ -626,7 +636,7 @@ def get_streamlit_docstring_dict(): if __name__ == "__main__": if len(sys.argv) > 1: VERSION = sys.argv[1] - if len(sys.argv) > 2 and sys.argv[2] == "debug": - DEBUG = True + if len(sys.argv) > 2 and sys.argv[2].isnumeric(): + DEBUG = int(sys.argv[2]) data = get_streamlit_docstring_dict() utils.write_to_existing_dict(VERSION, data) diff --git a/python/streamlit.json b/python/streamlit.json index c1e7bca07..492fe7b5e 100644 --- a/python/streamlit.json +++ b/python/streamlit.json @@ -134231,5 +134231,9882 @@ "returns": [], "is_attribute_dict": true } + }, + "1.36.0": { + "streamlit.Page": { + "name": "Page", + "signature": "st.Page(page, *, title=None, icon=None, url_path=None, default=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ndef page2():\n st.title("Second page")\n\npg = st.navigation([\n st.Page("page1.py", title="First page", icon="\ud83d\udd25"),\n st.Page(page2, title="Second page", icon=":material/favorite:"),\n])\npg.run()\n</pre>\n</blockquote>\n", + "description": "<p>Configure a page for <tt class=\"docutils literal\">st.navigation</tt> in a multipage app.</p>\n<p>Call <tt class=\"docutils literal\">st.Page</tt> to initialize a <tt class=\"docutils literal\">StreamlitPage</tt> object, and pass it to\n<tt class=\"docutils literal\">st.navigation</tt> to declare a page in your app.</p>\n<p>When a user navigates to a page, <tt class=\"docutils literal\">st.navigation</tt> returns the selected\n<tt class=\"docutils literal\">StreamlitPage</tt> object. Call <tt class=\"docutils literal\">StreamlitPage.run()</tt> on the returned page\nto execute the page. You can only run the page returned by\n<tt class=\"docutils literal\">st.navigation</tt>, and you can only run it once per app rerun.</p>\n<p>A page can be defined by a Python file or <tt class=\"docutils literal\">Callable</tt>.</p>\n", + "args": [ + { + "name": "page", + "type_name": "str, Path, or callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The page source as a <tt class=\"docutils literal\">Callable</tt> or path to a Python file. If the page\nsource is defined by a Python file, the path can be a string or\n<tt class=\"docutils literal\">pathlib.Path</tt> object, but must be declared relative to the\nentrypoint file. If the page source is defined by a <tt class=\"docutils literal\">Callable</tt>, the\n<tt class=\"docutils literal\">Callable</tt> can't accept arguments.</p>\n", + "default": null + }, + { + "name": "title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The title of the page. If this is <tt class=\"docutils literal\">None</tt> (default), the page title\n(in the browser tab) and label (in the navigation menu) will be\ninferred from the filename or callable name in <tt class=\"docutils literal\">page</tt>. For more\ninformation, see <a class=\"reference external\" href=\"https://docs.streamlit.io/st.page.automatic-page-labels\">Overview of multipage apps</a>.</p>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the page title and label.\nIf <tt class=\"docutils literal\">icon</tt> is <tt class=\"docutils literal\">None</tt> (default), no icon is displayed next to the\npage label in the navigation menu, and a Streamlit icon is displayed\nnext to the title (in the browser tab). If <tt class=\"docutils literal\">icon</tt> is a string, the\nfollowing options are valid:</p>\n<ul>\n<li><dl class=\"first docutils\">\n<dt>A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt></dt>\n<dd><p class=\"first last\">or <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</dd>\n</dl>\n</li>\n<li><dl class=\"first docutils\">\n<dt>An icon from the Material Symbols library (outlined style) in the</dt>\n<dd><p class=\"first\">format <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p class=\"last\">For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</dd>\n</dl>\n</li>\n</ul>\n", + "default": null + }, + { + "name": "url_path", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The page's URL pathname, which is the path relative to the app's root\nURL. If this is <tt class=\"docutils literal\">None</tt> (default), the URL pathname will be inferred\nfrom the filename or callable name in <tt class=\"docutils literal\">page</tt>. For more information,\nsee <a class=\"reference external\" href=\"https://docs.streamlit.io/st.page.automatic-page-urls\">Overview of multipage apps</a>.</p>\n<p>The default page will have a pathname of <tt class=\"docutils literal\">""</tt>, indicating the root\nURL of the app. If you set <tt class=\"docutils literal\">default=True</tt>, <tt class=\"docutils literal\">url_path</tt> is ignored.</p>\n", + "default": "page" + }, + { + "name": "default", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether this page is the default page to be shown when the app is\nloaded. If <tt class=\"docutils literal\">default</tt> is <tt class=\"docutils literal\">False</tt> (default), the page will have a\nnonempty URL pathname. However, if no default page is passed to\n<tt class=\"docutils literal\">st.navigation</tt> and this is the first page, this page will become the\ndefault page. If <tt class=\"docutils literal\">default</tt> is <tt class=\"docutils literal\">True</tt>, then the page will have\nan empty pathname and <tt class=\"docutils literal\">url_path</tt> will be ignored.</p>\n", + "default": "page" + } + ], + "returns": [ + { + "type_name": "StreamlitPage", + "is_generator": false, + "description": "<p>The page object associated to the given script.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L29" + }, + "streamlit.altair_chart": { + "name": "altair_chart", + "signature": "st.altair_chart(altair_chart, *, use_container_width=False, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nc = (\n alt.Chart(chart_data)\n .mark_circle()\n .encode(x="a", y="b", size="c", color="c", tooltip=["a", "b", "c"])\n)\n\nst.altair_chart(c, use_container_width=True)\n</pre>\n<Cloud name=\"doc-vega-lite-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" /></blockquote>\n", + "description": "<p>Display a chart using the Vega-Altair library.</p>\n<p><a class=\"reference external\" href=\"https://altair-viz.github.io/\">Vega-Altair</a> is a declarative\nstatistical visualization library for Python, based on Vega and\nVega-Lite.</p>\n", + "args": [ + { + "name": "altair_chart", + "type_name": "altair.Chart", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The Altair chart object to display. See\n<a class=\"reference external\" href=\"https://altair-viz.github.io/gallery/\">https://altair-viz.github.io/gallery/</a> for examples of graph\ndescriptions.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets\nthe width of the figure to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The theme of the chart. If <tt class=\"docutils literal\">theme</tt> is <tt class=\"docutils literal\">"streamlit"</tt> (default),\nStreamlit uses its own design default. If <tt class=\"docutils literal\">theme</tt> is <tt class=\"docutils literal\">None</tt>,\nStreamlit falls back to the default behavior of the library.</p>\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string to use for giving this element a stable\nidentity. If <tt class=\"docutils literal\">key</tt> is <tt class=\"docutils literal\">None</tt> (default), this element's identity\nwill be determined based on the values of the other parameters.</p>\n<p>Additionally, if selections are activated and <tt class=\"docutils literal\">key</tt> is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.</p>\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\n<tt class=\"docutils literal\">on_select</tt> can be one of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">"ignore"</tt> (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an input\nwidget.</li>\n<li><tt class=\"docutils literal\">"rerun"</tt>: Streamlit will rerun the app when the user selects\ndata in the chart. In this case, <tt class=\"docutils literal\">st.altair_chart</tt> will return\nthe selection data as a dictionary.</li>\n<li>A <tt class=\"docutils literal\">callable</tt>: Streamlit will rerun the app and execute the\n<tt class=\"docutils literal\">callable</tt> as a callback function before the rest of the app.\nIn this case, <tt class=\"docutils literal\">st.altair_chart</tt> will return the selection data\nas a dictionary.</li>\n</ul>\n<p>To use selection events, the object passed to <tt class=\"docutils literal\">altair_chart</tt> must\ninclude selection paramters. To learn about defining interactions\nin Altair and how to declare selection-type parameters, see\n<a class=\"reference external\" href=\"https://altair-viz.github.io/user_guide/interactions.html\">Interactive Charts</a>\nin Altair's documentation.</p>\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "str or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The selection parameters Streamlit should use. If\n<tt class=\"docutils literal\">selection_mode</tt> is <tt class=\"docutils literal\">None</tt> (default), Streamlit will use all\nselection parameters defined in the chart's Altair spec.</p>\n<p>When Streamlit uses a selection parameter, selections from that\nparameter will trigger a rerun and be included in the selection\nstate. When Streamlit does not use a selection parameter,\nselections from that parameter will not trigger a rerun and not be\nincluded in the selection state.</p>\n<p>Selection parameters are identified by their <tt class=\"docutils literal\">name</tt> property.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "<p>If <tt class=\"docutils literal\">on_select</tt> is <tt class=\"docutils literal\">"ignore"</tt> (default), this method returns an\ninternal placeholder for the chart element that can be used with\nthe <tt class=\"docutils literal\">.add_rows()</tt> method. Otherwise, this method returns a\ndictionary-like object that supports both key and attribute\nnotation. The attributes are described by the <tt class=\"docutils literal\">VegaLiteState</tt>\ndictionary schema.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L1400" + }, + "streamlit.area_chart": { + "name": "area_chart", + "signature": "st.area_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, width=None, height=None, use_container_width=True)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.area_chart(chart_data)\n</pre>\n<Cloud name=\"doc-area-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>You can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": np.random.randn(20),\n "col2": np.random.randn(20),\n "col3": np.random.choice(["A", "B", "C"], 20),\n }\n)\n\nst.area_chart(chart_data, x="col1", y="col2", color="col3")\n</pre>\n<Cloud name=\"doc-area-chart1\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>Finally, if your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple series with different\ncolors:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["col1", "col2", "col3"])\n\nst.area_chart(\n chart_data, x="col1", y=["col2", "col3"], color=["#FF0000", "#0000FF"] # Optional\n)\n</pre>\n<Cloud name=\"doc-area-chart2\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /></blockquote>\n", + "description": "<p>Display an area chart.</p>\n<p>This is syntax-sugar around <tt class=\"docutils literal\">st.altair_chart</tt>. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.</p>\n<p>If <tt class=\"docutils literal\">st.area_chart</tt> does not guess the data specification\ncorrectly, try specifying your desired chart using <tt class=\"docutils literal\">st.altair_chart</tt>.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Data to be plotted.</p>\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name or key associated to the x-axis data. If <tt class=\"docutils literal\">x</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit uses the data index for the x-axis\nvalues.</p>\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name(s) or key(s) associated to the y-axis data. If this is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a <tt class=\"docutils literal\">Sequence</tt> of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.</p>\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the x-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name specified in <tt class=\"docutils literal\">x</tt> if available, or else\nno label will be displayed.</p>\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the y-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name(s) specified in <tt class=\"docutils literal\">y</tt> if available, or\nelse no label will be displayed.</p>\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The color to use for different series in this chart.</p>\n<p>For an area chart with just 1 series, this can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default color.</li>\n<li>A hex string like "#ffaa00" or "#ffaa0088".</li>\n<li>An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.</li>\n</ul>\n<p>For an area chart with multiple series, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:</p>\n<ul>\n<li><p class=\"first\">None, to use the default colors.</p>\n</li>\n<li><p class=\"first\">The name of a column in the dataset. Data points will be grouped\ninto series of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.</p>\n<p>For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three series whose colors will be\nautomatically selected from the default palette.</p>\n<p>But, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into 3 series, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.</p>\n</li>\n</ul>\n<p>For an area chart with multiple series, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default colors.</li>\n<li>A list of string colors or color tuples to be used for each of\nthe series in the chart. This list should have the same length\nas the number of y values (e.g. <tt class=\"docutils literal\"><span class=\"pre\">color=["#fd0",</span> "#f0f", "#04f"]</tt>\nfor three lines).</li>\n</ul>\n", + "default": "color" + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired width of the chart expressed in pixels. If <tt class=\"docutils literal\">width</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If <tt class=\"docutils literal\">width</tt> is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.</p>\n<p>To use <tt class=\"docutils literal\">width</tt>, you must set <tt class=\"docutils literal\">use_container_width=False</tt>.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the chart expressed in pixels. If <tt class=\"docutils literal\">height</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt> (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>,\nStreamlit sets the chart's width according to <tt class=\"docutils literal\">width</tt>.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L756" + }, + "streamlit.audio": { + "name": "audio", + "signature": "st.audio(data, format=\"audio/wav\", start_time=0, *, sample_rate=None, end_time=None, loop=False, autoplay=False)", + "examples": "<blockquote>\n<p>To display an audio player for a local file, specify the file's string\npath and format.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.audio("cat-purr.mp3", format="audio/mpeg", loop=True)\n</pre>\n<Cloud name=\"doc-audio-purr\" path=\"\" query=\"\" stylePlaceholder=\"height: 250px\" /><p>You can also pass <tt class=\"docutils literal\">bytes</tt> or <tt class=\"docutils literal\">numpy.ndarray</tt> objects to <tt class=\"docutils literal\">st.audio</tt>.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\n\naudio_file = open("myaudio.ogg", "rb")\naudio_bytes = audio_file.read()\n\nst.audio(audio_bytes, format="audio/ogg")\n\nsample_rate = 44100 # 44100 samples per second\nseconds = 2 # Note duration of 2 seconds\nfrequency_la = 440 # Our played note will be 440 Hz\n# Generate array with seconds*sample_rate steps, ranging between 0 and seconds\nt = np.linspace(0, seconds, seconds * sample_rate, False)\n# Generate a 440 Hz sine wave\nnote_la = np.sin(frequency_la * t * 2 * np.pi)\n\nst.audio(note_la, sample_rate=sample_rate)\n</pre>\n<Cloud name=\"doc-audio\" path=\"\" query=\"\" stylePlaceholder=\"height: 865px\" /></blockquote>\n", + "description": "<p>Display an audio player.</p>\n", + "args": [ + { + "name": "data", + "type_name": "str, bytes, BytesIO, numpy.ndarray, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Raw audio data, filename, or a URL pointing to the file to load.\nRaw data formats must include all necessary file headers to match the file\nformat specified via <tt class=\"docutils literal\">format</tt>.\nIf <tt class=\"docutils literal\">data</tt> is a numpy array, it must either be a 1D array of the waveform\nor a 2D array of shape <tt class=\"docutils literal\">(num_channels, num_samples)</tt> with waveforms\nfor all channels. See the default channel order at\n<a class=\"reference external\" href=\"http://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx\">http://msdn.microsoft.com/en-us/library/windows/hardware/dn653308(v=vs.85).aspx</a></p>\n", + "default": "channel" + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The mime type for the audio file. Defaults to <tt class=\"docutils literal\">"audio/wav"</tt>.\nSee <a class=\"reference external\" href=\"https://tools.ietf.org/html/rfc4281\">https://tools.ietf.org/html/rfc4281</a> for more info.</p>\n", + "default": "s" + }, + { + "name": "start_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The time from which the element should start playing. This can be\none of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default): The element plays from the beginning.</li>\n<li>An``int`` or <tt class=\"docutils literal\">float</tt> specifying the time in seconds. <tt class=\"docutils literal\">float</tt>\nvalues are rounded down to whole seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas'\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"2 minute"</tt>, <tt class=\"docutils literal\">"20s"</tt>, or <tt class=\"docutils literal\">"1m14s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(seconds=70)</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "sample_rate", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The sample rate of the audio data in samples per second. Only required if\n<tt class=\"docutils literal\">data</tt> is a numpy array.</p>\n", + "default": null + }, + { + "name": "end_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The time at which the element should stop playing. This can be\none of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default): The element plays through to the end.</li>\n<li>An <tt class=\"docutils literal\">int</tt> or <tt class=\"docutils literal\">float</tt> specifying the time in seconds. <tt class=\"docutils literal\">float</tt>\nvalues are rounded down to whole seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas'\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"2 minute"</tt>, <tt class=\"docutils literal\">"20s"</tt>, or <tt class=\"docutils literal\">"1m14s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(seconds=70)</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "loop", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether the audio should loop playback.</p>\n", + "default": null + }, + { + "name": "autoplay", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether the audio file should start playing automatically. This is\n<tt class=\"docutils literal\">False</tt> by default. Browsers will not autoplay audio files if the\nuser has not interacted with the page by clicking somewhere.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/media.py#L64" + }, + "streamlit.balloons": { + "name": "balloons", + "signature": "st.balloons()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.balloons()\n</pre>\n<p>...then watch your app and get ready for a celebration!</p>\n</blockquote>\n", + "description": "<p>Draw celebratory balloons.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/balloons.py#L27" + }, + "streamlit.bar_chart": { + "name": "bar_chart", + "signature": "st.bar_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, horizontal=False, width=None, height=None, use_container_width=True)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.bar_chart(chart_data)\n</pre>\n<Cloud name=\"doc-bar-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>You can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": list(range(20)) * 3,\n "col2": np.random.randn(60),\n "col3": ["A"] * 20 + ["B"] * 20 + ["C"] * 20,\n }\n)\n\nst.bar_chart(chart_data, x="col1", y="col2", color="col3")\n</pre>\n<Cloud name=\"doc-bar-chart1\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>If your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple series with different\ncolors:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {"col1": list(range(20)), "col2": np.random.randn(20), "col3": np.random.randn(20)}\n)\n\nst.bar_chart(\n chart_data, x="col1", y=["col2", "col3"], color=["#FF0000", "#0000FF"] # Optional\n)\n</pre>\n<Cloud name=\"doc-bar-chart2\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>You can rotate your bar charts to display horizontally.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom vega_datasets import data\n\nsource = data.barley()\n\nst.bar_chart(source, x="variety", y="yield", color="site", horizontal=True)\n</pre>\n<Cloud name=\"doc-bar-chart-horizontal\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /></blockquote>\n", + "description": "<p>Display a bar chart.</p>\n<p>This is syntax-sugar around <tt class=\"docutils literal\">st.altair_chart</tt>. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.</p>\n<p>If <tt class=\"docutils literal\">st.bar_chart</tt> does not guess the data specification\ncorrectly, try specifying your desired chart using <tt class=\"docutils literal\">st.altair_chart</tt>.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, or dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Data to be plotted.</p>\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name or key associated to the x-axis data. If <tt class=\"docutils literal\">x</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit uses the data index for the x-axis\nvalues.</p>\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name(s) or key(s) associated to the y-axis data. If this is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a <tt class=\"docutils literal\">Sequence</tt> of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.</p>\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the x-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name specified in <tt class=\"docutils literal\">x</tt> if available, or else\nno label will be displayed.</p>\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the y-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name(s) specified in <tt class=\"docutils literal\">y</tt> if available, or\nelse no label will be displayed.</p>\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The color to use for different series in this chart.</p>\n<p>For a bar chart with just one series, this can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default color.</li>\n<li>A hex string like "#ffaa00" or "#ffaa0088".</li>\n<li>An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.</li>\n</ul>\n<p>For a bar chart with multiple series, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:</p>\n<ul>\n<li><p class=\"first\">None, to use the default colors.</p>\n</li>\n<li><p class=\"first\">The name of a column in the dataset. Data points will be grouped\ninto series of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.</p>\n<p>For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three series whose colors will be\nautomatically selected from the default palette.</p>\n<p>But, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into 3 series, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.</p>\n</li>\n</ul>\n<p>For a bar chart with multiple series, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default colors.</li>\n<li>A list of string colors or color tuples to be used for each of\nthe series in the chart. This list should have the same length\nas the number of y values (e.g. <tt class=\"docutils literal\"><span class=\"pre\">color=["#fd0",</span> "#f0f", "#04f"]</tt>\nfor three lines).</li>\n</ul>\n", + "default": "color" + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to make the bars horizontal. If this is <tt class=\"docutils literal\">False</tt>\n(default), the bars display vertically. If this is <tt class=\"docutils literal\">True</tt>,\nStreamlit swaps the x-axis and y-axis and the bars display\nhorizontally.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired width of the chart expressed in pixels. If <tt class=\"docutils literal\">width</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If <tt class=\"docutils literal\">width</tt> is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.</p>\n<p>To use <tt class=\"docutils literal\">width</tt>, you must set <tt class=\"docutils literal\">use_container_width=False</tt>.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the chart expressed in pixels. If <tt class=\"docutils literal\">height</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt> (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>,\nStreamlit sets the chart's width according to <tt class=\"docutils literal\">width</tt>.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L949" + }, + "streamlit.bokeh_chart": { + "name": "bokeh_chart", + "signature": "st.bokeh_chart(figure, use_container_width=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom bokeh.plotting import figure\n\nx = [1, 2, 3, 4, 5]\ny = [6, 7, 2, 4, 5]\n\np = figure(\n title='simple line example',\n x_axis_label='x',\n y_axis_label='y')\n\np.line(x, y, legend_label='Trend', line_width=2)\n\nst.bokeh_chart(p, use_container_width=True)\n</pre>\n<Cloud name=\"doc-bokeh-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 700px\" /></blockquote>\n", + "description": "<p>Display an interactive Bokeh chart.</p>\n<p>Bokeh is a charting library for Python. The arguments to this function\nclosely follow the ones for Bokeh's <tt class=\"docutils literal\">show</tt> function. You can find\nmore about Bokeh at <a class=\"reference external\" href=\"https://bokeh.pydata.org\">https://bokeh.pydata.org</a>.</p>\n<p>To show Bokeh charts in Streamlit, call <tt class=\"docutils literal\">st.bokeh_chart</tt>\nwherever you would call Bokeh's <tt class=\"docutils literal\">show</tt>.</p>\n", + "args": [ + { + "name": "figure", + "type_name": "bokeh.plotting.figure.Figure", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A Bokeh figure to plot.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets\nthe width of the figure to match the width of the parent container.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/bokeh_chart.py#L37" + }, + "streamlit.button": { + "name": "button", + "signature": "st.button(label, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.button("Reset", type="primary")\nif st.button("Say hello"):\n st.write("Why hello there")\nelse:\n st.write("Goodbye")\n</pre>\n<Cloud name=\"doc-buton\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display a button widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this button is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed when the button is\nhovered over.</p>\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this button is clicked.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "\"secondary\" or \"primary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. Defaults\nto "secondary".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the button if set to True. The\ndefault is False.</p>\n", + "default": "False" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to expand the button's width to fill its parent container.\nIf <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default), Streamlit sizes\nthe button to fit its contents. If <tt class=\"docutils literal\">use_container_width</tt> is\n<tt class=\"docutils literal\">True</tt>, the width of the button matches its parent container.</p>\n<p>In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "<p>True if the button was clicked on the last run of the app,\nFalse otherwise.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/button.py#L75" + }, + "streamlit.cache": { + "name": "cache", + "signature": "st.cache(func=None, persist=False, allow_output_mutation=False, show_spinner=True, suppress_st_warning=False, hash_funcs=None, max_entries=None, ttl=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n</pre>\n<p>To set the <tt class=\"docutils literal\">persist</tt> parameter, use this command as follows:</p>\n<pre class=\"doctest-block\">\n@st.cache(persist=True)\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n</pre>\n<p>To disable hashing return values, set the <tt class=\"docutils literal\">allow_output_mutation</tt> parameter to <tt class=\"docutils literal\">True</tt>:</p>\n<pre class=\"doctest-block\">\n@st.cache(allow_output_mutation=True)\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n</pre>\n<p>To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. <tt class=\"docutils literal\">MongoClient</tt>) to a hash function (<tt class=\"docutils literal\">id</tt>) like this:</p>\n<pre class=\"doctest-block\">\n@st.cache(hash_funcs={MongoClient: id})\ndef connect_to_database(url):\n return MongoClient(url)\n</pre>\n<p>Alternatively, you can map the type's fully-qualified name\n(e.g. <tt class=\"docutils literal\">"pymongo.mongo_client.MongoClient"</tt>) to the hash function instead:</p>\n<pre class=\"doctest-block\">\n@st.cache(hash_funcs={"pymongo.mongo_client.MongoClient": id})\ndef connect_to_database(url):\n return MongoClient(url)\n</pre>\n</blockquote>\n", + "description": "<p>Legacy caching decorator (deprecated).</p>\n<p>Legacy caching with <tt class=\"docutils literal\">st.cache</tt> has been removed from Streamlit. This is\nnow an alias for <tt class=\"docutils literal\">st.cache_data</tt> and <tt class=\"docutils literal\">st.cache_resource</tt>.</p>\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The function to cache. Streamlit hashes the function's source code.</p>\n", + "default": null + }, + { + "name": "persist", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to persist the cache on disk.</p>\n", + "default": null + }, + { + "name": "allow_output_mutation", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to use <tt class=\"docutils literal\">st.cache_data</tt> or <tt class=\"docutils literal\">st.cache_resource</tt>. If this is\n<tt class=\"docutils literal\">False</tt> (default), the arguments are passed to <tt class=\"docutils literal\">st.cache_data</tt>. If\nthis is <tt class=\"docutils literal\">True</tt>, the arguments are passed to <tt class=\"docutils literal\">st.cache_resource</tt>.</p>\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Enable the spinner. Default is <tt class=\"docutils literal\">True</tt> to show a spinner when there is\na "cache miss" and the cached data is being created.</p>\n", + "default": "is" + }, + { + "name": "suppress_st_warning", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>This is not used.</p>\n", + "default": null + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Mapping of types or fully qualified names to hash functions. This is used to override\nthe behavior of the hasher inside Streamlit's caching mechanism: when the hasher\nencounters an object, it will first check to see if its type matches a key in this\ndict and, if so, will use the provided function to generate a hash for it. See below\nfor an example of how this can be used.</p>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of entries to keep in the cache, or <tt class=\"docutils literal\">None</tt>\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is <tt class=\"docutils literal\">None</tt>.</p>\n", + "default": "is" + }, + { + "name": "ttl", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of seconds to keep an entry in the cache, or\nNone if cache entries should not expire. The default is None.</p>\n", + "default": "None" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/legacy_cache_api.py#L33" + }, + "streamlit.cache_data": { + "name": "cache_data", + "signature": "st.cache_data(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets, hash_funcs=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n</pre>\n<p>To set the <tt class=\"docutils literal\">persist</tt> parameter, use this command as follows:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n</pre>\n<p>By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with <tt class=\"docutils literal\">_</tt> will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n # Fetch data from _db_connection here, and then clean it up.\n return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n</pre>\n<p>A cached function's cache can be procedurally cleared:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n # Fetch data from _db_connection here, and then clean it up.\n return data\n\nfetch_and_clean_data.clear(_db_connection, 50)\n# Clear the cached entry for the arguments provided.\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n</pre>\n<p>To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. <tt class=\"docutils literal\">datetime.datetime</tt>) to a hash\nfunction (<tt class=\"docutils literal\">lambda dt: dt.isoformat()</tt>) like this:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={datetime.datetime: lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n return dt.astimezone(datetime.timezone.utc)\n</pre>\n<p>Alternatively, you can map the type's fully-qualified name\n(e.g. <tt class=\"docutils literal\">"datetime.datetime"</tt>) to the hash function instead:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={"datetime.datetime": lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n return dt.astimezone(datetime.timezone.utc)\n</pre>\n</blockquote>\n", + "description": "<p>Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).</p>\n<p>Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.</p>\n<p>You can clear a function's cache with <tt class=\"docutils literal\">func.clear()</tt> or clear the entire\ncache with <tt class=\"docutils literal\">st.cache_data.clear()</tt>.</p>\n<p>To cache global resources, use <tt class=\"docutils literal\">st.cache_resource</tt> instead. Learn more\nabout caching at <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/architecture/caching\">https://docs.streamlit.io/develop/concepts/architecture/caching</a>.</p>\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The function to cache. Streamlit hashes the function's source code.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum time to keep an entry in the cache. Can be one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> if cache entries should never expire (default).</li>\n<li>A number specifying the time in seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas's\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"1d"</tt>, <tt class=\"docutils literal\">"1.5 days"</tt>, or <tt class=\"docutils literal\">"1h23s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(days=1)</tt>.</li>\n</ul>\n<p>Note that <tt class=\"docutils literal\">ttl</tt> will be ignored if <tt class=\"docutils literal\"><span class=\"pre\">persist="disk"</span></tt> or <tt class=\"docutils literal\">persist=True</tt>.</p>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. When a new entry is added to a full cache,\nthe oldest cached entry will be removed. Defaults to None.</p>\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.</p>\n", + "default": "True" + }, + { + "name": "persist", + "type_name": "\"disk\", bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.</p>\n", + "default": "None" + }, + { + "name": "experimental_allow_widgets", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.</p>\n", + "default": "False", + "deprecated": { + "deprecated": true, + "deprecatedText": "<p><tt class=\"docutils literal\">experimental_allow_widgets</tt> is deprecated and will be removed in\na later version.</p>\n" + } + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_data_api.py#L396" + }, + "streamlit.cache_resource": { + "name": "cache_resource", + "signature": "st.cache_resource(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets, hash_funcs=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n # Create a database session object that points to the URL.\n return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n</pre>\n<p>By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with <tt class=\"docutils literal\">_</tt> will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n # Create a database connection object that points to the URL.\n return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n</pre>\n<p>A cache_resource function's cache can be procedurally cleared:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n # Create a database connection object that points to the URL.\n return connection\n\nfetch_and_clean_data.clear(_sessionmaker, "https://streamlit.io/")\n# Clear the cached entry for the arguments provided.\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n</pre>\n<p>To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. <tt class=\"docutils literal\">Person</tt>) to a hash\nfunction (<tt class=\"docutils literal\">str</tt>) like this:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n name: str\n\n@st.cache_resource(hash_funcs={Person: str})\ndef get_person_name(person: Person):\n return person.name\n</pre>\n<p>Alternatively, you can map the type's fully-qualified name\n(e.g. <tt class=\"docutils literal\">"__main__.Person"</tt>) to the hash function instead:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n name: str\n\n@st.cache_resource(hash_funcs={"__main__.Person": str})\ndef get_person_name(person: Person):\n return person.name\n</pre>\n</blockquote>\n", + "description": "<p>Decorator to cache functions that return global resources (e.g. database connections, ML models).</p>\n<p>Cached objects are shared across all users, sessions, and reruns. They\nmust be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using <tt class=\"docutils literal\">st.session_state</tt>\nto store resources per session instead.</p>\n<p>You can clear a function's cache with <tt class=\"docutils literal\">func.clear()</tt> or clear the entire\ncache with <tt class=\"docutils literal\">st.cache_resource.clear()</tt>.</p>\n<p>To cache data, use <tt class=\"docutils literal\">st.cache_data</tt> instead. Learn more about caching at\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/architecture/caching\">https://docs.streamlit.io/develop/concepts/architecture/caching</a>.</p>\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The function that creates the cached resource. Streamlit hashes the\nfunction's source code.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum time to keep an entry in the cache. Can be one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> if cache entries should never expire (default).</li>\n<li>A number specifying the time in seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas's\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"1d"</tt>, <tt class=\"docutils literal\">"1.5 days"</tt>, or <tt class=\"docutils literal\">"1h23s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(days=1)</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. When a new entry is added to a full cache,\nthe oldest cached entry will be removed. Defaults to None.</p>\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.</p>\n", + "default": "True" + }, + { + "name": "validate", + "type_name": "callable or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional validation function for cached data. <tt class=\"docutils literal\">validate</tt> is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If <tt class=\"docutils literal\">validate</tt> returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.</p>\n", + "default": null + }, + { + "name": "experimental_allow_widgets", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.</p>\n", + "default": "False", + "deprecated": { + "deprecated": true, + "deprecatedText": "<p><tt class=\"docutils literal\">experimental_allow_widgets</tt> is deprecated and will be removed in\na later version.</p>\n" + } + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_resource_api.py#L265" + }, + "streamlit.camera_input": { + "name": "camera_input", + "signature": "st.camera_input(label, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\npicture = st.camera_input("Take a picture")\n\nif picture:\n st.image(picture)\n</pre>\n</blockquote>\n", + "description": "<p>Display a widget that returns pictures from the user's webcam.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this widget is used for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A tooltip that gets displayed next to the camera input.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this camera_input's value\nchanges.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the camera input if set to\nTrue. Default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "None or UploadedFile", + "is_generator": false, + "description": "<p>The UploadedFile class is a subclass of BytesIO, and therefore\nit is "file-like". This means you can pass them anywhere where\na file is expected.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/camera_input.py#L84" + }, + "streamlit.caption": { + "name": "caption", + "signature": "st.caption(body, unsafe_allow_html=False, *, help=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.caption('This is a string that explains something above.')\nst.caption('A caption with _italics_ :blue[colors] and emojis :sunglasses:')\n</pre>\n</blockquote>\n", + "description": "<p>Display text in small font.</p>\n<p>This should be used for captions, asides, footnotes, sidenotes, and\nother explanatory text.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: <a class=\"reference external\" href=\"https://github.github.com/gfm\">https://github.github.com/gfm</a>.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to render HTML within <tt class=\"docutils literal\">body</tt>. If this is <tt class=\"docutils literal\">False</tt>\n(default), any HTML tags found in <tt class=\"docutils literal\">body</tt> will be escaped and\ntherefore treated as raw text. If this is <tt class=\"docutils literal\">True</tt>, any HTML\nexpressions within <tt class=\"docutils literal\">body</tt> will be rendered.</p>\n<p>Adding custom HTML to your app impacts safety, styling, and\nmaintainability.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">If you only want to insert HTML or CSS without Markdown text,\nwe recommend using <tt class=\"docutils literal\">st.html</tt> instead.</p>\n</div>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the caption.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/markdown.py#L153" + }, + "streamlit.chat_input": { + "name": "chat_input", + "signature": "st.chat_input(placeholder=\"Your message\", *, key=None, max_chars=None, disabled=False, on_submit=None, args=None, kwargs=None)", + "examples": "<blockquote>\n<p>When <tt class=\"docutils literal\">st.chat_input</tt> is used in the main body of an app, it will be\npinned to the bottom of the page.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nprompt = st.chat_input("Say something")\nif prompt:\n st.write(f"User has sent the following prompt: {prompt}")\n</pre>\n<Cloud name=\"doc-chat-input\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /><p>The chat input can also be used inline by nesting it inside any layout\ncontainer (container, columns, tabs, sidebar, etc). Create chat\ninterfaces embedded next to other content or have multiple chat bots!</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nwith st.sidebar:\n messages = st.container(height=300)\n if prompt := st.chat_input("Say something"):\n messages.chat_message("user").write(prompt)\n messages.chat_message("assistant").write(f"Echo: {prompt}")\n</pre>\n<Cloud name=\"doc-chat-input-inline\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Display a chat input widget.</p>\n", + "args": [ + { + "name": "placeholder", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A placeholder text shown when the chat input is empty. Defaults to\n"Your message". For accessibility reasons, you should not use an\nempty string.</p>\n", + "default": "s" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget based on\nits content. Multiple widgets of the same type may not share the same key.</p>\n", + "default": null + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of characters that can be entered. If <tt class=\"docutils literal\">None</tt>\n(default), there will be no maximum.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether the chat input should be disabled. Defaults to <tt class=\"docutils literal\">False</tt>.</p>\n", + "default": "s" + }, + { + "name": "on_submit", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional callback invoked when the chat input's value is submitted.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "str or None", + "is_generator": false, + "description": "<p>The current (non-empty) value of the text input widget on the last\nrun of the app. Otherwise, <tt class=\"docutils literal\">None</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/chat.py#L237" + }, + "streamlit.chat_message": { + "name": "chat_message", + "signature": "st.chat_message(name, *, avatar=None)", + "examples": "<blockquote>\n<p>You can use <tt class=\"docutils literal\">with</tt> notation to insert any element into an expander</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\n\nwith st.chat_message("user"):\n st.write("Hello \ud83d\udc4b")\n st.line_chart(np.random.randn(30, 3))\n</pre>\n<Cloud name=\"doc-chat-message-user\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" /><p>Or you can just call methods directly in the returned objects:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\n\nmessage = st.chat_message("assistant")\nmessage.write("Hello human")\nmessage.bar_chart(np.random.randn(30, 3))\n</pre>\n<Cloud name=\"doc-chat-message-user1\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" /></blockquote>\n", + "description": "<p>Insert a chat message container.</p>\n<p>To add elements to the returned container, you can use <tt class=\"docutils literal\">with</tt> notation\n(preferred) or just call methods directly on the returned object. See the\nexamples below.</p>\n", + "args": [ + { + "name": "name", + "type_name": "\"user\", \"assistant\", \"ai\", \"human\", or str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The name of the message author. Can be "human"/"user" or\n"ai"/"assistant" to enable preset styling and avatars.</p>\n<p>Currently, the name is not shown in the UI but is only set as an\naccessibility label. For accessibility reasons, you should not use\nan empty string.</p>\n", + "default": null + }, + { + "name": "avatar", + "type_name": "Anything supported by st.image, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The avatar shown next to the message.</p>\n<p>If <tt class=\"docutils literal\">avatar</tt> is <tt class=\"docutils literal\">None</tt> (default), the icon will be determined\nfrom <tt class=\"docutils literal\">name</tt> as follows:</p>\n<ul class=\"simple\">\n<li>If <tt class=\"docutils literal\">name</tt> is <tt class=\"docutils literal\">"user"</tt> or <tt class=\"docutils literal\">"human"</tt>, the message will have a\ndefault user icon.</li>\n<li>If <tt class=\"docutils literal\">name</tt> is <tt class=\"docutils literal\">"ai"</tt> or <tt class=\"docutils literal\">"assistant"</tt>, the message will have\na default bot icon.</li>\n<li>For all other values of <tt class=\"docutils literal\">name</tt>, the message will show the first\nletter of the name.</li>\n</ul>\n<p>In addition to the types supported by <tt class=\"docutils literal\">st.image</tt> (like URLs or numpy\narrays), the following strings are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">avatar="\ud83e\uddd1\u200d\ud83d\udcbb"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">avatar="\ud83e\udd96"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n", + "default": "user" + } + ], + "returns": [ + { + "type_name": "Container", + "is_generator": false, + "description": "<p>A single container that can hold multiple elements.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/chat.py#L126" + }, + "streamlit.checkbox": { + "name": "checkbox", + "signature": "st.checkbox(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nagree = st.checkbox("I agree")\n\nif agree:\n st.write("Great!")\n</pre>\n<Cloud name=\"doc-checkbox\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display a checkbox widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this checkbox is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Preselect the checkbox when it first renders. This will be\ncast to bool internally.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the checkbox.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this checkbox's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the checkbox if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "<p>Whether or not the checkbox is checked.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/checkbox.py#L57" + }, + "streamlit.code": { + "name": "code", + "signature": "st.code(body, language=\"python\", line_numbers=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ncode = '''def hello():\n print("Hello, Streamlit!")'''\nst.code(code, language='python')\n</pre>\n</blockquote>\n", + "description": "<p>Display a code block with optional syntax highlighting.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The string to display as code.</p>\n", + "default": null + }, + { + "name": "language", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The language that the code is written in, for syntax highlighting.\nIf <tt class=\"docutils literal\">None</tt>, the code will be unstyled. Defaults to <tt class=\"docutils literal\">"python"</tt>.</p>\n<p>For a list of available <tt class=\"docutils literal\">language</tt> values, see:</p>\n<p><a class=\"reference external\" href=\"https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD\">https://github.com/react-syntax-highlighter/react-syntax-highlighter/blob/master/AVAILABLE_LANGUAGES_PRISM.MD</a></p>\n", + "default": "s" + }, + { + "name": "line_numbers", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional boolean indicating whether to show line numbers to the\nleft of the code block. Defaults to <tt class=\"docutils literal\">False</tt>.</p>\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/code.py#L29" + }, + "streamlit.color_picker": { + "name": "color_picker", + "signature": "st.color_picker(label, value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ncolor = st.color_picker("Pick A Color", "#00f900")\nst.write("The current color is", color)\n</pre>\n<Cloud name=\"doc-color-picker\" path=\"\" query=\"\" stylePlaceholder=\"height: 335px\" /></blockquote>\n", + "description": "<p>Display a color picker widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The hex value of this widget when it first renders. If None,\ndefaults to black.</p>\n", + "default": "black" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the color picker.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this color_picker's value\nchanges.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the color picker if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str", + "is_generator": false, + "description": "<p>The selected color as a hex string.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/color_picker.py#L59" + }, + "streamlit.columns": { + "name": "columns", + "signature": "st.columns(spec, *, gap=\"small\", vertical_alignment=\"top\")", + "examples": "<blockquote>\n<p>You can use the <tt class=\"docutils literal\">with</tt> notation to insert any element into a column:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\n\nwith col1:\n st.header("A cat")\n st.image("https://static.streamlit.io/examples/cat.jpg")\n\nwith col2:\n st.header("A dog")\n st.image("https://static.streamlit.io/examples/dog.jpg")\n\nwith col3:\n st.header("An owl")\n st.image("https://static.streamlit.io/examples/owl.jpg")\n</pre>\n<Cloud name=\"doc-columns1\" path=\"\" query=\"\" stylePlaceholder=\"height: 620px\" /><p>Or you can just call methods directly on the returned objects:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\n\ncol1, col2 = st.columns([3, 1])\ndata = np.random.randn(10, 1)\n\ncol1.subheader("A wide column with a chart")\ncol1.line_chart(data)\n\ncol2.subheader("A narrow column with the data")\ncol2.write(data)\n</pre>\n<Cloud name=\"doc-columns2\" path=\"\" query=\"\" stylePlaceholder=\"height: 550px\" /><p>Use <tt class=\"docutils literal\"><span class=\"pre\">vertical_alignment="bottom"</span></tt> to align widgets.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nleft, middle, right = st.columns(3, vertical_alignment="bottom")\n\nleft.text_input("Write something")\nmiddle.button("Click me", use_container_width=True)\nright.checkbox("Check me")\n</pre>\n<Cloud name=\"doc-columns-bottom-widgets\" path=\"\" query=\"\" stylePlaceholder=\"height: 200px\" /><p>Adjust vertical alignment to customize your grid layouts.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\n\nvertical_alignment = st.selectbox(\n "Vertical alignment", ["top", "center", "bottom"], index=2\n)\n\nleft, middle, right = st.columns(3, vertical_alignment=vertical_alignment)\nleft.image("https://static.streamlit.io/examples/cat.jpg")\nmiddle.image("https://static.streamlit.io/examples/dog.jpg")\nright.image("https://static.streamlit.io/examples/owl.jpg")\n</pre>\n<Cloud name=\"doc-columns-vertical-alignment\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" /></blockquote>\n", + "description": "<p>Insert containers laid out as side-by-side columns.</p>\n<p>Inserts a number of multi-element containers laid out side-by-side and\nreturns a list of container objects.</p>\n<p>To add elements to the returned containers, you can use the <tt class=\"docutils literal\">with</tt> notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.</p>\n<p>Columns can only be placed inside other columns up to one level of nesting.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Columns cannot be placed inside other columns in the sidebar. This\nis only possible in the main area of the app.</p>\n</div>\n", + "args": [ + { + "name": "spec", + "type_name": "int or Iterable of numbers", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Controls the number and width of columns to insert. Can be one of:</p>\n<ul class=\"simple\">\n<li>An integer that specifies the number of columns. All columns have equal\nwidth in this case.</li>\n<li>An Iterable of numbers (int or float) that specify the relative width of\neach column. E.g. <tt class=\"docutils literal\">[0.7, 0.3]</tt> creates two columns where the first\none takes up 70% of the available with and the second one takes up 30%.\nOr <tt class=\"docutils literal\">[1, 2, 3]</tt> creates three columns where the second one is two times\nthe width of the first one, and the third one is three times that width.</li>\n</ul>\n", + "default": null + }, + { + "name": "gap", + "type_name": "\"small\", \"medium\", or \"large\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The size of the gap between the columns. The default is <tt class=\"docutils literal\">"small"</tt>.</p>\n", + "default": "is" + }, + { + "name": "vertical_alignment", + "type_name": "\"top\", \"center\", or \"bottom\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The vertical alignment of the content inside the columns. The\ndefault is <tt class=\"docutils literal\">"top"</tt>.</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "list of containers", + "is_generator": false, + "description": "<p>A list of container objects.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/layouts.py#L147" + }, + "streamlit.connection": { + "name": "connection", + "signature": "st.connection(name, type=None, max_entries=None, ttl=None, **kwargs)", + "examples": "<blockquote>\n<p>The easiest way to create a first-party (SQL, Snowflake, or Snowpark) connection is\nto use their default names and define corresponding sections in your <tt class=\"docutils literal\">secrets.toml</tt>\nfile.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn = st.connection("sql") # Config section defined in [connections.sql] in secrets.toml.\n</pre>\n<p>Creating a SQLConnection with a custom name requires you to explicitly specify the\ntype. If type is not passed as a kwarg, it must be set in the appropriate section of\n<tt class=\"docutils literal\">secrets.toml</tt>.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn1 = st.connection("my_sql_connection", type="sql") # Config section defined in [connections.my_sql_connection].\nconn2 = st.connection("my_other_sql_connection") # type must be set in [connections.my_other_sql_connection].\n</pre>\n<p>Passing the full module path to the connection class that you want to use can be\nuseful, especially when working with a custom connection:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn = st.connection("my_sql_connection", type="streamlit.connections.SQLConnection")\n</pre>\n<p>Finally, you can pass the connection class to use directly to this function. Doing\nso allows static type checking tools such as <tt class=\"docutils literal\">mypy</tt> to infer the exact return\ntype of <tt class=\"docutils literal\">st.connection</tt>.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\nconn = st.connection("my_sql_connection", type=SQLConnection)\n</pre>\n</blockquote>\n", + "description": "<p>Create a new connection to a data store or API, or return an existing one.</p>\n<p>Config options, credentials, secrets, etc. for connections are taken from various\nsources:</p>\n<ul class=\"simple\">\n<li>Any connection-specific configuration files.</li>\n<li>An app's <tt class=\"docutils literal\">secrets.toml</tt> files.</li>\n<li>The kwargs passed to this function.</li>\n</ul>\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The connection name used for secrets lookup in <tt class=\"docutils literal\"><span class=\"pre\">[connections.<name>]</span></tt>.\nType will be inferred from passing <tt class=\"docutils literal\">"sql"</tt>, <tt class=\"docutils literal\">"snowflake"</tt>, or <tt class=\"docutils literal\">"snowpark"</tt>.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "str, connection class, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The type of connection to create. It can be a keyword (<tt class=\"docutils literal\">"sql"</tt>, <tt class=\"docutils literal\">"snowflake"</tt>,\nor <tt class=\"docutils literal\">"snowpark"</tt>), a path to an importable class, or an imported class reference.\nAll classes must extend <tt class=\"docutils literal\">st.connections.BaseConnection</tt> and implement the\n<tt class=\"docutils literal\">_connect()</tt> method. If the type kwarg is None, a <tt class=\"docutils literal\">type</tt> field must be set in\nthe connection's section in <tt class=\"docutils literal\">secrets.toml</tt>.</p>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of connections to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.</p>\n", + "default": "None" + }, + { + "name": "ttl", + "type_name": "float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Additional connection specific kwargs that are passed to the Connection's\n<tt class=\"docutils literal\">_connect()</tt> method. Learn more from the specific Connection's documentation.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Connection object", + "is_generator": false, + "description": "<p>An initialized Connection object of the specified type.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/connection_factory.py#L205" + }, + "streamlit.container": { + "name": "container", + "signature": "st.container(*, height=None, border=None)", + "examples": "<blockquote>\n<p>Inserting elements using <tt class=\"docutils literal\">with</tt> notation:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nwith st.container():\n st.write("This is inside the container")\n\n # You can call any Streamlit command, including custom components:\n st.bar_chart(np.random.randn(50, 3))\n\nst.write("This is outside the container")\n</pre>\n<Cloud name=\"doc-container1\" path=\"\" query=\"\" stylePlaceholder=\"height: 520px\" /><p>Inserting elements out of order:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ncontainer = st.container(border=True)\ncontainer.write("This is inside the container")\nst.write("This is outside the container")\n\n# Now insert some more in the container\ncontainer.write("This is inside too")\n</pre>\n<Cloud name=\"doc-container2\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /><p>Using <tt class=\"docutils literal\">height</tt> to make a grid:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nrow1 = st.columns(3)\nrow2 = st.columns(3)\n\nfor col in row1 + row2:\n tile = col.container(height=120)\n tile.title(":balloon:")\n</pre>\n<Cloud name=\"doc-container3\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /><p>Using <tt class=\"docutils literal\">height</tt> to create a scrolling container for long content:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nlong_text = "Lorem ipsum. " * 1000\n\nwith st.container(height=300):\n st.markdown(long_text)\n</pre>\n<Cloud name=\"doc-container4\" path=\"\" query=\"\" stylePlaceholder=\"height: 400px\" /></blockquote>\n", + "description": "<p>Insert a multi-element container.</p>\n<p>Inserts an invisible container into your app that can be used to hold\nmultiple elements. This allows you to, for example, insert multiple\nelements into your app out of order.</p>\n<p>To add elements to the returned container, you can use the <tt class=\"docutils literal\">with</tt> notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.</p>\n", + "args": [ + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the container expressed in pixels. If <tt class=\"docutils literal\">None</tt> (default)\nthe container grows to fit its content. If a fixed height, scrolling is\nenabled for large content and a grey border is shown around the container\nto visually separate its scroll surface from the rest of the app.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Use containers with scroll sparingly. If you do, try to keep\nthe height small (below 500 pixels). Otherwise, the scroll\nsurface of the container might cover the majority of the screen\non mobile devices, which makes it hard to scroll the rest of the app.</p>\n</div>\n", + "default": null + }, + { + "name": "border", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to show a border around the container. If <tt class=\"docutils literal\">None</tt> (default), a\nborder is shown if the container is set to a fixed height and not\nshown otherwise.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/layouts.py#L35" + }, + "streamlit.data_editor": { + "name": "data_editor", + "signature": "st.data_editor(data, *, width=None, height=None, use_container_width=False, hide_index=None, column_order=None, column_config=None, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n [\n {"command": "st.selectbox", "rating": 4, "is_widget": True},\n {"command": "st.balloons", "rating": 5, "is_widget": False},\n {"command": "st.time_input", "rating": 3, "is_widget": True},\n ]\n)\nedited_df = st.data_editor(df)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n</pre>\n<Cloud name=\"doc-data-editor\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /><p>You can also allow the user to add and delete rows by setting <tt class=\"docutils literal\">num_rows</tt> to "dynamic":</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n [\n {"command": "st.selectbox", "rating": 4, "is_widget": True},\n {"command": "st.balloons", "rating": 5, "is_widget": False},\n {"command": "st.time_input", "rating": 3, "is_widget": True},\n ]\n)\nedited_df = st.data_editor(df, num_rows="dynamic")\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n</pre>\n<Cloud name=\"doc-data-editor1\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" /><p>Or you can customize the data editor via <tt class=\"docutils literal\">column_config</tt>, <tt class=\"docutils literal\">hide_index</tt>, <tt class=\"docutils literal\">column_order</tt>, or <tt class=\"docutils literal\">disabled</tt>:</p>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n [\n {"command": "st.selectbox", "rating": 4, "is_widget": True},\n {"command": "st.balloons", "rating": 5, "is_widget": False},\n {"command": "st.time_input", "rating": 3, "is_widget": True},\n ]\n)\nedited_df = st.data_editor(\n df,\n column_config={\n "command": "Streamlit Command",\n "rating": st.column_config.NumberColumn(\n "Your rating",\n help="How much do you like this command (1-5)?",\n min_value=1,\n max_value=5,\n step=1,\n format="%d \u2b50",\n ),\n "is_widget": "Widget ?",\n },\n disabled=["command", "is_widget"],\n hide_index=True,\n)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n</pre>\n<Cloud name=\"doc-data-editor-config\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Display a data editor widget.</p>\n<p>The data editor widget allows you to edit dataframes and many other data structures in a table-like UI.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">When going from <tt class=\"docutils literal\">st.experimental_data_editor</tt> to <tt class=\"docutils literal\">st.data_editor</tt> in\n1.23.0, the data editor's representation in <tt class=\"docutils literal\">st.session_state</tt> was changed.\nThe <tt class=\"docutils literal\">edited_cells</tt> dictionary is now called <tt class=\"docutils literal\">edited_rows</tt> and uses a\ndifferent format (<tt class=\"docutils literal\">{0: {"column name": "edited <span class=\"pre\">value"}}</span></tt> instead of\n<tt class=\"docutils literal\">{"0:1": "edited value"}</tt>). You may need to adjust the code if your app uses\n<tt class=\"docutils literal\">st.experimental_data_editor</tt> in combination with <tt class=\"docutils literal\">st.session_state</tt>.</p>\n</div>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.DataFrame, list, set, tuple, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The data to edit in the data editor.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<ul class=\"last simple\">\n<li>Styles from <tt class=\"docutils literal\">pandas.Styler</tt> will only be applied to non-editable columns.</li>\n<li>Mixing data types within a column can make the column uneditable.</li>\n<li>Additionally, the following data types are not yet supported for editing:\ncomplex, list, tuple, bytes, bytearray, memoryview, dict, set, frozenset,\nfractions.Fraction, pandas.Interval, and pandas.Period.</li>\n<li>To prevent overflow in JavaScript, columns containing datetime.timedelta\nand pandas.Timedelta values will default to uneditable but this can be\nchanged through column configuration.</li>\n</ul>\n</div>\n", + "default": "to" + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired width of the data editor expressed in pixels. If <tt class=\"docutils literal\">width</tt>\nis <tt class=\"docutils literal\">None</tt> (default), Streamlit sets the data editor width to fit\nits contents up to the width of the parent container. If <tt class=\"docutils literal\">width</tt>\nis greater than the width of the parent container, Streamlit sets\nthe data editor width to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the data editor expressed in pixels. If <tt class=\"docutils literal\">height</tt>\nis <tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height to show at most\nten rows. Vertical scrolling within the data editor element is\nenabled when the height does not accomodate all rows.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default),\nStreamlit sets the data editor's width according to <tt class=\"docutils literal\">width</tt>. If\n<tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets the width of\nthe data editor to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to hide the index column(s). If <tt class=\"docutils literal\">hide_index</tt> is <tt class=\"docutils literal\">None</tt>\n(default), the visibility of index columns is automatically\ndetermined based on the data.</p>\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the display order of columns. This also affects which columns are\nvisible. For example, <tt class=\"docutils literal\"><span class=\"pre\">column_order=("col2",</span> "col1")</tt> will display 'col2'\nfirst, followed by 'col1', and will hide all other non-index columns. If\nNone (default), the order is inherited from the original data structure.</p>\n", + "default": null + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Configures how columns are displayed, e.g. their title, visibility, type, or\nformat, as well as editing properties such as min/max value or step.\nThis needs to be a dictionary where each key is a column name and the value\nis one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> to hide the column.</li>\n<li>A string to set the display label of the column.</li>\n<li>One of the column types defined under <tt class=\"docutils literal\">st.column_config</tt>, e.g.\n<tt class=\"docutils literal\"><span class=\"pre\">st.column_config.NumberColumn("Dollar</span> values\u201d, <span class=\"pre\">format=\u201d$</span> %d")</tt> to show\na column as dollar amounts. See more info on the available column types\nand config options <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/data/st.column_config\">here</a>.</li>\n</ul>\n<p>To configure the index column(s), use <tt class=\"docutils literal\">_index</tt> as the column name.</p>\n", + "default": null + }, + { + "name": "num_rows", + "type_name": "\"fixed\" or \"dynamic\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies if the user can add and delete rows in the data editor.\nIf "fixed", the user cannot add or delete rows. If "dynamic", the user can\nadd and delete rows in the data editor, but column sorting is disabled.\nDefaults to "fixed".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Controls the editing of columns. If True, editing is disabled for all columns.\nIf an Iterable of column names is provided (e.g., <tt class=\"docutils literal\"><span class=\"pre\">disabled=("col1",</span> <span class=\"pre\">"col2"))</span></tt>,\nonly the specified columns will be disabled for editing. If False (default),\nall columns that support editing are editable.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string to use as the unique key for this widget. If this\nis omitted, a key will be generated for the widget based on its\ncontent. Multiple widgets of the same type may not share the same\nkey.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional callback invoked when this data_editor's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame, pandas.Series, pyarrow.Table, numpy.ndarray, list, set, tuple, or dict.", + "is_generator": false, + "description": "<p>The edited data. The edited data is returned in its original data type if\nit corresponds to any of the supported return types. All other data types\nare returned as a <tt class=\"docutils literal\">pandas.DataFrame</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/data_editor.py#L583" + }, + "streamlit.dataframe": { + "name": "dataframe", + "signature": "st.dataframe(data=None, width=None, height=None, *, use_container_width=False, hide_index=None, column_order=None, column_config=None, key=None, on_select=\"ignore\", selection_mode=\"multi-row\")", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))\n\nst.dataframe(df) # Same as st.write(df)\n</pre>\n<Cloud name=\"doc-dataframe\" path=\"\" query=\"\" stylePlaceholder=\"height: 500px\" /><p>You can also pass a Pandas Styler object to change the style of\nthe rendered DataFrame:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(np.random.randn(10, 20), columns=("col %d" % i for i in range(20)))\n\nst.dataframe(df.style.highlight_max(axis=0))\n</pre>\n<Cloud name=\"doc-dataframe1\" path=\"\" query=\"\" stylePlaceholder=\"height: 500px\" /><p>Or you can customize the dataframe via <tt class=\"docutils literal\">column_config</tt>, <tt class=\"docutils literal\">hide_index</tt>, or <tt class=\"docutils literal\">column_order</tt>:</p>\n<pre class=\"doctest-block\">\nimport random\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n {\n "name": ["Roadmap", "Extras", "Issues"],\n "url": ["https://roadmap.streamlit.app", "https://extras.streamlit.app", "https://issues.streamlit.app"],\n "stars": [random.randint(0, 1000) for _ in range(3)],\n "views_history": [[random.randint(0, 5000) for _ in range(30)] for _ in range(3)],\n }\n)\nst.dataframe(\n df,\n column_config={\n "name": "App name",\n "stars": st.column_config.NumberColumn(\n "Github Stars",\n help="Number of stars on GitHub",\n format="%d \u2b50",\n ),\n "url": st.column_config.LinkColumn("App URL"),\n "views_history": st.column_config.LineChartColumn(\n "Views (past 30 days)", y_min=0, y_max=5000\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-dataframe-config\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Display a dataframe as an interactive table.</p>\n<p>This command works with dataframes from Pandas, PyArrow, Snowpark, and PySpark.\nIt can also display several other types that can be converted to dataframes,\ne.g. numpy arrays, lists, sets and dictionaries.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The data to display.</p>\n<p>If <tt class=\"docutils literal\">data</tt> is a <tt class=\"docutils literal\">pandas.Styler</tt>, it will be used to style its\nunderlying <tt class=\"docutils literal\">pandas.DataFrame</tt>. Streamlit supports custom cell\nvalues and colors. It does not support some of the more exotic\npandas styling features, like bar charts, hovering, and captions.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Desired width of the dataframe expressed in pixels. If <tt class=\"docutils literal\">width</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the dataframe width to fit its\ncontents up to the width of the parent container. If <tt class=\"docutils literal\">width</tt> is\ngreater than the width of the parent container, Streamlit sets the\ndataframe width to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Desired height of the dataframe expressed in pixels. If <tt class=\"docutils literal\">height</tt>\nis <tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height to show at most\nten rows. Vertical scrolling within the dataframe element is\nenabled when the height does not accomodate all rows.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default),\nStreamlit sets the dataframe's width according to <tt class=\"docutils literal\">width</tt>. If\n<tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets the width of\nthe dataframe to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to hide the index column(s). If <tt class=\"docutils literal\">hide_index</tt> is <tt class=\"docutils literal\">None</tt>\n(default), the visibility of index columns is automatically\ndetermined based on the data.</p>\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The ordered list of columns to display. If <tt class=\"docutils literal\">column_order</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit displays all columns in the order\ninherited from the underlying data structure. If <tt class=\"docutils literal\">column_order</tt>\nis a list, the indicated columns will display in the order they\nappear within the list. Columns may be omitted or repeated within\nthe list.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">column_order=("col2",</span> "col1")</tt> will display\n<tt class=\"docutils literal\">"col2"</tt> first, followed by <tt class=\"docutils literal\">"col1"</tt>, and will hide all other\nnon-index columns.</p>\n", + "default": null + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Configuration to customize how columns display. If <tt class=\"docutils literal\">column_config</tt>\nis <tt class=\"docutils literal\">None</tt> (default), columns are styled based on the underlying\ndata type of each column.</p>\n<p>Column configuration can modify column names, visibility, type,\nwidth, or format, among other things. <tt class=\"docutils literal\">column_config</tt> must be a\ndictionary where each key is a column name and the associated value\nis one of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt>: Streamlit hides the column.</li>\n<li>A string: Streamlit changes the display label of the column to\nthe given string.</li>\n<li>A column type within <tt class=\"docutils literal\">st.column_config</tt>: Streamlit applies the\ndefined configuration to the column. For example, use\n<tt class=\"docutils literal\"><span class=\"pre\">st.column_config.NumberColumn("Dollar</span> values\u201d, <span class=\"pre\">format=\u201d$</span> %d")</tt>\nto change the displayed name of the column to "Dollar values"\nand add a "$" prefix in each cell. For more info on the\navailable column types and config options, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/data/st.column_config\">Column configuration</a>.</li>\n</ul>\n<p>To configure the index column(s), use <tt class=\"docutils literal\">_index</tt> as the column name.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string to use for giving this element a stable\nidentity. If <tt class=\"docutils literal\">key</tt> is <tt class=\"docutils literal\">None</tt> (default), this element's identity\nwill be determined based on the values of the other parameters.</p>\n<p>Additionally, if selections are activated and <tt class=\"docutils literal\">key</tt> is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.</p>\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>How the dataframe should respond to user selection events. This\ncontrols whether or not the dataframe behaves like an input widget.\n<tt class=\"docutils literal\">on_select</tt> can be one of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">"ignore"</tt> (default): Streamlit will not react to any selection\nevents in the dataframe. The dataframe will not behave like an\ninput widget.</li>\n<li><tt class=\"docutils literal\">"rerun"</tt>: Streamlit will rerun the app when the user selects\nrows or columns in the dataframe. In this case, <tt class=\"docutils literal\">st.dataframe</tt>\nwill return the selection data as a dictionary.</li>\n<li>A <tt class=\"docutils literal\">callable</tt>: Streamlit will rerun the app and execute the\n<tt class=\"docutils literal\">callable</tt> as a callback function before the rest of the app.\nIn this case, <tt class=\"docutils literal\">st.dataframe</tt> will return the selection data\nas a dictionary.</li>\n</ul>\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "\"single-row\", \"multi-row\", single-column\", \"multi-column\", or Iterable of these", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The types of selections Streamlit should allow. This can be one of\nthe following:</p>\n<ul class=\"simple\">\n<li>"multi-row" (default): Multiple rows can be selected at a time.</li>\n<li>"single-row": Only one row can be selected at a time.</li>\n<li>"multi-column": Multiple columns can be selected at a time.</li>\n<li>"single-column": Only one column can be selected at a time.</li>\n<li>An <tt class=\"docutils literal\">Iterable</tt> of the above options: The table will allow\nselection based on the modes specified.</li>\n</ul>\n<p>When column selections are enabled, column sorting is disabled.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "<p>If <tt class=\"docutils literal\">on_select</tt> is <tt class=\"docutils literal\">"ignore"</tt> (default), this method returns an\ninternal placeholder for the dataframe element that can be used\nwith the <tt class=\"docutils literal\">.add_rows()</tt> method. Otherwise, this method returns a\ndictionary-like object that supports both key and attribute\nnotation. The attributes are described by the <tt class=\"docutils literal\">DataframeState</tt>\ndictionary schema.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/arrow.py#L269" + }, + "streamlit.date_input": { + "name": "date_input", + "signature": "st.date_input(label, value=\"default_value_today\", min_value=None, max_value=None, key=None, help=None, on_change=None, args=None, kwargs=None, *, format=\"YYYY/MM/DD\", disabled=False, label_visibility=\"visible\")", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport datetime\nimport streamlit as st\n\nd = st.date_input("When's your birthday", datetime.date(2019, 7, 6))\nst.write("Your birthday is:", d)\n</pre>\n<Cloud name=\"doc-date-input\" path=\"\" query=\"\" stylePlaceholder=\"height: 380px\" /><pre class=\"doctest-block\">\nimport datetime\nimport streamlit as st\n\ntoday = datetime.datetime.now()\nnext_year = today.year + 1\njan_1 = datetime.date(next_year, 1, 1)\ndec_31 = datetime.date(next_year, 12, 31)\n\nd = st.date_input(\n "Select your vacation for next year",\n (jan_1, datetime.date(next_year, 1, 7)),\n jan_1,\n dec_31,\n format="MM.DD.YYYY",\n)\nd\n</pre>\n<Cloud name=\"doc-date-input1\" path=\"\" query=\"\" stylePlaceholder=\"height: 380px\" /><p>To initialize an empty date input, use <tt class=\"docutils literal\">None</tt> as the value:</p>\n<pre class=\"doctest-block\">\nimport datetime\nimport streamlit as st\n\nd = st.date_input("When's your birthday", value=None)\nst.write("Your birthday is:", d)\n</pre>\n<Cloud name=\"doc-date-input-empty\" path=\"\" query=\"\" stylePlaceholder=\"height: 380px\" /></blockquote>\n", + "description": "<p>Display a date input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this date input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "datetime.date or datetime.datetime or list/tuple of datetime.date or datetime.datetime, \"today\", or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The value of this widget when it first renders. If a list/tuple with\n0 to 2 date/datetime values is provided, the datepicker will allow\nusers to provide a range. If <tt class=\"docutils literal\">None</tt>, will initialize empty and\nreturn <tt class=\"docutils literal\">None</tt> until the user provides input. If "today" (default),\nwill initialize with today as a single-date picker.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "datetime.date or datetime.datetime", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The minimum selectable date. If value is a date, defaults to value - 10 years.\nIf value is the interval [start, end], defaults to start - 10 years.</p>\n", + "default": "value" + }, + { + "name": "max_value", + "type_name": "datetime.date or datetime.datetime", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum selectable date. If value is a date, defaults to value + 10 years.\nIf value is the interval [start, end], defaults to end + 10 years.</p>\n", + "default": "value" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the input.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this date_input's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A format string controlling how the interface should display dates.\nSupports "YYYY/MM/DD" (default), "DD/MM/YYYY", or "MM/DD/YYYY".\nYou may also use a period (.) or hyphen (-) as separators.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the date input if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "datetime.date or a tuple with 0-2 dates or None", + "is_generator": false, + "description": "<p>The current value of the date input widget or <tt class=\"docutils literal\">None</tt> if no date has been\nselected.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/time_widgets.py#L518" + }, + "streamlit.divider": { + "name": "divider", + "signature": "st.divider()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.divider()\n</pre>\n</blockquote>\n", + "description": "<p>Display a horizontal rule.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">You can achieve the same effect with st.write("---") or\neven just "---" in your script (via magic).</p>\n</div>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/markdown.py#L270" + }, + "streamlit.download_button": { + "name": "download_button", + "signature": "st.download_button(label, data, file_name=None, mime=None, key=None, help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", + "examples": "<blockquote>\n<p>Download a large DataFrame as a CSV:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef convert_df(df):\n # IMPORTANT: Cache the conversion to prevent computation on every rerun\n return df.to_csv().encode("utf-8")\n\ncsv = convert_df(my_large_df)\n\nst.download_button(\n label="Download data as CSV",\n data=csv,\n file_name="large_df.csv",\n mime="text/csv",\n)\n</pre>\n<p>Download a string as a file:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ntext_contents = '''This is some text'''\nst.download_button("Download some text", text_contents)\n</pre>\n<p>Download a binary file:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nbinary_contents = b"example content"\n# Defaults to "application/octet-stream"\nst.download_button("Download binary file", binary_contents)\n</pre>\n<p>Download an image:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nwith open("flower.png", "rb") as file:\n btn = st.download_button(\n label="Download image",\n data=file,\n file_name="flower.png",\n mime="image/png"\n )\n</pre>\n<Cloud name=\"doc-download-buton\" path=\"\" query=\"\" stylePlaceholder=\"height: 335px\" /></blockquote>\n", + "description": "<p>Display a download button widget.</p>\n<p>This is useful when you would like to provide a way for your users\nto download a file directly from your app.</p>\n<p>Note that the data to be downloaded is stored in-memory while the\nuser is connected, so it's a good idea to keep file sizes under a\ncouple hundred megabytes to conserve memory.</p>\n<p>If you want to prevent your app from rerunning when a user clicks the\ndownload button, wrap the download button in a <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/architecture/fragments\">fragment</a>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this button is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents)\nrender. Display unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "data", + "type_name": "str or bytes or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The contents of the file to be downloaded. See example below for\ncaching techniques to avoid recomputing this data unnecessarily.</p>\n", + "default": null + }, + { + "name": "file_name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string to use as the name of the file to be downloaded,\nsuch as 'my_file.csv'. If not specified, the name will be\nautomatically generated.</p>\n", + "default": null + }, + { + "name": "mime", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The MIME type of the data. If None, defaults to "text/plain"\n(if data is of type <em>str</em> or is a textual <em>file</em>) or\n"application/octet-stream" (if data is of type <em>bytes</em> or is a\nbinary <em>file</em>).</p>\n", + "default": "s" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed when the button is\nhovered over.</p>\n", + "default": null + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this button is clicked.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "\"secondary\" or \"primary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. Defaults\nto "secondary".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the download button if set to\nTrue. The default is False.</p>\n", + "default": "False" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to expand the button's width to fill its parent container.\nIf <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default), Streamlit sizes\nthe button to fit its contents. If <tt class=\"docutils literal\">use_container_width</tt> is\n<tt class=\"docutils literal\">True</tt>, the width of the button matches its parent container.</p>\n<p>In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "<p>True if the button was clicked on the last run of the app,\nFalse otherwise.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/button.py#L193" + }, + "streamlit.echo": { + "name": "echo", + "signature": "st.echo(code_location=\"above\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nwith st.echo():\n st.write('This code will be printed')\n</pre>\n</blockquote>\n", + "description": "<p>Use in a <cite>with</cite> block to draw some code on the app, then execute it.</p>\n", + "args": [ + { + "name": "code_location", + "type_name": "\"above\" or \"below\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to show the echoed code before or after the results of the\nexecuted code block.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/echo.py#L30" + }, + "streamlit.empty": { + "name": "empty", + "signature": "st.empty()", + "examples": "<blockquote>\n<p>Overwriting elements in-place using <tt class=\"docutils literal\">with</tt> notation:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport time\n\nwith st.empty():\n for seconds in range(60):\n st.write(f"\u23f3 {seconds} seconds have passed")\n time.sleep(1)\n st.write("\u2714\ufe0f 1 minute over!")\n</pre>\n<p>Replacing several elements, then clearing them:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nplaceholder = st.empty()\n\n# Replace the placeholder with some text:\nplaceholder.text("Hello")\n\n# Replace the text with a chart:\nplaceholder.line_chart({"data": [1, 5, 2, 6]})\n\n# Replace the chart with several elements:\nwith placeholder.container():\n st.write("This is one element")\n st.write("This is another")\n\n# Clear all those elements:\nplaceholder.empty()\n</pre>\n</blockquote>\n", + "description": "<p>Insert a single-element container.</p>\n<p>Inserts a container into your app that can be used to hold a single element.\nThis allows you to, for example, remove elements at any point, or replace\nseveral elements at once (using a child multi-element container).</p>\n<p>To insert/replace/clear an element on the returned container, you can\nuse <tt class=\"docutils literal\">with</tt> notation or just call methods directly on the returned object.\nSee examples below.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/empty.py#L28" + }, + "streamlit.error": { + "name": "error", + "signature": "st.error(body, *, icon=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.error('This is an error', icon="\ud83d\udea8")\n</pre>\n</blockquote>\n", + "description": "<p>Display error message.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The error text to display.</p>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the alert. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/alert.py#L29" + }, + "streamlit.exception": { + "name": "exception", + "signature": "st.exception(exception)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ne = RuntimeError('This is an exception of type RuntimeError')\nst.exception(e)\n</pre>\n</blockquote>\n", + "description": "<p>Display an exception.</p>\n", + "args": [ + { + "name": "exception", + "type_name": "Exception", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The exception to display.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/exception.py#L50" + }, + "streamlit.expander": { + "name": "expander", + "signature": "st.expander(label, expanded=False, *, icon=None)", + "examples": "<blockquote>\n<p>You can use the <tt class=\"docutils literal\">with</tt> notation to insert any element into an expander</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nwith st.expander("See explanation"):\n st.write('''\n The chart above shows some numbers I picked for you.\n I rolled actual dice for these, so they're *guaranteed* to\n be random.\n ''')\n st.image("https://static.streamlit.io/examples/dice.jpg")\n</pre>\n<Cloud name=\"doc-expander\" path=\"\" query=\"\" stylePlaceholder=\"height: 750px\" /><p>Or you can just call methods directly on the returned objects:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.bar_chart({"data": [1, 5, 2, 6, 2, 1]})\n\nexpander = st.expander("See explanation")\nexpander.write('''\n The chart above shows some numbers I picked for you.\n I rolled actual dice for these, so they're *guaranteed* to\n be random.\n''')\nexpander.image("https://static.streamlit.io/examples/dice.jpg")\n</pre>\n<Cloud name=\"doc-expander\" path=\"\" query=\"\" stylePlaceholder=\"height: 750px\" /></blockquote>\n", + "description": "<p>Insert a multi-element container that can be expanded/collapsed.</p>\n<p>Inserts a container into your app that can be used to hold multiple elements\nand can be expanded or collapsed by the user. When collapsed, all that is\nvisible is the provided label.</p>\n<p>To add elements to the returned container, you can use the <tt class=\"docutils literal\">with</tt> notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Currently, you may not put expanders inside another expander.</p>\n</div>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A string to use as the header for the expander. The label can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If True, initializes the expander in "expanded" state. Defaults to\nFalse (collapsed).</p>\n", + "default": "s" + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the expander label. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols </a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/layouts.py#L445" + }, + "streamlit.experimental_connection": { + "name": "experimental_connection", + "signature": "st.experimental_connection(name, type=None, max_entries=None, ttl=None, **kwargs)", + "examples": "<blockquote>\n<p>The easiest way to create a first-party (SQL, Snowflake, or Snowpark) connection is\nto use their default names and define corresponding sections in your <tt class=\"docutils literal\">secrets.toml</tt>\nfile.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn = st.connection("sql") # Config section defined in [connections.sql] in secrets.toml.\n</pre>\n<p>Creating a SQLConnection with a custom name requires you to explicitly specify the\ntype. If type is not passed as a kwarg, it must be set in the appropriate section of\n<tt class=\"docutils literal\">secrets.toml</tt>.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn1 = st.connection("my_sql_connection", type="sql") # Config section defined in [connections.my_sql_connection].\nconn2 = st.connection("my_other_sql_connection") # type must be set in [connections.my_other_sql_connection].\n</pre>\n<p>Passing the full module path to the connection class that you want to use can be\nuseful, especially when working with a custom connection:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn = st.connection("my_sql_connection", type="streamlit.connections.SQLConnection")\n</pre>\n<p>Finally, you can pass the connection class to use directly to this function. Doing\nso allows static type checking tools such as <tt class=\"docutils literal\">mypy</tt> to infer the exact return\ntype of <tt class=\"docutils literal\">st.connection</tt>.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom streamlit.connections import SQLConnection\nconn = st.connection("my_sql_connection", type=SQLConnection)\n</pre>\n</blockquote>\n", + "description": "<p>Create a new connection to a data store or API, or return an existing one.</p>\n<p>Config options, credentials, secrets, etc. for connections are taken from various\nsources:</p>\n<ul class=\"simple\">\n<li>Any connection-specific configuration files.</li>\n<li>An app's <tt class=\"docutils literal\">secrets.toml</tt> files.</li>\n<li>The kwargs passed to this function.</li>\n</ul>\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The connection name used for secrets lookup in <tt class=\"docutils literal\"><span class=\"pre\">[connections.<name>]</span></tt>.\nType will be inferred from passing <tt class=\"docutils literal\">"sql"</tt>, <tt class=\"docutils literal\">"snowflake"</tt>, or <tt class=\"docutils literal\">"snowpark"</tt>.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "str, connection class, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The type of connection to create. It can be a keyword (<tt class=\"docutils literal\">"sql"</tt>, <tt class=\"docutils literal\">"snowflake"</tt>,\nor <tt class=\"docutils literal\">"snowpark"</tt>), a path to an importable class, or an imported class reference.\nAll classes must extend <tt class=\"docutils literal\">st.connections.BaseConnection</tt> and implement the\n<tt class=\"docutils literal\">_connect()</tt> method. If the type kwarg is None, a <tt class=\"docutils literal\">type</tt> field must be set in\nthe connection's section in <tt class=\"docutils literal\">secrets.toml</tt>.</p>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of connections to keep in the cache, or None\nfor an unbounded cache. (When a new entry is added to a full cache,\nthe oldest cached entry will be removed.) The default is None.</p>\n", + "default": "None" + }, + { + "name": "ttl", + "type_name": "float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Additional connection specific kwargs that are passed to the Connection's\n<tt class=\"docutils literal\">_connect()</tt> method. Learn more from the specific Connection's documentation.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Connection object", + "is_generator": false, + "description": "<p>An initialized Connection object of the specified type.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/connection_factory.py#L205" + }, + "streamlit.experimental_data_editor": { + "name": "experimental_data_editor", + "signature": "st.experimental_data_editor(data, *, width=None, height=None, use_container_width=False, hide_index=None, column_order=None, column_config=None, num_rows=\"fixed\", disabled=False, key=None, on_change=None, args=None, kwargs=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n [\n {"command": "st.selectbox", "rating": 4, "is_widget": True},\n {"command": "st.balloons", "rating": 5, "is_widget": False},\n {"command": "st.time_input", "rating": 3, "is_widget": True},\n ]\n)\nedited_df = st.data_editor(df)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n</pre>\n<Cloud name=\"doc-data-editor\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /><p>You can also allow the user to add and delete rows by setting <tt class=\"docutils literal\">num_rows</tt> to "dynamic":</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\n\ndf = pd.DataFrame(\n [\n {"command": "st.selectbox", "rating": 4, "is_widget": True},\n {"command": "st.balloons", "rating": 5, "is_widget": False},\n {"command": "st.time_input", "rating": 3, "is_widget": True},\n ]\n)\nedited_df = st.data_editor(df, num_rows="dynamic")\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n</pre>\n<Cloud name=\"doc-data-editor1\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" /><p>Or you can customize the data editor via <tt class=\"docutils literal\">column_config</tt>, <tt class=\"docutils literal\">hide_index</tt>, <tt class=\"docutils literal\">column_order</tt>, or <tt class=\"docutils literal\">disabled</tt>:</p>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndf = pd.DataFrame(\n [\n {"command": "st.selectbox", "rating": 4, "is_widget": True},\n {"command": "st.balloons", "rating": 5, "is_widget": False},\n {"command": "st.time_input", "rating": 3, "is_widget": True},\n ]\n)\nedited_df = st.data_editor(\n df,\n column_config={\n "command": "Streamlit Command",\n "rating": st.column_config.NumberColumn(\n "Your rating",\n help="How much do you like this command (1-5)?",\n min_value=1,\n max_value=5,\n step=1,\n format="%d \u2b50",\n ),\n "is_widget": "Widget ?",\n },\n disabled=["command", "is_widget"],\n hide_index=True,\n)\n\nfavorite_command = edited_df.loc[edited_df["rating"].idxmax()]["command"]\nst.markdown(f"Your favorite command is **{favorite_command}** \ud83c\udf88")\n</pre>\n<Cloud name=\"doc-data-editor-config\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Display a data editor widget.</p>\n<p>The data editor widget allows you to edit dataframes and many other data structures in a table-like UI.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">When going from <tt class=\"docutils literal\">st.experimental_data_editor</tt> to <tt class=\"docutils literal\">st.data_editor</tt> in\n1.23.0, the data editor's representation in <tt class=\"docutils literal\">st.session_state</tt> was changed.\nThe <tt class=\"docutils literal\">edited_cells</tt> dictionary is now called <tt class=\"docutils literal\">edited_rows</tt> and uses a\ndifferent format (<tt class=\"docutils literal\">{0: {"column name": "edited <span class=\"pre\">value"}}</span></tt> instead of\n<tt class=\"docutils literal\">{"0:1": "edited value"}</tt>). You may need to adjust the code if your app uses\n<tt class=\"docutils literal\">st.experimental_data_editor</tt> in combination with <tt class=\"docutils literal\">st.session_state</tt>.</p>\n</div>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Series, pandas.Styler, pandas.Index, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.DataFrame, list, set, tuple, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The data to edit in the data editor.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<ul class=\"last simple\">\n<li>Styles from <tt class=\"docutils literal\">pandas.Styler</tt> will only be applied to non-editable columns.</li>\n<li>Mixing data types within a column can make the column uneditable.</li>\n<li>Additionally, the following data types are not yet supported for editing:\ncomplex, list, tuple, bytes, bytearray, memoryview, dict, set, frozenset,\nfractions.Fraction, pandas.Interval, and pandas.Period.</li>\n<li>To prevent overflow in JavaScript, columns containing datetime.timedelta\nand pandas.Timedelta values will default to uneditable but this can be\nchanged through column configuration.</li>\n</ul>\n</div>\n", + "default": "to" + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired width of the data editor expressed in pixels. If <tt class=\"docutils literal\">width</tt>\nis <tt class=\"docutils literal\">None</tt> (default), Streamlit sets the data editor width to fit\nits contents up to the width of the parent container. If <tt class=\"docutils literal\">width</tt>\nis greater than the width of the parent container, Streamlit sets\nthe data editor width to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the data editor expressed in pixels. If <tt class=\"docutils literal\">height</tt>\nis <tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height to show at most\nten rows. Vertical scrolling within the data editor element is\nenabled when the height does not accomodate all rows.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default),\nStreamlit sets the data editor's width according to <tt class=\"docutils literal\">width</tt>. If\n<tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets the width of\nthe data editor to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "hide_index", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to hide the index column(s). If <tt class=\"docutils literal\">hide_index</tt> is <tt class=\"docutils literal\">None</tt>\n(default), the visibility of index columns is automatically\ndetermined based on the data.</p>\n", + "default": null + }, + { + "name": "column_order", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the display order of columns. This also affects which columns are\nvisible. For example, <tt class=\"docutils literal\"><span class=\"pre\">column_order=("col2",</span> "col1")</tt> will display 'col2'\nfirst, followed by 'col1', and will hide all other non-index columns. If\nNone (default), the order is inherited from the original data structure.</p>\n", + "default": null + }, + { + "name": "column_config", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Configures how columns are displayed, e.g. their title, visibility, type, or\nformat, as well as editing properties such as min/max value or step.\nThis needs to be a dictionary where each key is a column name and the value\nis one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> to hide the column.</li>\n<li>A string to set the display label of the column.</li>\n<li>One of the column types defined under <tt class=\"docutils literal\">st.column_config</tt>, e.g.\n<tt class=\"docutils literal\"><span class=\"pre\">st.column_config.NumberColumn("Dollar</span> values\u201d, <span class=\"pre\">format=\u201d$</span> %d")</tt> to show\na column as dollar amounts. See more info on the available column types\nand config options <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/data/st.column_config\">here</a>.</li>\n</ul>\n<p>To configure the index column(s), use <tt class=\"docutils literal\">_index</tt> as the column name.</p>\n", + "default": null + }, + { + "name": "num_rows", + "type_name": "\"fixed\" or \"dynamic\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies if the user can add and delete rows in the data editor.\nIf "fixed", the user cannot add or delete rows. If "dynamic", the user can\nadd and delete rows in the data editor, but column sorting is disabled.\nDefaults to "fixed".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Controls the editing of columns. If True, editing is disabled for all columns.\nIf an Iterable of column names is provided (e.g., <tt class=\"docutils literal\"><span class=\"pre\">disabled=("col1",</span> <span class=\"pre\">"col2"))</span></tt>,\nonly the specified columns will be disabled for editing. If False (default),\nall columns that support editing are editable.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string to use as the unique key for this widget. If this\nis omitted, a key will be generated for the widget based on its\ncontent. Multiple widgets of the same type may not share the same\nkey.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional callback invoked when this data_editor's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame, pandas.Series, pyarrow.Table, numpy.ndarray, list, set, tuple, or dict.", + "is_generator": false, + "description": "<p>The edited data. The edited data is returned in its original data type if\nit corresponds to any of the supported return types. All other data types\nare returned as a <tt class=\"docutils literal\">pandas.DataFrame</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/data_editor.py#L583" + }, + "streamlit.experimental_dialog": { + "name": "experimental_dialog", + "signature": "st.experimental_dialog(title, *, width=\"small\")", + "examples": "<blockquote>\n<p>The following example demonstrates the basic usage of <tt class=\"docutils literal\">@st.experimental_dialog</tt>.\nIn this app, clicking "<strong>A</strong>" or "<strong>B</strong>" will open a modal dialog and prompt you\nto enter a reason for your vote. In the modal dialog, click "<strong>Submit</strong>" to record\nyour vote into Session State and rerun the app. This will close the modal dialog\nsince the dialog function is not called during the full-script rerun.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.experimental_dialog("Cast your vote")\ndef vote(item):\n st.write(f"Why is {item} your favorite?")\n reason = st.text_input("Because...")\n if st.button("Submit"):\n st.session_state.vote = {"item": item, "reason": reason}\n st.rerun()\n\nif "vote" not in st.session_state:\n st.write("Vote for your favorite")\n if st.button("A"):\n vote("A")\n if st.button("B"):\n vote("B")\nelse:\n f"You voted for {st.session_state.vote['item']} because {st.session_state.vote['reason']}"\n</pre>\n<Cloud name=\"doc-modal-dialog\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Function decorator to create a modal dialog.</p>\n<p>A function decorated with <tt class=\"docutils literal\">@st.experimental_dialog</tt> becomes a dialog\nfunction. When you call a dialog function, Streamlit inserts a modal dialog\ninto your app. Streamlit element commands called within the dialog function\nrender inside the modal dialog.</p>\n<p>The dialog function can accept arguments that can be passed when it is\ncalled. Any values from the dialog that need to be accessed from the wider\napp should generally be stored in Session State.</p>\n<p>A user can dismiss a modal dialog by clicking outside of it, clicking the\n"<strong>X</strong>" in its upper-right corner, or pressing``ESC`` on their keyboard.\nDismissing a modal dialog does not trigger an app rerun. To close the modal\ndialog programmatically, call <tt class=\"docutils literal\">st.rerun()</tt> explicitly inside of the\ndialog function.</p>\n<p><tt class=\"docutils literal\">st.experimental_dialog</tt> inherits behavior from <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/execution-flow/st.fragment\"><tt class=\"docutils literal\">st.experimental_fragment</tt></a>.\nWhen a user interacts with an input widget created inside a dialog function,\nStreamlit only reruns the dialog function instead of the full script.</p>\n<p>Calling <tt class=\"docutils literal\">st.sidebar</tt> in a dialog function is not supported.</p>\n<p>Dialog code can interact with Session State, imported modules, and other\nStreamlit elements created outside the dialog. Note that these interactions\nare additive across multiple dialog reruns. You are responsible for\nhandling any side effects of that behavior.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Only one dialog function may be called in a script run, which means\nthat only one dialog can be open at any given time. Since a dialog is\nalso a fragment, all fragment limitations apply. Dialogs can't contain\nfragments, and fragments can't contain dialogs. Using dialogs in widget\ncallback functions is not supported.</p>\n</div>\n", + "args": [ + { + "name": "title", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The title to display at the top of the modal dialog. It cannot be empty.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"large\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The width of the modal dialog. If <tt class=\"docutils literal\">width</tt> is <tt class=\"docutils literal\">"small</tt> (default), the\nmodal dialog will be 500 pixels wide. If <tt class=\"docutils literal\">width</tt> is <tt class=\"docutils literal\">"large"</tt>, the\nmodal dialog will be about 750 pixels wide.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/dialog_decorator.py#L97" + }, + "streamlit.experimental_fragment": { + "name": "experimental_fragment", + "signature": "st.experimental_fragment(func=None, *, run_every=None)", + "examples": "<blockquote>\n<p>The following example demonstrates basic usage of\n<tt class=\"docutils literal\">@st.experimental_fragment</tt>. As an anology, "inflating balloons" is a\nslow process that happens outside of the fragment. "Releasing balloons" is\na quick process that happens inside of the fragment.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport time\n\n@st.experimental_fragment\ndef release_the_balloons():\n st.button("Release the balloons", help="Fragment rerun")\n st.balloons()\n\nwith st.spinner("Inflating balloons..."):\n time.sleep(5)\nrelease_the_balloons()\nst.button("Inflate more balloons", help="Full rerun")\n</pre>\n<Cloud name=\"doc-fragment-balloons\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /><p>This next example demonstrates how elements both inside and outside of a\nfragement update with each app or fragment rerun. In this app, clicking\n"Rerun full app" will increment both counters and update all values\ndisplayed in the app. In contrast, clicking "Rerun fragment" will only\nincrement the counter within the fragment. In this case, the <tt class=\"docutils literal\">st.write</tt>\ncommand inside the fragment will update the app's frontend, but the two\n<tt class=\"docutils literal\">st.write</tt> commands outside the fragment will not update the frontend.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nif "app_runs" not in st.session_state:\n st.session_state.app_runs = 0\n st.session_state.fragment_runs = 0\n\n@st.experimental_fragment\ndef fragment():\n st.session_state.fragment_runs += 1\n st.button("Rerun fragment")\n st.write(f"Fragment says it ran {st.session_state.fragment_runs} times.")\n\nst.session_state.app_runs += 1\nfragment()\nst.button("Rerun full app")\nst.write(f"Full app says it ran {st.session_state.app_runs} times.")\nst.write(f"Full app sees that fragment ran {st.session_state.fragment_runs} times.")\n</pre>\n<Cloud name=\"doc-fragment\" path=\"\" query=\"\" stylePlaceholder=\"height: 400px\" /><p>You can also trigger an app rerun from inside a fragment by calling\n<tt class=\"docutils literal\">st.rerun</tt>.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nif "clicks" not in st.session_state:\n st.session_state.clicks = 0\n\n@st.experimental_fragment\ndef count_to_five():\n if st.button("Plus one!"):\n st.session_state.clicks += 1\n if st.session_state.clicks % 5 == 0:\n st.rerun()\n return\n\ncount_to_five()\nst.header(f"Multiples of five clicks: {st.session_state.clicks // 5}")\n\nif st.button("Check click count"):\n st.toast(f"## Total clicks: {st.session_state.clicks}")\n</pre>\n<Cloud name=\"doc-fragment-rerun\" path=\"\" query=\"\" stylePlaceholder=\"height: 400px\" /></blockquote>\n", + "description": "<p>Decorator to turn a function into a fragment which can rerun independently of the full app.</p>\n<p>When a user interacts with an input widget created inside a fragment,\nStreamlit only reruns the fragment instead of the full app. If\n<tt class=\"docutils literal\">run_every</tt> is set, Streamlit will also rerun the fragment at the\nspecified interval while the session is active, even if the user is not\ninteracting with your app.</p>\n<p>To trigger an app rerun from inside a fragment, call <tt class=\"docutils literal\">st.rerun()</tt>\ndirectly. Any values from the fragment that need to be accessed from\nthe wider app should generally be stored in Session State.</p>\n<p>When Streamlit element commands are called directly in a fragment, the\nelements are cleared and redrawn on each fragment rerun, just like all\nelements are redrawn on each app rerun. The rest of the app is persisted\nduring a fragment rerun. When a fragment renders elements into externally\ncreated containers, the elements will not be cleared with each fragment\nrerun. Instead, elements will accumulate in those containers with each\nfragment rerun, until the next app rerun.</p>\n<p>Calling <tt class=\"docutils literal\">st.sidebar</tt> in a fragment is not supported. To write elements to\nthe sidebar with a fragment, call your fragment function inside a\n<tt class=\"docutils literal\">with st.sidebar</tt> context manager.</p>\n<p>Fragment code can interact with Session State, imported modules, and\nother Streamlit elements created outside the fragment. Note that these\ninteractions are additive across multiple fragment reruns. You are\nresponsible for handling any side effects of that behavior.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<ul class=\"last simple\">\n<li>Fragments can't contain other fragments. Additionally, using\nfragments in widget callback functions is not supported.</li>\n<li>Fragments can only contain widgets in their main body. Fragments\ncan't render widgets to externally created containers.</li>\n</ul>\n</div>\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The function to turn into a fragment.</p>\n", + "default": null + }, + { + "name": "run_every", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The time interval between automatic fragment reruns. This can be one of\nthe following:</p>\n<blockquote>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default).</li>\n<li>An <tt class=\"docutils literal\">int</tt> or <tt class=\"docutils literal\">float</tt> specifying the interval in seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas'\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"1d"</tt>, <tt class=\"docutils literal\">"1.5 days"</tt>, or <tt class=\"docutils literal\">"1h23s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(days=1)</tt>.</li>\n</ul>\n</blockquote>\n<p>If <tt class=\"docutils literal\">run_every</tt> is <tt class=\"docutils literal\">None</tt>, the fragment will only rerun from\nuser-triggered events.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/fragment.py#L223" + }, + "streamlit.experimental_get_query_params": { + "name": "experimental_get_query_params", + "signature": "st.experimental_get_query_params()", + "example": "<blockquote>\n<p>Let's say the user's web browser is at\n<cite>http://localhost:8501/?show_map=True&selected=asia&selected=america</cite>.\nThen, you can get the query parameters using the following:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.experimental_get_query_params()\n{"show_map": ["True"], "selected": ["asia", "america"]}\n</pre>\n<p>Note that the values in the returned dict are <em>always</em> lists. This is\nbecause we internally use Python's urllib.parse.parse_qs(), which behaves\nthis way. And this behavior makes sense when you consider that every item\nin a query string is potentially a 1-element array.</p>\n</blockquote>\n", + "description": "<p>Return the query parameters that is currently showing in the browser's URL bar.</p>\n", + "args": [], + "returns": [ + { + "type_name": "dict", + "is_generator": false, + "description": "<p>The current query parameters as a dict. "Query parameters" are the part of the URL that comes\nafter the first "?".</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/experimental_query_params.py#L32" + }, + "streamlit.experimental_memo": { + "name": "experimental_memo", + "signature": "st.experimental_memo(func=None, *, ttl, max_entries, show_spinner, persist, experimental_allow_widgets, hash_funcs=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n\nd1 = fetch_and_clean_data(DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nd2 = fetch_and_clean_data(DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the data in d1 is the same as in d2.\n\nd3 = fetch_and_clean_data(DATA_URL_2)\n# This is a different URL, so the function executes.\n</pre>\n<p>To set the <tt class=\"docutils literal\">persist</tt> parameter, use this command as follows:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data(persist="disk")\ndef fetch_and_clean_data(url):\n # Fetch data from URL here, and then clean it up.\n return data\n</pre>\n<p>By default, all parameters to a cached function must be hashable.\nAny parameter whose name begins with <tt class=\"docutils literal\">_</tt> will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n # Fetch data from _db_connection here, and then clean it up.\n return data\n\nconnection = make_database_connection()\nd1 = fetch_and_clean_data(connection, num_rows=10)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\nanother_connection = make_database_connection()\nd2 = fetch_and_clean_data(another_connection, num_rows=10)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _database_connection parameter was different\n# in both calls.\n</pre>\n<p>A cached function's cache can be procedurally cleared:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_data\ndef fetch_and_clean_data(_db_connection, num_rows):\n # Fetch data from _db_connection here, and then clean it up.\n return data\n\nfetch_and_clean_data.clear(_db_connection, 50)\n# Clear the cached entry for the arguments provided.\n\nfetch_and_clean_data.clear()\n# Clear all cached entries for this function.\n</pre>\n<p>To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. <tt class=\"docutils literal\">datetime.datetime</tt>) to a hash\nfunction (<tt class=\"docutils literal\">lambda dt: dt.isoformat()</tt>) like this:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={datetime.datetime: lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n return dt.astimezone(datetime.timezone.utc)\n</pre>\n<p>Alternatively, you can map the type's fully-qualified name\n(e.g. <tt class=\"docutils literal\">"datetime.datetime"</tt>) to the hash function instead:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport datetime\n\n@st.cache_data(hash_funcs={"datetime.datetime": lambda dt: dt.isoformat()})\ndef convert_to_utc(dt: datetime.datetime):\n return dt.astimezone(datetime.timezone.utc)\n</pre>\n</blockquote>\n", + "description": "<p>Decorator to cache functions that return data (e.g. dataframe transforms, database queries, ML inference).</p>\n<p>Cached objects are stored in "pickled" form, which means that the return\nvalue of a cached function must be pickleable. Each caller of the cached\nfunction gets its own copy of the cached data.</p>\n<p>You can clear a function's cache with <tt class=\"docutils literal\">func.clear()</tt> or clear the entire\ncache with <tt class=\"docutils literal\">st.cache_data.clear()</tt>.</p>\n<p>To cache global resources, use <tt class=\"docutils literal\">st.cache_resource</tt> instead. Learn more\nabout caching at <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/architecture/caching\">https://docs.streamlit.io/develop/concepts/architecture/caching</a>.</p>\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The function to cache. Streamlit hashes the function's source code.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum time to keep an entry in the cache. Can be one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> if cache entries should never expire (default).</li>\n<li>A number specifying the time in seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas's\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"1d"</tt>, <tt class=\"docutils literal\">"1.5 days"</tt>, or <tt class=\"docutils literal\">"1h23s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(days=1)</tt>.</li>\n</ul>\n<p>Note that <tt class=\"docutils literal\">ttl</tt> will be ignored if <tt class=\"docutils literal\"><span class=\"pre\">persist="disk"</span></tt> or <tt class=\"docutils literal\">persist=True</tt>.</p>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. When a new entry is added to a full cache,\nthe oldest cached entry will be removed. Defaults to None.</p>\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached data is being created. If string,\nvalue of show_spinner param will be used for spinner text.</p>\n", + "default": "True" + }, + { + "name": "persist", + "type_name": "\"disk\", bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Optional location to persist cached data to. Passing "disk" (or True)\nwill persist the cached data to the local disk. None (or False) will disable\npersistence. The default is None.</p>\n", + "default": "None" + }, + { + "name": "experimental_allow_widgets", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.</p>\n", + "default": "False", + "deprecated": { + "deprecated": true, + "deprecatedText": "<p><tt class=\"docutils literal\">experimental_allow_widgets</tt> is deprecated and will be removed in\na later version.</p>\n" + } + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_data_api.py#L396" + }, + "streamlit.experimental_rerun": { + "name": "experimental_rerun", + "signature": "st.experimental_rerun()", + "description": "<p>Rerun the script immediately.</p>\n<p>When <tt class=\"docutils literal\">st.experimental_rerun()</tt> is called, the script is halted - no\nmore statements will be run, and the script will be queued to re-run\nfrom the top.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/execution_control.py#L82" + }, + "streamlit.experimental_set_query_params": { + "name": "experimental_set_query_params", + "signature": "st.experimental_set_query_params(**query_params)", + "example": "<blockquote>\n<p>To point the user's web browser to something like\n"<a class=\"reference external\" href=\"http://localhost:8501/?show_map=True&selected=asia&selected=america\">http://localhost:8501/?show_map=True&selected=asia&selected=america</a>",\nyou would do the following:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.experimental_set_query_params(\n show_map=True,\n selected=["asia", "america"],\n)\n</pre>\n</blockquote>\n", + "description": "<p>Set the query parameters that are shown in the browser's URL bar.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Query param <cite>embed</cite> cannot be set using this method.</p>\n</div>\n", + "args": [ + { + "name": "**query_params", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The query parameters to set, as key-value pairs.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/experimental_query_params.py#L70" + }, + "streamlit.experimental_singleton": { + "name": "experimental_singleton", + "signature": "st.experimental_singleton(func, *, ttl, max_entries, show_spinner, validate, experimental_allow_widgets, hash_funcs=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(url):\n # Create a database session object that points to the URL.\n return session\n\ns1 = get_database_session(SESSION_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(SESSION_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value. This means that now the connection object in s1 is the same as in s2.\n\ns3 = get_database_session(SESSION_URL_2)\n# This is a different URL, so the function executes.\n</pre>\n<p>By default, all parameters to a cache_resource function must be hashable.\nAny parameter whose name begins with <tt class=\"docutils literal\">_</tt> will not be hashed. You can use\nthis as an "escape hatch" for parameters that are not hashable:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n # Create a database connection object that points to the URL.\n return connection\n\ns1 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Actually executes the function, since this is the first time it was\n# encountered.\n\ns2 = get_database_session(create_sessionmaker(), DATA_URL_1)\n# Does not execute the function. Instead, returns its previously computed\n# value - even though the _sessionmaker parameter was different\n# in both calls.\n</pre>\n<p>A cache_resource function's cache can be procedurally cleared:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\n@st.cache_resource\ndef get_database_session(_sessionmaker, url):\n # Create a database connection object that points to the URL.\n return connection\n\nfetch_and_clean_data.clear(_sessionmaker, "https://streamlit.io/")\n# Clear the cached entry for the arguments provided.\n\nget_database_session.clear()\n# Clear all cached entries for this function.\n</pre>\n<p>To override the default hashing behavior, pass a custom hash function.\nYou can do that by mapping a type (e.g. <tt class=\"docutils literal\">Person</tt>) to a hash\nfunction (<tt class=\"docutils literal\">str</tt>) like this:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n name: str\n\n@st.cache_resource(hash_funcs={Person: str})\ndef get_person_name(person: Person):\n return person.name\n</pre>\n<p>Alternatively, you can map the type's fully-qualified name\n(e.g. <tt class=\"docutils literal\">"__main__.Person"</tt>) to the hash function instead:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom pydantic import BaseModel\n\nclass Person(BaseModel):\n name: str\n\n@st.cache_resource(hash_funcs={"__main__.Person": str})\ndef get_person_name(person: Person):\n return person.name\n</pre>\n</blockquote>\n", + "description": "<p>Decorator to cache functions that return global resources (e.g. database connections, ML models).</p>\n<p>Cached objects are shared across all users, sessions, and reruns. They\nmust be thread-safe because they can be accessed from multiple threads\nconcurrently. If thread safety is an issue, consider using <tt class=\"docutils literal\">st.session_state</tt>\nto store resources per session instead.</p>\n<p>You can clear a function's cache with <tt class=\"docutils literal\">func.clear()</tt> or clear the entire\ncache with <tt class=\"docutils literal\">st.cache_resource.clear()</tt>.</p>\n<p>To cache data, use <tt class=\"docutils literal\">st.cache_data</tt> instead. Learn more about caching at\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/architecture/caching\">https://docs.streamlit.io/develop/concepts/architecture/caching</a>.</p>\n", + "args": [ + { + "name": "func", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The function that creates the cached resource. Streamlit hashes the\nfunction's source code.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum time to keep an entry in the cache. Can be one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> if cache entries should never expire (default).</li>\n<li>A number specifying the time in seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas's\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"1d"</tt>, <tt class=\"docutils literal\">"1.5 days"</tt>, or <tt class=\"docutils literal\">"1h23s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(days=1)</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "max_entries", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of entries to keep in the cache, or None\nfor an unbounded cache. When a new entry is added to a full cache,\nthe oldest cached entry will be removed. Defaults to None.</p>\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "bool or str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. Default is True to show a spinner when there is\na "cache miss" and the cached resource is being created. If string,\nvalue of show_spinner param will be used for spinner text.</p>\n", + "default": "True" + }, + { + "name": "validate", + "type_name": "callable or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional validation function for cached data. <tt class=\"docutils literal\">validate</tt> is called\neach time the cached value is accessed. It receives the cached value as\nits only parameter and it must return a boolean. If <tt class=\"docutils literal\">validate</tt> returns\nFalse, the current cached value is discarded, and the decorated function\nis called to compute a new value. This is useful e.g. to check the\nhealth of database connections.</p>\n", + "default": null + }, + { + "name": "experimental_allow_widgets", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Allow widgets to be used in the cached function. Defaults to False.\nSupport for widgets in cached functions is currently experimental.\nSetting this parameter to True may lead to excessive memory use since the\nwidget value is treated as an additional input parameter to the cache.</p>\n", + "default": "False", + "deprecated": { + "deprecated": true, + "deprecatedText": "<p><tt class=\"docutils literal\">experimental_allow_widgets</tt> is deprecated and will be removed in\na later version.</p>\n" + } + }, + { + "name": "hash_funcs", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Mapping of types or fully qualified names to hash functions.\nThis is used to override the behavior of the hasher inside Streamlit's\ncaching mechanism: when the hasher encounters an object, it will first\ncheck to see if its type matches a key in this dict and, if so, will use\nthe provided function to generate a hash for it. See below for an example\nof how this can be used.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_resource_api.py#L265" + }, + "streamlit.file_uploader": { + "name": "file_uploader", + "signature": "st.file_uploader(label, type=None, accept_multiple_files=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "examples": "<blockquote>\n<p>Insert a file uploader that accepts a single file at a time:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nfrom io import StringIO\n\nuploaded_file = st.file_uploader("Choose a file")\nif uploaded_file is not None:\n # To read file as bytes:\n bytes_data = uploaded_file.getvalue()\n st.write(bytes_data)\n\n # To convert to a string based IO:\n stringio = StringIO(uploaded_file.getvalue().decode("utf-8"))\n st.write(stringio)\n\n # To read file as string:\n string_data = stringio.read()\n st.write(string_data)\n\n # Can be used wherever a "file-like" object is accepted:\n dataframe = pd.read_csv(uploaded_file)\n st.write(dataframe)\n</pre>\n<p>Insert a file uploader that accepts multiple files at a time:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nuploaded_files = st.file_uploader("Choose a CSV file", accept_multiple_files=True)\nfor uploaded_file in uploaded_files:\n bytes_data = uploaded_file.read()\n st.write("filename:", uploaded_file.name)\n st.write(bytes_data)\n</pre>\n<Cloud name=\"doc-file-uploader\" path=\"\" query=\"\" stylePlaceholder=\"height: 375px\" /></blockquote>\n", + "description": "<p>Display a file uploader widget.</p>\n<p>By default, uploaded files are limited to 200MB. You can configure\nthis using the <tt class=\"docutils literal\">server.maxUploadSize</tt> config option. For more info\non how to set config options, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/configuration/config.toml\">https://docs.streamlit.io/develop/api-reference/configuration/config.toml</a></p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this file uploader is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "str or list of str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Array of allowed extensions. ['png', 'jpg']\nThe default is None, which means all extensions are allowed.</p>\n", + "default": "None" + }, + { + "name": "accept_multiple_files", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If True, allows the user to upload multiple files at the same time,\nin which case the return value will be a list of files.\nDefault: False</p>\n", + "default": "False" + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A tooltip that gets displayed next to the file uploader.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this file_uploader's value\nchanges.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the file uploader if set to\nTrue. The default is False. This argument can only be supplied by\nkeyword.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "None or UploadedFile or list of UploadedFile", + "is_generator": false, + "description": "<ul class=\"simple\">\n<li>If accept_multiple_files is False, returns either None or\nan UploadedFile object.</li>\n<li>If accept_multiple_files is True, returns a list with the\nuploaded files as UploadedFile objects. If no files were\nuploaded, returns an empty list.</li>\n</ul>\n<p>The UploadedFile class is a subclass of BytesIO, and therefore\nit is "file-like". This means you can pass them anywhere where\na file is expected.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/file_uploader.py#L226" + }, + "streamlit.form": { + "name": "form", + "signature": "st.form(key, clear_on_submit=False, *, border=True)", + "examples": "<blockquote>\n<p>Inserting elements using <tt class=\"docutils literal\">with</tt> notation:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nwith st.form("my_form"):\n st.write("Inside the form")\n slider_val = st.slider("Form slider")\n checkbox_val = st.checkbox("Form checkbox")\n\n # Every form must have a submit button.\n submitted = st.form_submit_button("Submit")\n if submitted:\n st.write("slider", slider_val, "checkbox", checkbox_val)\n\nst.write("Outside the form")\n</pre>\n<Cloud name=\"doc-form1\" path=\"\" query=\"\" stylePlaceholder=\"height: 425px\" /><p>Inserting elements out of order:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nform = st.form("my_form")\nform.slider("Inside the form")\nst.slider("Outside the form")\n\n# Now add a submit button to the form:\nform.form_submit_button("Submit")\n</pre>\n<Cloud name=\"doc-form2\" path=\"\" query=\"\" stylePlaceholder=\"height: 375px\" /></blockquote>\n", + "description": "<p>Create a form that batches elements together with a "Submit" button.</p>\n<p>A form is a container that visually groups other elements and\nwidgets together, and contains a Submit button. When the form's\nSubmit button is pressed, all widget values inside the form will be\nsent to Streamlit in a batch.</p>\n<p>To add elements to a form object, you can use <tt class=\"docutils literal\">with</tt> notation\n(preferred) or just call methods directly on the form. See\nexamples below.</p>\n<p>Forms have a few constraints:</p>\n<ul class=\"simple\">\n<li>Every form must contain a <tt class=\"docutils literal\">st.form_submit_button</tt>.</li>\n<li><tt class=\"docutils literal\">st.button</tt> and <tt class=\"docutils literal\">st.download_button</tt> cannot be added to a form.</li>\n<li>Forms can appear anywhere in your app (sidebar, columns, etc),\nbut they cannot be embedded inside other forms.</li>\n<li>Within a form, the only widget that can have a callback function is\n<tt class=\"docutils literal\">st.form_submit_button</tt>.</li>\n</ul>\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A string that identifies the form. Each form must have its own\nkey. (This key is not displayed to the user in the interface.)</p>\n", + "default": null + }, + { + "name": "clear_on_submit", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If True, all widgets inside the form will be reset to their default\nvalues after the user presses the Submit button. Defaults to False.\n(Note that Custom Components are unaffected by this flag, and\nwill not be reset to their defaults on form submission.)</p>\n", + "default": "values" + }, + { + "name": "border", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to show a border around the form. Defaults to True.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Not showing a border can be confusing to viewers since interacting with a\nwidget in the form will do nothing. You should only remove the border if\nthere's another border (e.g. because of an expander) or the form is small\n(e.g. just a text input and a submit button).</p>\n</div>\n", + "default": "True" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/form.py#L115" + }, + "streamlit.form_submit_button": { + "name": "form_submit_button", + "signature": "st.form_submit_button(label=\"Submit\", help=None, on_click=None, args=None, kwargs=None, *, type=\"secondary\", disabled=False, use_container_width=False)", + "description": "<p>Display a form submit button.</p>\n<p>When this button is clicked, all widget values inside the form will be\nsent to Streamlit in a batch.</p>\n<p>Every form must have a form_submit_button. A form_submit_button\ncannot exist outside a form.</p>\n<p>For more information about forms, check out our\n<a class=\"reference external\" href=\"https://blog.streamlit.io/introducing-submit-button-and-forms/\">blog post</a>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this button is for.\nDefaults to "Submit".</p>\n", + "default": "s" + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A tooltip that gets displayed when the button is hovered over.\nDefaults to None.</p>\n", + "default": "None" + }, + { + "name": "on_click", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this button is clicked.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "\"secondary\" or \"primary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. Defaults\nto "secondary".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the button if set to True. The\ndefault is False.</p>\n", + "default": "False" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to expand the button's width to fill its parent container.\nIf <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default), Streamlit sizes\nthe button to fit its contents. If <tt class=\"docutils literal\">use_container_width</tt> is\n<tt class=\"docutils literal\">True</tt>, the width of the button matches its parent container.</p>\n<p>In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "<p>True if the button was clicked.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/form.py#L230" + }, + "streamlit.get_option": { + "name": "get_option", + "signature": "st.get_option(key)", + "description": "<p>Return the current value of a given Streamlit config option.</p>\n<p>Run <cite>streamlit config show</cite> in the terminal to see all available options.</p>\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The config option key of the form "section.optionName". To see all\navailable options, run <cite>streamlit config show</cite> on a terminal.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/config.py#L128" + }, + "streamlit.graphviz_chart": { + "name": "graphviz_chart", + "signature": "st.graphviz_chart(figure_or_dot, use_container_width=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport graphviz\n\n# Create a graphlib graph object\ngraph = graphviz.Digraph()\ngraph.edge('run', 'intr')\ngraph.edge('intr', 'runbl')\ngraph.edge('runbl', 'run')\ngraph.edge('run', 'kernel')\ngraph.edge('kernel', 'zombie')\ngraph.edge('kernel', 'sleep')\ngraph.edge('kernel', 'runmem')\ngraph.edge('sleep', 'swap')\ngraph.edge('swap', 'runswap')\ngraph.edge('runswap', 'new')\ngraph.edge('runswap', 'runmem')\ngraph.edge('new', 'runmem')\ngraph.edge('sleep', 'runmem')\n\nst.graphviz_chart(graph)\n</pre>\n<p>Or you can render the chart from the graph using GraphViz's Dot\nlanguage:</p>\n<pre class=\"doctest-block\">\nst.graphviz_chart('''\n digraph {\n run -> intr\n intr -> runbl\n runbl -> run\n run -> kernel\n kernel -> zombie\n kernel -> sleep\n kernel -> runmem\n sleep -> swap\n swap -> runswap\n runswap -> new\n runswap -> runmem\n new -> runmem\n sleep -> runmem\n }\n''')\n</pre>\n<Cloud name=\"doc-graphviz-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" /></blockquote>\n", + "description": "<p>Display a graph using the dagre-d3 library.</p>\n", + "args": [ + { + "name": "figure_or_dot", + "type_name": "graphviz.dot.Graph, graphviz.dot.Digraph, str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The Graphlib graph object or dot string to display</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets\nthe width of the figure to match the width of the parent container.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/graphviz_chart.py#L39" + }, + "streamlit.header": { + "name": "header", + "signature": "st.header(body, anchor=None, *, help=None, divider=False)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.header('This is a header with a divider', divider='rainbow')\nst.header('_Streamlit_ is :blue[cool] :sunglasses:')\n</pre>\n<Cloud name=\"doc-header\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display text in header formatting.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: <a class=\"reference external\" href=\"https://github.github.com/gfm\">https://github.github.com/gfm</a>.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the header.</p>\n", + "default": null + }, + { + "name": "divider", + "type_name": "bool or \u201cblue\u201d, \u201cgreen\u201d, \u201corange\u201d, \u201cred\u201d, \u201cviolet\u201d, \u201cgray\u201d/\"grey\", or \u201crainbow\u201d", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Shows a colored divider below the header. If True, successive\nheaders will cycle through divider colors. That is, the first\nheader will have a blue line, the second header will have a\ngreen line, and so on. If a string, the color can be set to one of\nthe following: blue, green, orange, red, violet, gray/grey, or\nrainbow.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/heading.py#L43" + }, + "streamlit.help": { + "name": "help", + "signature": "st.help(obj=<module 'streamlit' from '/Users/dmatthews/Documents/GitHub/streamlit/lib/streamlit/__init__.py'>)", + "example": "<blockquote>\n<p>Don't remember how to initialize a dataframe? Try this:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas\n\nst.help(pandas.DataFrame)\n</pre>\n<Cloud name=\"doc-string\" path=\"\" query=\"\" stylePlaceholder=\"height: 700px\" /><p>Want to quickly check what data type is output by a certain function?\nTry:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nx = my_poorly_documented_function()\nst.help(x)\n</pre>\n<p>Want to quickly inspect an object? No sweat:</p>\n<pre class=\"doctest-block\">\nclass Dog:\n '''A typical dog.'''\n\n def __init__(self, breed, color):\n self.breed = breed\n self.color = color\n\n def bark(self):\n return 'Woof!'\n\n\nfido = Dog('poodle', 'white')\n\nst.help(fido)\n</pre>\n<Cloud name=\"doc-string1\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /><p>And if you're using Magic, you can get help for functions, classes,\nand modules without even typing <tt class=\"docutils literal\">st.help</tt>:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas\n\n# Get help for Pandas read_csv:\npandas.read_csv\n\n# Get help for Streamlit itself:\nst\n</pre>\n<Cloud name=\"doc-string2\" path=\"\" query=\"\" stylePlaceholder=\"height: 700px\" /></blockquote>\n", + "description": "<p>Display help and other information for a given object.</p>\n<p>Depending on the type of object that is passed in, this displays the\nobject's name, type, value, signature, docstring, and member variables,\nmethods \u2014 as well as the values/docstring of members and methods.</p>\n", + "args": [ + { + "name": "obj", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The object whose information should be displayed. If left\nunspecified, this call will display help for Streamlit itself.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/doc_string.py#L44" + }, + "streamlit.html": { + "name": "html", + "signature": "st.html(body)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.html("<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>")\n</pre>\n<Cloud name=\"doc-html\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Insert HTML into your app.</p>\n<p>Adding custom HTML to your app impacts safety, styling, and\nmaintainability. We sanitize HTML with <a class=\"reference external\" href=\"https://github.com/cure53/DOMPurify\">DOMPurify</a>, but inserting HTML remains a\ndeveloper risk. Passing untrusted code to <tt class=\"docutils literal\">st.html</tt> or dynamically\nloading external code can increase the risk of vulnerabilities in your\napp.</p>\n<p><tt class=\"docutils literal\">st.html</tt> content is <strong>not</strong> iframed. Executing JavaScript is not\nsupported at this time.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The HTML code to insert, or path to an HTML code file which is\nloaded and inserted.</p>\n<p>If the provided string is the path of a local file, Streamlit will\nload the file and render its contents as HTML. Otherwise, Streamlit\nwill render the string directly as HTML.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/html.py#L29" + }, + "streamlit.image": { + "name": "image", + "signature": "st.image(image, caption=None, width=None, use_column_width=None, clamp=False, channels=\"RGB\", output_format=\"auto\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nst.image('sunrise.jpg', caption='Sunrise by the mountains')\n</pre>\n<Cloud name=\"doc-image\" path=\"\" query=\"\" stylePlaceholder=\"height: 710px\" /></blockquote>\n", + "description": "<p>Display an image or list of images.</p>\n", + "args": [ + { + "name": "image", + "type_name": "numpy.ndarray, [numpy.ndarray], BytesIO, str, or [str]", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Monochrome image of shape (w,h) or (w,h,1)\nOR a color image of shape (w,h,3)\nOR an RGBA image of shape (w,h,4)\nOR a URL to fetch the image from\nOR a path of a local image file\nOR an SVG XML string like <cite><svg xmlns=...</svg></cite>\nOR a list of one of the above, to display multiple images.</p>\n", + "default": null + }, + { + "name": "caption", + "type_name": "str or list of str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Image caption. If displaying multiple images, caption should be a\nlist of captions (one for each image).</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Image width. None means use the image width,\nbut do not exceed the width of the column.\nShould be set for SVG images, as they have no default image width.</p>\n", + "default": "image" + }, + { + "name": "use_column_width", + "type_name": "\"auto\", \"always\", \"never\", or bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If "auto", set the image's width to its natural size,\nbut do not exceed the width of the column.\nIf "always" or True, set the image's width to the column width.\nIf "never" or False, set the image's width to its natural size.\nNote: if set, <cite>use_column_width</cite> takes precedence over the <cite>width</cite> parameter.</p>\n", + "default": null + }, + { + "name": "clamp", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Clamp image pixel values to a valid range ([0-255] per channel).\nThis is only meaningful for byte array images; the parameter is\nignored for image URLs. If this is not set, and an image has an\nout-of-range value, an error will be thrown.</p>\n", + "default": null + }, + { + "name": "channels", + "type_name": "\"RGB\" or \"BGR\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If image is an nd.array, this parameter denotes the format used to\nrepresent color information. Defaults to "RGB", meaning\n<cite>image[:, :, 0]</cite> is the red channel, <cite>image[:, :, 1]</cite> is green, and\n<cite>image[:, :, 2]</cite> is blue. For images coming from libraries like\nOpenCV you should set this to "BGR", instead.</p>\n", + "default": "s" + }, + { + "name": "output_format", + "type_name": "\"JPEG\", \"PNG\", or \"auto\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>This parameter specifies the format to use when transferring the\nimage data. Photos should use the JPEG format for lossy compression\nwhile diagrams should use the PNG format for lossless compression.\nDefaults to "auto" which identifies the compression type based\non the type and format of the image argument.</p>\n", + "default": "s" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/image.py#L84" + }, + "streamlit.info": { + "name": "info", + "signature": "st.info(body, *, icon=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.info('This is a purely informational message', icon="\u2139\ufe0f")\n</pre>\n</blockquote>\n", + "description": "<p>Display an informational message.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The info text to display.</p>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the alert. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/alert.py#L116" + }, + "streamlit.json": { + "name": "json", + "signature": "st.json(body, *, expanded=True)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.json({\n 'foo': 'bar',\n 'baz': 'boz',\n 'stuff': [\n 'stuff 1',\n 'stuff 2',\n 'stuff 3',\n 'stuff 5',\n ],\n})\n</pre>\n<Cloud name=\"doc-json\" path=\"\" query=\"\" stylePlaceholder=\"height: 385px\" /></blockquote>\n", + "description": "<p>Display object or string as a pretty-printed JSON string.</p>\n", + "args": [ + { + "name": "body", + "type_name": "object or str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The object to print as JSON. All referenced objects should be\nserializable to JSON as well. If object is a string, we assume it\ncontains serialized JSON.</p>\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean that allows the user to set whether the initial\nstate of this json element should be expanded. Defaults to True.</p>\n", + "default": "True" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/json.py#L37" + }, + "streamlit.latex": { + "name": "latex", + "signature": "st.latex(body, *, help=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.latex(r'''\n a + ar + a r^2 + a r^3 + \\cdots + a r^{n-1} =\n \\sum_{k=0}^{n-1} ar^k =\n a \\left(\\frac{1-r^{n}}{1-r}\\right)\n ''')\n</pre>\n</blockquote>\n", + "description": "<p>Display mathematical expressions formatted as LaTeX.</p>\n<p>Supported LaTeX functions are listed at\n<a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str or SymPy expression", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The string or SymPy expression to display as LaTeX. If str, it's\na good idea to use raw Python strings since LaTeX uses backslashes\na lot.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the LaTeX expression.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/markdown.py#L222" + }, + "streamlit.line_chart": { + "name": "line_chart", + "signature": "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)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.line_chart(chart_data)\n</pre>\n<Cloud name=\"doc-line-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>You can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(\n {\n "col1": np.random.randn(20),\n "col2": np.random.randn(20),\n "col3": np.random.choice(["A", "B", "C"], 20),\n }\n)\n\nst.line_chart(chart_data, x="col1", y="col2", color="col3")\n</pre>\n<Cloud name=\"doc-line-chart1\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>Finally, if your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple lines with different\ncolors:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["col1", "col2", "col3"])\n\nst.line_chart(\n chart_data, x="col1", y=["col2", "col3"], color=["#FF0000", "#0000FF"] # Optional\n)\n</pre>\n<Cloud name=\"doc-line-chart2\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /></blockquote>\n", + "description": "<p>Display a line chart.</p>\n<p>This is syntax-sugar around <tt class=\"docutils literal\">st.altair_chart</tt>. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.</p>\n<p>If <tt class=\"docutils literal\">st.line_chart</tt> does not guess the data specification\ncorrectly, try specifying your desired chart using <tt class=\"docutils literal\">st.altair_chart</tt>.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Data to be plotted.</p>\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name or key associated to the x-axis data. If <tt class=\"docutils literal\">x</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit uses the data index for the x-axis\nvalues.</p>\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name(s) or key(s) associated to the y-axis data. If this is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a <tt class=\"docutils literal\">Sequence</tt> of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.</p>\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the x-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name specified in <tt class=\"docutils literal\">x</tt> if available, or else\nno label will be displayed.</p>\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the y-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name(s) specified in <tt class=\"docutils literal\">y</tt> if available, or\nelse no label will be displayed.</p>\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The color to use for different lines in this chart.</p>\n<p>For a line chart with just one line, this can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default color.</li>\n<li>A hex string like "#ffaa00" or "#ffaa0088".</li>\n<li>An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.</li>\n</ul>\n<p>For a line chart with multiple lines, where the dataframe is in\nlong format (that is, y is None or just one column), this can be:</p>\n<ul>\n<li><p class=\"first\">None, to use the default colors.</p>\n</li>\n<li><p class=\"first\">The name of a column in the dataset. Data points will be grouped\ninto lines of the same color based on the value of this column.\nIn addition, if the values in this column match one of the color\nformats above (hex string or color tuple), then that color will\nbe used.</p>\n<p>For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints will be grouped into three lines whose colors will be\nautomatically selected from the default palette.</p>\n<p>But, if for the same 1000-row dataset, this column contained\nthe values "#ffaa00", "#f0f", "#0000ff", then then those 1000\ndatapoints would still be grouped into three lines, but their\ncolors would be "#ffaa00", "#f0f", "#0000ff" this time around.</p>\n</li>\n</ul>\n<p>For a line chart with multiple lines, where the dataframe is in\nwide format (that is, y is a Sequence of columns), this can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default colors.</li>\n<li>A list of string colors or color tuples to be used for each of\nthe lines in the chart. This list should have the same length\nas the number of y values (e.g. <tt class=\"docutils literal\"><span class=\"pre\">color=["#fd0",</span> "#f0f", "#04f"]</tt>\nfor three lines).</li>\n</ul>\n", + "default": "color" + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired width of the chart expressed in pixels. If <tt class=\"docutils literal\">width</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If <tt class=\"docutils literal\">width</tt> is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.</p>\n<p>To use <tt class=\"docutils literal\">width</tt>, you must set <tt class=\"docutils literal\">use_container_width=False</tt>.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the chart expressed in pixels. If <tt class=\"docutils literal\">height</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt> (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>,\nStreamlit sets the chart's width according to <tt class=\"docutils literal\">width</tt>.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L563" + }, + "streamlit.link_button": { + "name": "link_button", + "signature": "st.link_button(label, url, *, help=None, type=\"secondary\", disabled=False, use_container_width=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.link_button("Go to gallery", "https://streamlit.io/gallery")\n</pre>\n<Cloud name=\"doc-link-button\" path=\"\" query=\"\" stylePlaceholder=\"height: 200px\" /></blockquote>\n", + "description": "<p>Display a link button element.</p>\n<p>When clicked, a new tab will be opened to the specified URL. This will\ncreate a new session for the user if directed within the app.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this button is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents)\nrender. Display unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "url", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The url to be opened on user click</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when the button is\nhovered over.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "\"secondary\" or \"primary\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string that specifies the button type. Can be "primary" for a\nbutton with additional emphasis or "secondary" for a normal button. Defaults\nto "secondary".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the link button if set to\nTrue. The default is False.</p>\n", + "default": "False" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to expand the button's width to fill its parent container.\nIf <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default), Streamlit sizes\nthe button to fit its contents. If <tt class=\"docutils literal\">use_container_width</tt> is\n<tt class=\"docutils literal\">True</tt>, the width of the button matches its parent container.</p>\n<p>In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/button.py#L374" + }, + "streamlit.logo": { + "name": "logo", + "signature": "st.logo(image, *, link=None, icon_image=None)", + "examples": "<p>A common design practice is to use a wider logo in the sidebar, and a\nsmaller, icon-styled logo in your app's main body.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.logo(LOGO_URL_LARGE, link="https://streamlit.io/gallery", icon_image=LOGO_URL_SMALL)\n</pre>\n<p>Try switching logos around in the following example:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nHORIZONTAL_RED = "images/horizontal_red.png"\nICON_RED = "images/icon_red.png"\nHORIZONTAL_BLUE = "images/horizontal_blue.png"\nICON_BLUE = "images/icon_blue.png"\n\noptions = [HORIZONTAL_RED, ICON_RED, HORIZONTAL_BLUE, ICON_BLUE]\nsidebar_logo = st.selectbox("Sidebar logo", options, 0)\nmain_body_logo = st.selectbox("Main body logo", options, 1)\n\nst.logo(sidebar_logo, icon_image=main_body_logo)\nst.sidebar.markdown("Hi!")\n</pre>\n<Cloud name=\"doc-logo\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" />", + "description": "<p>Renders a logo in the upper-left corner of your app and its sidebar.</p>\n<p>If <tt class=\"docutils literal\">st.logo</tt> is called multiple times within a page, Streamlit will\nrender the image passed in the last call. For the most consistent results,\ncall <tt class=\"docutils literal\">st.logo</tt> early in your page script and choose an image that works\nwell in both light and dark mode. Avoid empty margins around your image.</p>\n<p>If your logo does not work well for both light and dark mode, consider\nsetting the theme and hiding the settings menu from users with the\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/configuration/config.toml\">configuration option</a>\n<tt class=\"docutils literal\"><span class=\"pre\">client.toolbarMode="minimal"</span></tt>.</p>\n", + "args": [ + { + "name": "image", + "type_name": "Anything supported by st.image", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The image to display in the upper-left corner of your app and its\nsidebar. If <tt class=\"docutils literal\">icon_image</tt> is also provided, then Streamlit will only\ndisplay <tt class=\"docutils literal\">image</tt> in the sidebar.</p>\n<p>Streamlit scales the image to a height of 24 pixels and a maximum\nwidth of 240 pixels. Use images with an aspect ratio of 10:1 or less to\navoid distortion.</p>\n", + "default": null + }, + { + "name": "link", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The external URL to open when a user clicks on the logo. The URL must\nstart with "http://" or "https://". If <tt class=\"docutils literal\">link</tt> is <tt class=\"docutils literal\">None</tt> (default),\nthe logo will not include a hyperlink.</p>\n", + "default": null + }, + { + "name": "icon_image", + "type_name": "Anything supported by st.image or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An alternate image to replace <tt class=\"docutils literal\">image</tt> in the upper-left corner of the\napp's main body. If <tt class=\"docutils literal\">icon_image</tt> is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill render <tt class=\"docutils literal\">image</tt> in the upper-left corner of the app and its\nsidebar. Otherwise, Streamlit will render <tt class=\"docutils literal\">icon_image</tt> in the\nupper-left corner of the app and <tt class=\"docutils literal\">image</tt> in the upper-left corner\nof the sidebar.</p>\n<p>Streamlit scales the image to a height of 24 pixels and a maximum\nwidth of 240 pixels. Use images with an aspect ratio of 10:1 or less to\navoid distortion.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/logo.py#L31" + }, + "streamlit.map": { + "name": "map", + "signature": "st.map(data=None, *, latitude=None, longitude=None, color=None, size=None, zoom=None, use_container_width=True)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(\n np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n columns=['lat', 'lon'])\n\nst.map(df)\n</pre>\n<Cloud name=\"doc-map\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" /><p>You can also customize the size and color of the datapoints:</p>\n<pre class=\"doctest-block\">\nst.map(df, size=20, color='#0044ff')\n</pre>\n<p>And finally, you can choose different columns to use for the latitude\nand longitude components, as well as set size and color of each\ndatapoint dynamically based on other columns:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame({\n "col1": np.random.randn(1000) / 50 + 37.76,\n "col2": np.random.randn(1000) / 50 + -122.4,\n "col3": np.random.randn(1000) * 100,\n "col4": np.random.rand(1000, 4).tolist(),\n})\n\nst.map(df,\n latitude='col1',\n longitude='col2',\n size='col3',\n color='col4')\n</pre>\n<Cloud name=\"doc-map-color\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" /></blockquote>\n", + "description": "<p>Display a map with a scatterplot overlaid onto it.</p>\n<p>This is a wrapper around <tt class=\"docutils literal\">st.pydeck_chart</tt> to quickly create\nscatterplot charts on top of a map, with auto-centering and auto-zoom.</p>\n<p>When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts\nno responsibility or liability of any kind for Mapbox or for any content\nor information made available by Mapbox.</p>\n<p>Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the <tt class=\"docutils literal\">mapbox.token</tt> config option. The\nuse of Mapbox is governed by Mapbox's Terms of Use.</p>\n<p>To get a token for yourself, create an account at <a class=\"reference external\" href=\"https://mapbox.com\">https://mapbox.com</a>.\nFor more info on how to set config options, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/configuration/config.toml\">https://docs.streamlit.io/develop/api-reference/configuration/config.toml</a>.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The data to be plotted.</p>\n", + "default": null + }, + { + "name": "latitude", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The name of the column containing the latitude coordinates of\nthe datapoints in the chart.</p>\n<p>If None, the latitude data will come from any column named 'lat',\n'latitude', 'LAT', or 'LATITUDE'.</p>\n", + "default": null + }, + { + "name": "longitude", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The name of the column containing the longitude coordinates of\nthe datapoints in the chart.</p>\n<p>If None, the longitude data will come from any column named 'lon',\n'longitude', 'LON', or 'LONGITUDE'.</p>\n", + "default": null + }, + { + "name": "color", + "type_name": "str or tuple or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The color of the circles representing each datapoint.</p>\n<p>Can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default color.</li>\n<li>A hex string like "#ffaa00" or "#ffaa0088".</li>\n<li>An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.</li>\n<li>The name of the column to use for the color. Cells in this column\nshould contain colors represented as a hex string or color tuple,\nas described above.</li>\n</ul>\n", + "default": "color" + }, + { + "name": "size", + "type_name": "str or float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The size of the circles representing each point, in meters.</p>\n<p>This can be:</p>\n<ul class=\"simple\">\n<li>None, to use the default size.</li>\n<li>A number like 100, to specify a single size to use for all\ndatapoints.</li>\n<li>The name of the column to use for the size. This allows each\ndatapoint to be represented by a circle of a different size.</li>\n</ul>\n", + "default": "size" + }, + { + "name": "zoom", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Zoom level as specified in\n<a class=\"reference external\" href=\"https://wiki.openstreetmap.org/wiki/Zoom_levels\">https://wiki.openstreetmap.org/wiki/Zoom_levels</a>.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override the map's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>\n(default), Streamlit sets the width of the map to match the width\nof the parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>,\nStreamlit sets the width of the chart to fit its contents according\nto the plotting library, up to the width of the parent container.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/map.py#L84" + }, + "streamlit.markdown": { + "name": "markdown", + "signature": "st.markdown(body, unsafe_allow_html=False, *, help=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.markdown("*Streamlit* is **really** ***cool***.")\nst.markdown('''\n :red[Streamlit] :orange[can] :green[write] :blue[text] :violet[in]\n :gray[pretty] :rainbow[colors] and :blue-background[highlight] text.''')\nst.markdown("Here's a bouquet &mdash;\\\n :tulip::cherry_blossom::rose::hibiscus::sunflower::blossom:")\n\nmulti = '''If you end a line with two spaces,\na soft return is used for the next line.\n\nTwo (or more) newline characters in a row will result in a hard return.\n'''\nst.markdown(multi)\n</pre>\n<Cloud name=\"doc-markdown\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Display string formatted as Markdown.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The string to display as Github-flavored Markdown. Syntax\ninformation can be found at: <a class=\"reference external\" href=\"https://github.github.com/gfm\">https://github.github.com/gfm</a>.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to render HTML within <tt class=\"docutils literal\">body</tt>. If this is <tt class=\"docutils literal\">False</tt>\n(default), any HTML tags found in <tt class=\"docutils literal\">body</tt> will be escaped and\ntherefore treated as raw text. If this is <tt class=\"docutils literal\">True</tt>, any HTML\nexpressions within <tt class=\"docutils literal\">body</tt> will be rendered.</p>\n<p>Adding custom HTML to your app impacts safety, styling, and\nmaintainability.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">If you only want to insert HTML or CSS without Markdown text,\nwe recommend using <tt class=\"docutils literal\">st.html</tt> instead.</p>\n</div>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the Markdown.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/markdown.py#L33" + }, + "streamlit.metric": { + "name": "metric", + "signature": "st.metric(label, value, delta=None, delta_color=\"normal\", help=None, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.metric(label="Temperature", value="70 \u00b0F", delta="1.2 \u00b0F")\n</pre>\n<Cloud name=\"doc-metric-example1\" path=\"\" query=\"\" stylePlaceholder=\"height: 210px\" /><p><tt class=\"docutils literal\">st.metric</tt> looks especially nice in combination with <tt class=\"docutils literal\">st.columns</tt>:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ncol1, col2, col3 = st.columns(3)\ncol1.metric("Temperature", "70 \u00b0F", "1.2 \u00b0F")\ncol2.metric("Wind", "9 mph", "-8%")\ncol3.metric("Humidity", "86%", "4%")\n</pre>\n<Cloud name=\"doc-metric-example2\" path=\"\" query=\"\" stylePlaceholder=\"height: 210px\" /><p>The delta indicator color can also be inverted or turned off:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.metric(label="Gas price", value=4, delta=-0.5,\n delta_color="inverse")\n\nst.metric(label="Active developers", value=123, delta=123,\n delta_color="off")\n</pre>\n<Cloud name=\"doc-metric-example3\" path=\"\" query=\"\" stylePlaceholder=\"height: 320px\" /></blockquote>\n", + "description": "<p>Display a metric in big bold font, with an optional indicator of how the metric changed.</p>\n<p>Tip: If you want to display a large number, it may be a good idea to\nshorten it using packages like <a class=\"reference external\" href=\"https://github.com/azaitsev/millify\">millify</a>\nor <a class=\"reference external\" href=\"https://github.com/davidsa03/numerize\">numerize</a>. E.g. <tt class=\"docutils literal\">1234</tt> can be\ndisplayed as <tt class=\"docutils literal\">1.2k</tt> using <tt class=\"docutils literal\"><span class=\"pre\">st.metric("Short</span> number", millify(1234))</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The header or title for the metric. The label can optionally contain\nMarkdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Value of the metric. None is rendered as a long dash.</p>\n", + "default": null + }, + { + "name": "delta", + "type_name": "int, float, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Indicator of how the metric changed, rendered with an arrow below\nthe metric. If delta is negative (int/float) or starts with a minus\nsign (str), the arrow points down and the text is red; else the\narrow points up and the text is green. If None (default), no delta\nindicator is shown.</p>\n", + "default": null + }, + { + "name": "delta_color", + "type_name": "\"normal\", \"inverse\", or \"off\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If "normal" (default), the delta indicator is shown as described\nabove. If "inverse", it is red when positive and green when\nnegative. This is useful when a negative change is considered\ngood, e.g. if cost decreased. If "off", delta is shown in gray\nregardless of its value.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the metric label.</p>\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/metric.py#L48" + }, + "streamlit.multiselect": { + "name": "multiselect", + "signature": "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\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\noptions = st.multiselect(\n "What are your favorite colors",\n ["Green", "Yellow", "Red", "Blue"],\n ["Yellow", "Red"])\n\nst.write("You selected:", options)\n</pre>\n<Cloud name=\"doc-multiselect\" path=\"\" query=\"\" stylePlaceholder=\"height: 420px\" /></blockquote>\n", + "description": "<p>Display a multiselect widget.</p>\n<p>The multiselect widget starts as empty.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Labels for the select options in an Iterable. For example, this can\nbe a list, numpy.ndarray, pandas.Series, pandas.DataFrame, or\npandas.Index. For pandas.DataFrame, the first column is used.\nEach label will be cast to str internally by default.</p>\n", + "default": null + }, + { + "name": "default", + "type_name": "Iterable of V, V, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>List of default values. Can also be a single value.</p>\n", + "default": "values" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Function to modify the display of selectbox options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe multiselect.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the multiselect.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this multiselect's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "max_selections", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The max selections that can be selected at a time.</p>\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A string to display when no options are selected. Defaults to 'Choose an option'.</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the multiselect widget if set\nto True. The default is False. This argument can only be supplied\nby keyword.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "list", + "is_generator": false, + "description": "<p>A list with the selected options</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/multiselect.py#L145" + }, + "streamlit.navigation": { + "name": "navigation", + "signature": "st.navigation(pages, *, position=\"sidebar\")", + "examples": "<p>The following examples show possible entrypoint files, which is the file\nyou pass to <tt class=\"docutils literal\">streamlit run</tt>. Your entrypoint file manages your app's\nnavigation and serves as a router between pages.</p>\n<p>You can declare pages from callables or file paths.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom page_functions import page1\n\npg = st.navigation([st.Page(page1), st.Page("page2.py")])\npg.run()\n</pre>\n<p>Use a dictionary to create sections within your navigation menu.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\npages = {\n "Your account" : [\n st.Page("create_account.py", title="Create your account"),\n st.Page("manage_account.py", title="Manage your account")\n ],\n "Resources" : [\n st.Page("learn.py", title="Learn about us"),\n st.Page("trial.py", title="Try it out")\n ]\n}\n\npg = st.navigation(pages)\npg.run()\n</pre>\n<p>Call widget functions in your entrypoint file when you want a widget to be\nstateful across pages. Assign keys to your common widgets and access their\nvalues through Session State within your pages.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ndef page1():\n st.write(st.session_state.foo)\n\ndef page2():\n st.write(st.session_state.bar)\n\n# Widgets shared by all the pages\nst.sidebar.selectbox("Foo", ["A", "B", "C"], key="foo")\nst.sidebar.checkbox("Bar", key="bar")\n\npg = st.navigation(st.Page(page1), st.Page(page2))\npg.run()\n</pre>\n", + "description": "<p>Configure the available pages in a multipage app.</p>\n<p>Call <tt class=\"docutils literal\">st.navigation</tt> in your entrypoint file with one or more pages\ndefined by <tt class=\"docutils literal\">st.Page</tt>. <tt class=\"docutils literal\">st.navigation</tt> returns the current page, which\ncan be executed using <tt class=\"docutils literal\">.run()</tt> method.</p>\n<p>When using <tt class=\"docutils literal\">st.navigation</tt>, your entrypoint file (the file passed to\n<tt class=\"docutils literal\">streamlit run</tt>) acts like a router or frame of common elements around\neach of your pages. Streamlit executes the entrypoint file with every app\nrerun. To execute the current page, you must call the <tt class=\"docutils literal\">.run()</tt> method on\nthe page object returned by <tt class=\"docutils literal\">st.navigation</tt>.</p>\n<p>The set of available pages can be updated with each rerun for dynamic\nnavigation. By default, <tt class=\"docutils literal\">st.navigation</tt> draws the available pages in the\nside navigation if there is more than one page. This behavior can be\nchanged using the <tt class=\"docutils literal\">position</tt> keyword argument.</p>\n<p>As soon as any session of your app executes the <tt class=\"docutils literal\">st.navigation</tt> command,\nyour app will ignore the <tt class=\"docutils literal\">pages/</tt> directory (across all sessions).</p>\n", + "args": [ + { + "name": "pages", + "type_name": "list[StreamlitPage] or dict[str, list[StreamlitPage]]", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The available pages for the app.</p>\n<p>To create labeled sections or page groupings within the navigation\nmenu, <tt class=\"docutils literal\">pages</tt> must be a dictionary. Each key is the label of a\nsection and each value is the list of <tt class=\"docutils literal\">StreamlitPage</tt> objects for\nthat section.</p>\n<p>To create a navigation menu with no sections or page groupings,\n<tt class=\"docutils literal\">pages</tt> must be a list of <tt class=\"docutils literal\">StreamlitPage</tt> objects.</p>\n<p>Use <tt class=\"docutils literal\">st.Page</tt> to create <tt class=\"docutils literal\">StreamlitPage</tt> objects.</p>\n", + "default": null + }, + { + "name": "position", + "type_name": "\"sidebar\" or \"hidden\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The position of the navigation menu. If <tt class=\"docutils literal\">position</tt> is <tt class=\"docutils literal\">"sidebar"</tt>\n(default), the navigation widget appears at the top of the sidebar. If\n<tt class=\"docutils literal\">position</tt> is <tt class=\"docutils literal\">"hidden"</tt>, the navigation widget is not displayed.</p>\n<p>If there is only one page in <tt class=\"docutils literal\">pages</tt>, the navigation will be hidden\nfor any value of <tt class=\"docutils literal\">position</tt>.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "StreamlitPage", + "is_generator": false, + "description": "<p>The current page selected by the user.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/navigation.py#L55" + }, + "streamlit.number_input": { + "name": "number_input", + "signature": "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\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nnumber = st.number_input("Insert a number")\nst.write("The current number is ", number)\n</pre>\n<Cloud name=\"doc-number-input\" path=\"\" query=\"\" stylePlaceholder=\"height: 260px\" /><p>To initialize an empty number input, use <tt class=\"docutils literal\">None</tt> as the value:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nnumber = st.number_input("Insert a number", value=None, placeholder="Type a number...")\nst.write("The current number is ", number)\n</pre>\n<Cloud name=\"doc-number-input-empty\" path=\"\" query=\"\" stylePlaceholder=\"height: 260px\" /></blockquote>\n", + "description": "<p>Display a numeric input widget.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Integer values exceeding +/- <tt class=\"docutils literal\"><span class=\"pre\">(1<<53)</span> - 1</tt> cannot be accurately\nstored or returned by the widget due to serialization contstraints\nbetween the Python server and JavaScript client. You must handle\nsuch numbers as floats, leading to a loss in precision.</p>\n</div>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The minimum permitted value.\nIf None, there will be no minimum.</p>\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum permitted value.\nIf None, there will be no maximum.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "int, float, \"min\" or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The value of this widget when it first renders. If <tt class=\"docutils literal\">None</tt>, will initialize\nempty and return <tt class=\"docutils literal\">None</tt> until the user provides input.\nIf "min" (default), will initialize with min_value, or 0.0 if\nmin_value is None.</p>\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The stepping interval.\nDefaults to 1 if the value is an int, 0.01 otherwise.\nIf the value is not specified, the format parameter will be used.</p>\n", + "default": "1" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A printf-style format string controlling how the interface should\ndisplay numbers. Output must be purely numeric. This does not impact\nthe return value. Valid formatters: %d %e %f %g %i %u</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the input.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this number_input's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string displayed when the number input is empty.\nIf None, no placeholder is displayed.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the number input if set to\nTrue. The default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "int or float or None", + "is_generator": false, + "description": "<p>The current value of the numeric input widget or <tt class=\"docutils literal\">None</tt> if the widget\nis empty. The return type will match the data type of the value parameter.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/number_input.py#L116" + }, + "streamlit.page_link": { + "name": "page_link", + "signature": "st.page_link(page, *, label=None, icon=None, help=None, disabled=False, use_container_width=None)", + "example": "<blockquote>\n<p>Consider the following example given this file structure:</p>\n<pre class=\"doctest-block\">\nyour-repository/\n\u251c\u2500\u2500 pages/\n\u2502 \u251c\u2500\u2500 page_1.py\n\u2502 \u2514\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n</pre>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.page_link("your_app.py", label="Home", icon="\ud83c\udfe0")\nst.page_link("pages/page_1.py", label="Page 1", icon="1\ufe0f\u20e3")\nst.page_link("pages/page_2.py", label="Page 2", icon="2\ufe0f\u20e3", disabled=True)\nst.page_link("http://www.google.com", label="Google", icon="\ud83c\udf0e")\n</pre>\n<p>The default navigation is shown here for comparison, but you can hide\nthe default navigation using the <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/configuration/config.toml#client\"><tt class=\"docutils literal\">client.showSidebarNavigation</tt></a>\nconfiguration option. This allows you to create custom, dynamic\nnavigation menus for your apps!</p>\n<Cloud name=\"doc-page-link\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Display a link to another page in a multipage app or to an external page.</p>\n<p>If another page in a multipage app is specified, clicking <tt class=\"docutils literal\">st.page_link</tt>\nstops the current page execution and runs the specified page as if the\nuser clicked on it in the sidebar navigation.</p>\n<p>If an external page is specified, clicking <tt class=\"docutils literal\">st.page_link</tt> opens a new\ntab to the specified page. The current script run will continue if not\ncomplete.</p>\n", + "args": [ + { + "name": "page", + "type_name": "str or st.Page", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The file path (relative to the main script) or an st.Page indicating\nthe page to switch to. Alternatively, this can be the URL to an\nexternal page (must start with "<a class=\"reference external\" href=\"http://\">http://</a>" or "<a class=\"reference external\" href=\"https://\">https://</a>").</p>\n", + "default": null + }, + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the page link. Labels are required for external pages.\nLabels can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, and Emojis.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents)\nrender. Display unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the button label. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols </a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when the link is\nhovered over.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the page link if set to\n<tt class=\"docutils literal\">True</tt>. The default is <tt class=\"docutils literal\">False</tt>.</p>\n", + "default": "is" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to expand the link's width to fill its parent container.\nThe default is <tt class=\"docutils literal\">True</tt> for page links in the sidebar and <tt class=\"docutils literal\">False</tt>\nfor those in the main app.</p>\n", + "default": "is" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/button.py#L465" + }, + "streamlit.plotly_chart": { + "name": "plotly_chart", + "signature": "st.plotly_chart(figure_or_data, use_container_width=False, *, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=('points', 'box', 'lasso'), **kwargs)", + "example": "<blockquote>\n<p>The example below comes straight from the examples at\n<a class=\"reference external\" href=\"https://plot.ly/python\">https://plot.ly/python</a>. Note that <tt class=\"docutils literal\">plotly.figure_factory</tt> requires\n<tt class=\"docutils literal\">scipy</tt> to run.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\nimport plotly.figure_factory as ff\n\n# Add histogram data\nx1 = np.random.randn(200) - 2\nx2 = np.random.randn(200)\nx3 = np.random.randn(200) + 2\n\n# Group data together\nhist_data = [x1, x2, x3]\n\ngroup_labels = ['Group 1', 'Group 2', 'Group 3']\n\n# Create distplot with custom bin_size\nfig = ff.create_distplot(\n hist_data, group_labels, bin_size=[.1, .25, .5])\n\n# Plot!\nst.plotly_chart(fig, use_container_width=True)\n</pre>\n<Cloud name=\"doc-plotly-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 550px\" /></blockquote>\n", + "description": "<p>Display an interactive Plotly chart.</p>\n<p><a class=\"reference external\" href=\"https://plot.ly/python\">Plotly</a> is a charting library for Python.\nThe arguments to this function closely follow the ones for Plotly's\n<tt class=\"docutils literal\">plot()</tt> function.</p>\n<p>To show Plotly charts in Streamlit, call <tt class=\"docutils literal\">st.plotly_chart</tt> wherever\nyou would call Plotly's <tt class=\"docutils literal\">py.plot</tt> or <tt class=\"docutils literal\">py.iplot</tt>.</p>\n", + "args": [ + { + "name": "figure_or_data", + "type_name": "plotly.graph_objs.Figure, plotly.graph_objs.Data, or dict/list of plotly.graph_objs.Figure/Data", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The Plotly <tt class=\"docutils literal\">Figure</tt> or <tt class=\"docutils literal\">Data</tt> object to render. See\n<a class=\"reference external\" href=\"https://plot.ly/python/\">https://plot.ly/python/</a> for examples of graph descriptions.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets\nthe width of the figure to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The theme of the chart. If <tt class=\"docutils literal\">theme</tt> is <tt class=\"docutils literal\">"streamlit"</tt> (default),\nStreamlit uses its own design default. If <tt class=\"docutils literal\">theme</tt> is <tt class=\"docutils literal\">None</tt>,\nStreamlit falls back to the default behavior of the library.</p>\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string to use for giving this element a stable\nidentity. If <tt class=\"docutils literal\">key</tt> is <tt class=\"docutils literal\">None</tt> (default), this element's identity\nwill be determined based on the values of the other parameters.</p>\n<p>Additionally, if selections are activated and <tt class=\"docutils literal\">key</tt> is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.</p>\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\" or \"rerun\" or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\n<tt class=\"docutils literal\">on_select</tt> can be one of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">"ignore"</tt> (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an input\nwidget.</li>\n<li><tt class=\"docutils literal\">"rerun"</tt>: Streamlit will rerun the app when the user selects\ndata in the chart. In this case, <tt class=\"docutils literal\">st.plotly_chart</tt> will return\nthe selection data as a dictionary.</li>\n<li>A <tt class=\"docutils literal\">callable</tt>: Streamlit will rerun the app and execute the\n<tt class=\"docutils literal\">callable</tt> as a callback function before the rest of the app.\nIn this case, <tt class=\"docutils literal\">st.plotly_chart</tt> will return the selection data\nas a dictionary.</li>\n</ul>\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "\"points\", \"box\", \"lasso\" or an Iterable of these", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The selection mode of the chart. This can be one of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">"points"</tt>: The chart will allow selections based on individual\ndata points.</li>\n<li><tt class=\"docutils literal\">"box"</tt>: The chart will allow selections based on rectangular\nareas.</li>\n<li><tt class=\"docutils literal\">"lasso"</tt>: The chart will allow selections based on freeform\nareas.</li>\n<li>An <tt class=\"docutils literal\">Iterable</tt> of the above options: The chart will allow\nselections based on the modes specified.</li>\n</ul>\n<p>All selections modes are activated by default.</p>\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>Any argument accepted by Plotly's <tt class=\"docutils literal\">plot()</tt> function.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "<p>If <tt class=\"docutils literal\">on_select</tt> is <tt class=\"docutils literal\">"ignore"</tt> (default), this method returns an\ninternal placeholder for the chart element. Otherwise, this method\nreturns a dictionary-like object that supports both key and\nattribute notation. The attributes are described by the\n<tt class=\"docutils literal\">PlotlyState</tt> dictionary schema.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/plotly_chart.py#L310" + }, + "streamlit.popover": { + "name": "popover", + "signature": "st.popover(label, *, help=None, disabled=False, use_container_width=False)", + "examples": "<blockquote>\n<p>You can use the <tt class=\"docutils literal\">with</tt> notation to insert any element into a popover:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nwith st.popover("Open popover"):\n st.markdown("Hello World \ud83d\udc4b")\n name = st.text_input("What's your name?")\n\nst.write("Your name:", name)\n</pre>\n<Cloud name=\"doc-popover\" path=\"\" query=\"\" stylePlaceholder=\"height: 400px\" /><p>Or you can just call methods directly on the returned objects:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\npopover = st.popover("Filter items")\nred = popover.checkbox("Show red items.", True)\nblue = popover.checkbox("Show blue items.", True)\n\nif red:\n st.write(":red[This is a red item.]")\nif blue:\n st.write(":blue[This is a blue item.]")\n</pre>\n<Cloud name=\"doc-popover2\" path=\"\" query=\"\" stylePlaceholder=\"height: 400px\" /></blockquote>\n", + "description": "<p>Insert a popover container.</p>\n<p>Inserts a multi-element container as a popover. It consists of a button-like\nelement and a container that opens when the button is clicked.</p>\n<p>Opening and closing the popover will not trigger a rerun. Interacting\nwith widgets inside of an open popover will rerun the app while keeping\nthe popover open. Clicking outside of the popover will close it.</p>\n<p>To add elements to the returned container, you can use the "with"\nnotation (preferred) or just call methods directly on the returned object.\nSee examples below.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">You may not put a popover inside another popover.</p>\n</div>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label of the button that opens the popover container.\nThe label can optionally contain Markdown and supports the\nfollowing elements: Bold, Italics, Strikethroughs, Inline Code,\nEmojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li><dl class=\"first docutils\">\n<dt>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.</dt>\n<dd>For a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</dd>\n</dl>\n</li>\n<li><dl class=\"first docutils\">\n<dt>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"</dt>\n<dd>must be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</dd>\n</dl>\n</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when the popover button is\nhovered over.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the popover button if set to\nTrue. The default is False.</p>\n", + "default": "False" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to expand the button's width to fill its parent container.\nIf <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt> (default), Streamlit sizes\nthe button to fit its contents. If <tt class=\"docutils literal\">use_container_width</tt> is\n<tt class=\"docutils literal\">True</tt>, the width of the button matches its parent container.</p>\n<p>In both cases, if the contents of the button are wider than the\nparent container, the contents will line wrap.</p>\n<p>The popover containter's minimimun width matches the width of its\nbutton. The popover container may be wider than its button to fit\nthe container's contents.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/layouts.py#L569" + }, + "streamlit.progress": { + "name": "progress", + "signature": "st.progress(value, text=None)", + "example": "<blockquote>\n<p>Here is an example of a progress bar increasing over time and disappearing when it reaches completion:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport time\n\nprogress_text = "Operation in progress. Please wait."\nmy_bar = st.progress(0, text=progress_text)\n\nfor percent_complete in range(100):\n time.sleep(0.01)\n my_bar.progress(percent_complete + 1, text=progress_text)\ntime.sleep(1)\nmy_bar.empty()\n\nst.button("Rerun")\n</pre>\n<Cloud name=\"doc-status-progress\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display a progress bar.</p>\n", + "args": [ + { + "name": "value", + "type_name": "int or float", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>0 <= value <= 100 for int</p>\n<p>0.0 <= value <= 1.0 for float</p>\n", + "default": null + }, + { + "name": "text", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A message to display above the progress bar. The text can optionally\ncontain Markdown and supports the following elements: Bold, Italics,\nStrikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/progress.py#L95" + }, + "streamlit.pydeck_chart": { + "name": "pydeck_chart", + "signature": "st.pydeck_chart(pydeck_obj=None, use_container_width=False)", + "example": "<blockquote>\n<p>Here's a chart using a HexagonLayer and a ScatterplotLayer. It uses either the\nlight or dark map style, based on which Streamlit theme is currently active:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport pydeck as pdk\n\nchart_data = pd.DataFrame(\n np.random.randn(1000, 2) / [50, 50] + [37.76, -122.4],\n columns=['lat', 'lon'])\n\nst.pydeck_chart(pdk.Deck(\n map_style=None,\n initial_view_state=pdk.ViewState(\n latitude=37.76,\n longitude=-122.4,\n zoom=11,\n pitch=50,\n ),\n layers=[\n pdk.Layer(\n 'HexagonLayer',\n data=chart_data,\n get_position='[lon, lat]',\n radius=200,\n elevation_scale=4,\n elevation_range=[0, 1000],\n pickable=True,\n extruded=True,\n ),\n pdk.Layer(\n 'ScatterplotLayer',\n data=chart_data,\n get_position='[lon, lat]',\n get_color='[200, 30, 0, 160]',\n get_radius=200,\n ),\n ],\n))\n</pre>\n<Cloud name=\"doc-pydeck-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 530px\" /><div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">To make the PyDeck chart's style consistent with Streamlit's theme,\nyou can set <tt class=\"docutils literal\">map_style=None</tt> in the <tt class=\"docutils literal\">pydeck.Deck</tt> object.</p>\n</div>\n</blockquote>\n", + "description": "<p>Draw a chart using the PyDeck library.</p>\n<p>This supports 3D maps, point clouds, and more! More info about PyDeck\nat <a class=\"reference external\" href=\"https://deckgl.readthedocs.io/en/latest/\">https://deckgl.readthedocs.io/en/latest/</a>.</p>\n<p>These docs are also quite useful:</p>\n<ul class=\"simple\">\n<li>DeckGL docs: <a class=\"reference external\" href=\"https://github.com/uber/deck.gl/tree/master/docs\">https://github.com/uber/deck.gl/tree/master/docs</a></li>\n<li>DeckGL JSON docs: <a class=\"reference external\" href=\"https://github.com/uber/deck.gl/tree/master/modules/json\">https://github.com/uber/deck.gl/tree/master/modules/json</a></li>\n</ul>\n<p>When using this command, Mapbox provides the map tiles to render map\ncontent. Note that Mapbox is a third-party product and Streamlit accepts\nno responsibility or liability of any kind for Mapbox or for any content\nor information made available by Mapbox.</p>\n<p>Mapbox requires users to register and provide a token before users can\nrequest map tiles. Currently, Streamlit provides this token for you, but\nthis could change at any time. We strongly recommend all users create and\nuse their own personal Mapbox token to avoid any disruptions to their\nexperience. You can do this with the <tt class=\"docutils literal\">mapbox.token</tt> config option. The\nuse of Mapbox is governed by Mapbox's Terms of Use.</p>\n<p>To get a token for yourself, create an account at <a class=\"reference external\" href=\"https://mapbox.com\">https://mapbox.com</a>.\nFor more info on how to set config options, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/develop/api-reference/configuration/config.toml\">https://docs.streamlit.io/develop/api-reference/configuration/config.toml</a>.</p>\n", + "args": [ + { + "name": "pydeck_obj", + "type_name": "pydeck.Deck or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Object specifying the PyDeck chart to draw.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets\nthe width of the figure to match the width of the parent container.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/deck_gl_json_chart.py#L39" + }, + "streamlit.pyplot": { + "name": "pyplot", + "signature": "st.pyplot(fig=None, clear_figure=None, use_container_width=True, **kwargs)", + "notes": "<blockquote>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Deprecation warning. After December 1st, 2020, we will remove the ability\nto specify no arguments in <cite>st.pyplot()</cite>, as that requires the use of\nMatplotlib's global figure object, which is not thread-safe. So\nplease always pass a figure object as shown in the example section\nabove.</p>\n</div>\n<p>Matplotlib supports several types of "backends". If you're getting an\nerror using Matplotlib with Streamlit, try setting your backend to "TkAgg":</p>\n<pre class=\"literal-block\">\necho "backend: TkAgg" >> ~/.matplotlib/matplotlibrc\n</pre>\n<p>For more information, see <a class=\"reference external\" href=\"https://matplotlib.org/faq/usage_faq.html\">https://matplotlib.org/faq/usage_faq.html</a>.</p>\n</blockquote>\n", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport matplotlib.pyplot as plt\nimport numpy as np\n\narr = np.random.normal(1, 1, size=100)\nfig, ax = plt.subplots()\nax.hist(arr, bins=20)\n\nst.pyplot(fig)\n</pre>\n<Cloud name=\"doc-pyplot\" path=\"\" query=\"\" stylePlaceholder=\"height: 630px\" /></blockquote>\n", + "description": "<p>Display a matplotlib.pyplot figure.</p>\n", + "args": [ + { + "name": "fig", + "type_name": "Matplotlib Figure", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The figure to plot. When this argument isn't specified, this\nfunction will render the global figure (but this is deprecated,\nas described below)</p>\n", + "default": null + }, + { + "name": "clear_figure", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>If True, the figure will be cleared after being rendered.\nIf False, the figure will not be cleared after being rendered.\nIf left unspecified, we pick a default based on the value of <tt class=\"docutils literal\">fig</tt>.</p>\n<ul class=\"simple\">\n<li>If <tt class=\"docutils literal\">fig</tt> is set, defaults to <tt class=\"docutils literal\">False</tt>.</li>\n<li>If <tt class=\"docutils literal\">fig</tt> is not set, defaults to <tt class=\"docutils literal\">True</tt>. This simulates Jupyter's\napproach to matplotlib rendering.</li>\n</ul>\n", + "default": "based" + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>\n(default), Streamlit sets the width of the figure to match the\nwidth of the parent container. If <tt class=\"docutils literal\">use_container_width</tt> is\n<tt class=\"docutils literal\">False</tt>, Streamlit sets the width of the chart to fit its\ncontents according to the plotting library, up to the width of the\nparent container.</p>\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Arguments to pass to Matplotlib's savefig function.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/pyplot.py#L35" + }, + "streamlit.radio": { + "name": "radio", + "signature": "st.radio(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, horizontal=False, captions=None, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ngenre = st.radio(\n "What's your favorite movie genre",\n [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],\n captions = ["Laugh out loud.", "Get the popcorn.", "Never stop learning."])\n\nif genre == ":rainbow[Comedy]":\n st.write("You selected comedy.")\nelse:\n st.write("You didn't select comedy.")\n</pre>\n<Cloud name=\"doc-radio\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /><p>To initialize an empty radio widget, use <tt class=\"docutils literal\">None</tt> as the index value:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ngenre = st.radio(\n "What's your favorite movie genre",\n [":rainbow[Comedy]", "***Drama***", "Documentary :movie_camera:"],\n index=None,\n)\n\nst.write("You selected:", genre)\n</pre>\n<Cloud name=\"doc-radio-empty\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Display a radio button widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this radio group is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Labels for the select options in an Iterable. For example, this can\nbe a list, numpy.ndarray, pandas.Series, pandas.DataFrame, or\npandas.Index. For pandas.DataFrame, the first column is used.</p>\n<p>Labels can include markdown as described in the <tt class=\"docutils literal\">label</tt> parameter\nand will be cast to str internally by default.</p>\n", + "default": null + }, + { + "name": "index", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The index of the preselected option on first render. If <tt class=\"docutils literal\">None</tt>,\nwill initialize empty and return <tt class=\"docutils literal\">None</tt> until the user selects an option.\nDefaults to 0 (the first option).</p>\n", + "default": "0" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Function to modify the display of radio options. It receives\nthe raw option as an argument and should output the label to be\nshown for that option. This has no impact on the return value of\nthe radio.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the radio.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this radio's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the radio button if set to\nTrue. The default is False.</p>\n", + "default": "False" + }, + { + "name": "horizontal", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which orients the radio group horizontally.\nThe default is false (vertical buttons).</p>\n", + "default": "false" + }, + { + "name": "captions", + "type_name": "iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A list of captions to show below each radio button. If None (default),\nno captions are shown.</p>\n", + "default": null + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "<p>The selected option or <tt class=\"docutils literal\">None</tt> if no option is selected.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/radio.py#L88" + }, + "streamlit.rerun": { + "name": "rerun", + "signature": "st.rerun()", + "description": "<p>Rerun the script immediately.</p>\n<p>When <tt class=\"docutils literal\">st.rerun()</tt> is called, the script is halted - no more statements will\nbe run, and the script will be queued to re-run from the top.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/execution_control.py#L58" + }, + "streamlit.scatter_chart": { + "name": "scatter_chart", + "signature": "st.scatter_chart(data=None, *, x=None, y=None, x_label=None, y_label=None, color=None, size=None, width=None, height=None, use_container_width=True)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["a", "b", "c"])\n\nst.scatter_chart(chart_data)\n</pre>\n<Cloud name=\"doc-scatter-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>You can also choose different columns to use for x and y, as well as set\nthe color dynamically based on a 3rd column (assuming your dataframe is in\nlong format):</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 3), columns=["col1", "col2", "col3"])\nchart_data['col4'] = np.random.choice(['A','B','C'], 20)\n\nst.scatter_chart(\n chart_data,\n x='col1',\n y='col2',\n color='col4',\n size='col3',\n)\n</pre>\n<Cloud name=\"doc-scatter-chart1\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /><p>Finally, if your dataframe is in wide format, you can group multiple\ncolumns under the y argument to show multiple series with different\ncolors:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(20, 4), columns=["col1", "col2", "col3", "col4"])\n\nst.scatter_chart(\n chart_data,\n x='col1',\n y=['col2', 'col3'],\n size='col4',\n color=['#FF0000', '#0000FF'], # Optional\n)\n</pre>\n<Cloud name=\"doc-scatter-chart2\" path=\"\" query=\"\" stylePlaceholder=\"height: 440px\" /></blockquote>\n", + "description": "<p>Display a scatterplot chart.</p>\n<p>This is syntax-sugar around <tt class=\"docutils literal\">st.altair_chart</tt>. The main difference\nis this command uses the data's own column and indices to figure out\nthe chart's Altair spec. As a result this is easier to use for many\n"just plot this" scenarios, while being less customizable.</p>\n<p>If <tt class=\"docutils literal\">st.scatter_chart</tt> does not guess the data specification correctly,\ntry specifying your desired chart using <tt class=\"docutils literal\">st.altair_chart</tt>.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Data to be plotted.</p>\n", + "default": null + }, + { + "name": "x", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name or key associated to the x-axis data. If <tt class=\"docutils literal\">x</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit uses the data index for the x-axis\nvalues.</p>\n", + "default": null + }, + { + "name": "y", + "type_name": "str, Sequence of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column name(s) or key(s) associated to the y-axis data. If this is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit draws the data of all remaining\ncolumns as data series. If this is a <tt class=\"docutils literal\">Sequence</tt> of strings,\nStreamlit draws several series on the same chart by melting your\nwide-format table into a long-format table behind the scenes.</p>\n", + "default": null + }, + { + "name": "x_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the x-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name specified in <tt class=\"docutils literal\">x</tt> if available, or else\nno label will be displayed.</p>\n", + "default": null + }, + { + "name": "y_label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The label for the y-axis. If this is <tt class=\"docutils literal\">None</tt> (default), Streamlit\nwill use the column name(s) specified in <tt class=\"docutils literal\">y</tt> if available, or\nelse no label will be displayed.</p>\n", + "default": null + }, + { + "name": "color", + "type_name": "str, tuple, Sequence of str, Sequence of tuple, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The color of the circles representing each datapoint.</p>\n<p>This can be:</p>\n<ul>\n<li><p class=\"first\">None, to use the default color.</p>\n</li>\n<li><p class=\"first\">A hex string like "#ffaa00" or "#ffaa0088".</p>\n</li>\n<li><p class=\"first\">An RGB or RGBA tuple with the red, green, blue, and alpha\ncomponents specified as ints from 0 to 255 or floats from 0.0 to\n1.0.</p>\n</li>\n<li><p class=\"first\">The name of a column in the dataset where the color of that\ndatapoint will come from.</p>\n<p>If the values in this column are in one of the color formats\nabove (hex string or color tuple), then that color will be used.</p>\n<p>Otherwise, the color will be automatically picked from the\ndefault palette.</p>\n<p>For example: if the dataset has 1000 rows, but this column only\ncontains the values "adult", "child", and "baby", then those 1000\ndatapoints be shown using three colors from the default palette.</p>\n<p>But if this column only contains floats or ints, then those\n1000 datapoints will be shown using a colors from a continuous\ncolor gradient.</p>\n<p>Finally, if this column only contains the values "#ffaa00",\n"#f0f", "#0000ff", then then each of those 1000 datapoints will\nbe assigned "#ffaa00", "#f0f", or "#0000ff" as appropriate.</p>\n</li>\n</ul>\n<p>If the dataframe is in wide format (that is, y is a Sequence of\ncolumns), this can also be:</p>\n<ul class=\"simple\">\n<li>A list of string colors or color tuples to be used for each of\nthe series in the chart. This list should have the same length\nas the number of y values (e.g. <tt class=\"docutils literal\"><span class=\"pre\">color=["#fd0",</span> "#f0f", "#04f"]</tt>\nfor three series).</li>\n</ul>\n", + "default": "color" + }, + { + "name": "size", + "type_name": "str, float, int, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The size of the circles representing each point.</p>\n<p>This can be:</p>\n<ul class=\"simple\">\n<li>A number like 100, to specify a single size to use for all\ndatapoints.</li>\n<li>The name of the column to use for the size. This allows each\ndatapoint to be represented by a circle of a different size.</li>\n</ul>\n", + "default": null + }, + { + "name": "width", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired width of the chart expressed in pixels. If <tt class=\"docutils literal\">width</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the width of the chart to fit\nits contents according to the plotting library, up to the width of\nthe parent container. If <tt class=\"docutils literal\">width</tt> is greater than the width of the\nparent container, Streamlit sets the chart width to match the width\nof the parent container.</p>\n<p>To use <tt class=\"docutils literal\">width</tt>, you must set <tt class=\"docutils literal\">use_container_width=False</tt>.</p>\n", + "default": null + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Desired height of the chart expressed in pixels. If <tt class=\"docutils literal\">height</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit sets the height of the chart to fit\nits contents according to the plotting library.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override <tt class=\"docutils literal\">width</tt> with the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt> (default),\nStreamlit sets the width of the chart to match the width of the\nparent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>,\nStreamlit sets the chart's width according to <tt class=\"docutils literal\">width</tt>.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L1168" + }, + "streamlit.select_slider": { + "name": "select_slider", + "signature": "st.select_slider(label, options=(), value=None, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "examples": "<pre class=\"doctest-block\">\nimport streamlit as st\n\ncolor = st.select_slider(\n "Select a color of the rainbow",\n options=["red", "orange", "yellow", "green", "blue", "indigo", "violet"])\nst.write("My favorite color is", color)\n</pre>\n<p>And here's an example of a range select slider:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nstart_color, end_color = st.select_slider(\n "Select a range of color wavelength",\n options=["red", "orange", "yellow", "green", "blue", "indigo", "violet"],\n value=("red", "blue"))\nst.write("You selected wavelengths between", start_color, "and", end_color)\n</pre>\n<Cloud name=\"doc-select-slider\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" />", + "description": "<p>Display a slider widget to select items from a list.</p>\n<p>This also allows you to render a range slider by passing a two-element\ntuple or list as the <tt class=\"docutils literal\">value</tt>.</p>\n<p>The difference between <tt class=\"docutils literal\">st.select_slider</tt> and <tt class=\"docutils literal\">st.slider</tt> is that\n<tt class=\"docutils literal\">select_slider</tt> accepts any datatype and takes an iterable set of\noptions, while <tt class=\"docutils literal\">st.slider</tt> only accepts numerical or date/time data and\ntakes a range as input.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Labels for the select options in an Iterable. For example, this can\nbe a list, numpy.ndarray, pandas.Series, pandas.DataFrame, or\npandas.Index. For pandas.DataFrame, the first column is used.\nEach label will be cast to str internally by default.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to <cite>(1, 10)</cite> the\nslider will have a selectable range between 1 and 10.\nDefaults to first option.</p>\n", + "default": "first" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Function to modify the display of the labels from the options.\nargument. It receives the option as an argument and its output\nwill be cast to str.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the select slider.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this select_slider's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the select slider if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any value or tuple of any value", + "is_generator": false, + "description": "<p>The current value of the slider widget. The return type will match\nthe data type of the value parameter.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/select_slider.py#L108" + }, + "streamlit.selectbox": { + "name": "selectbox", + "signature": "st.selectbox(label, options, index=0, format_func=special_internal_function, key=None, help=None, on_change=None, args=None, kwargs=None, *, placeholder=\"Choose an option\", disabled=False, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\noption = st.selectbox(\n "How would you like to be contacted?",\n ("Email", "Home phone", "Mobile phone"))\n\nst.write("You selected:", option)\n</pre>\n<Cloud name=\"doc-selectbox\" path=\"\" query=\"\" stylePlaceholder=\"height: 320px\" /><p>To initialize an empty selectbox, use <tt class=\"docutils literal\">None</tt> as the index value:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\noption = st.selectbox(\n "How would you like to be contacted?",\n ("Email", "Home phone", "Mobile phone"),\n index=None,\n placeholder="Select contact method...",\n)\n\nst.write("You selected:", option)\n</pre>\n<Cloud name=\"doc-selectbox-empty\" path=\"\" query=\"\" stylePlaceholder=\"height: 320px\" /></blockquote>\n", + "description": "<p>Display a select widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this select widget is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "options", + "type_name": "Iterable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Labels for the select options in an Iterable. For example, this can\nbe a list, numpy.ndarray, pandas.Series, pandas.DataFrame, or\npandas.Index. For pandas.DataFrame, the first column is used.\nEach label will be cast to str internally by default.</p>\n", + "default": null + }, + { + "name": "index", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The index of the preselected option on first render. If <tt class=\"docutils literal\">None</tt>,\nwill initialize empty and return <tt class=\"docutils literal\">None</tt> until the user selects an option.\nDefaults to 0 (the first option).</p>\n", + "default": "0" + }, + { + "name": "format_func", + "type_name": "function", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Function to modify the display of the labels. It receives the option\nas an argument and its output will be cast to str.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the selectbox.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this selectbox's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A string to display when no options are selected.\nDefaults to "Choose an option".</p>\n", + "default": "s" + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the selectbox if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "any", + "is_generator": false, + "description": "<p>The selected option or <tt class=\"docutils literal\">None</tt> if no option is selected.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/selectbox.py#L81" + }, + "streamlit.set_option": { + "name": "set_option", + "signature": "st.set_option(key, value)", + "description": "<p>Set config option.</p>\n<dl class=\"docutils\">\n<dt>Currently, only the following config options can be set within the script itself:</dt>\n<dd><ul class=\"first last simple\">\n<li>client.caching</li>\n<li>client.displayEnabled</li>\n<li>deprecation.*</li>\n</ul>\n</dd>\n</dl>\n<p>Calling with any other options will raise StreamlitAPIException.</p>\n<p>Run <cite>streamlit config show</cite> in the terminal to see all available options.</p>\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The config option key of the form "section.optionName". To see all\navailable options, run <cite>streamlit config show</cite> on a terminal.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": null, + "is_optional": null, + "is_kwarg_only": false, + "description": "<p>The new value to assign to this config option.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/config.py#L93" + }, + "streamlit.set_page_config": { + "name": "set_page_config", + "signature": "st.set_page_config(page_title=None, page_icon=None, layout=\"centered\", initial_sidebar_state=\"auto\", menu_items=None)", + "example": "<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.set_page_config(\n page_title="Ex-stream-ly Cool App",\n page_icon="\ud83e\uddca",\n layout="wide",\n initial_sidebar_state="expanded",\n menu_items={\n 'Get Help': 'https://www.extremelycoolapp.com/help',\n 'Report a bug': "https://www.extremelycoolapp.com/bug",\n 'About': "# This is a header. This is an *extremely* cool app!"\n }\n)\n</pre>\n", + "description": "<p>Configures the default settings of the page.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">This must be the first Streamlit command used on an app page, and must only\nbe set once per page.</p>\n</div>\n", + "args": [ + { + "name": "page_title", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The page title, shown in the browser tab. If None, defaults to the\nfilename of the script ("app.py" would show "app \u2022 Streamlit").</p>\n", + "default": "the" + }, + { + "name": "page_icon", + "type_name": "Anything supported by st.image, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The page favicon. If <tt class=\"docutils literal\">page_icon</tt> is <tt class=\"docutils literal\">None</tt> (default), the favicon\nwill be a monochrome Streamlit logo.</p>\n<p>In addition to the types supported by <tt class=\"docutils literal\">st.image</tt> (like URLs or numpy\narrays), the following strings are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">page_icon="\ud83e\udd88"</span></tt>.</p>\n</li>\n<li><p class=\"first\">An emoji short code. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">page_icon=":shark:"</span></tt>.\nFor a list of all supported codes, see\n<a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</p>\n</li>\n<li><p class=\"first\">The string literal, <tt class=\"docutils literal\">"random"</tt>. You can set <tt class=\"docutils literal\"><span class=\"pre\">page_icon="random"</span></tt>\nto set a random emoji from the supported list above. Emoji icons are\ncourtesy of Twemoji and loaded from MaxCDN.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Colors are not supported for Material icons. When you use a\nMaterial icon for favicon, it will be black, regardless of browser\ntheme.</p>\n</div>\n", + "default": null + }, + { + "name": "layout", + "type_name": "\"centered\" or \"wide\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>How the page content should be laid out. Defaults to "centered",\nwhich constrains the elements into a centered column of fixed width;\n"wide" uses the entire screen.</p>\n", + "default": "s" + }, + { + "name": "initial_sidebar_state", + "type_name": "\"auto\", \"expanded\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>How the sidebar should start out. Defaults to "auto",\nwhich hides the sidebar on small devices and shows it otherwise.\n"expanded" shows the sidebar initially; "collapsed" hides it.\nIn most cases, you should just use "auto", otherwise the app will\nlook bad when embedded and viewed on mobile.</p>\n", + "default": "s" + }, + { + "name": "menu_items", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Configure the menu that appears on the top-right side of this app.\nThe keys in this dict denote the menu item you'd like to configure:</p>\n<ul class=\"simple\">\n<li><dl class=\"first docutils\">\n<dt>"Get help": str or None</dt>\n<dd>The URL this menu item should point to.\nIf None, hides this menu item.</dd>\n</dl>\n</li>\n<li><dl class=\"first docutils\">\n<dt>"Report a Bug": str or None</dt>\n<dd>The URL this menu item should point to.\nIf None, hides this menu item.</dd>\n</dl>\n</li>\n<li><dl class=\"first docutils\">\n<dt>"About": str or None</dt>\n<dd>A markdown string to show in the About dialog.\nIf None, only shows Streamlit's default About text.</dd>\n</dl>\n</li>\n</ul>\n<p>The URL may also refer to an email address e.g. <tt class=\"docutils literal\">mailto:john@example.com</tt>.</p>\n", + "default": "About" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/page_config.py#L119" + }, + "streamlit.slider": { + "name": "slider", + "signature": "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\")", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nage = st.slider("How old are you?", 0, 130, 25)\nst.write("I'm ", age, "years old")\n</pre>\n<p>And here's an example of a range slider:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nvalues = st.slider(\n "Select a range of values",\n 0.0, 100.0, (25.0, 75.0))\nst.write("Values:", values)\n</pre>\n<p>This is a range time slider:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom datetime import time\n\nappointment = st.slider(\n "Schedule your appointment:",\n value=(time(11, 30), time(12, 45)))\nst.write("You're scheduled for:", appointment)\n</pre>\n<p>Finally, a datetime slider:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nfrom datetime import datetime\n\nstart_time = st.slider(\n "When do you start?",\n value=datetime(2020, 1, 1, 9, 30),\n format="MM/DD/YY - hh:mm")\nst.write("Start time:", start_time)\n</pre>\n<Cloud name=\"doc-slider\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Display a slider widget.</p>\n<p>This supports int, float, date, time, and datetime types.</p>\n<p>This also allows you to render a range slider by passing a two-element\ntuple or list as the <tt class=\"docutils literal\">value</tt>.</p>\n<p>The difference between <tt class=\"docutils literal\">st.slider</tt> and <tt class=\"docutils literal\">st.select_slider</tt> is that\n<tt class=\"docutils literal\">slider</tt> only accepts numerical or date/time data and takes a range as\ninput, while <tt class=\"docutils literal\">select_slider</tt> accepts any datatype and takes an iterable\nset of options.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Integer values exceeding +/- <tt class=\"docutils literal\"><span class=\"pre\">(1<<53)</span> - 1</tt> cannot be accurately\nstored or returned by the widget due to serialization contstraints\nbetween the Python server and JavaScript client. You must handle\nsuch numbers as floats, leading to a loss in precision.</p>\n</div>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this slider is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "a supported type or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The minimum permitted value.\nDefaults to 0 if the value is an int, 0.0 if a float,\nvalue - timedelta(days=14) if a date/datetime, time.min if a time</p>\n", + "default": "0" + }, + { + "name": "max_value", + "type_name": "a supported type or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum permitted value.\nDefaults to 100 if the value is an int, 1.0 if a float,\nvalue + timedelta(days=14) if a date/datetime, time.max if a time</p>\n", + "default": "100" + }, + { + "name": "value", + "type_name": "a supported type or a tuple/list of supported types or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The value of the slider when it first renders. If a tuple/list\nof two values is passed here, then a range slider with those lower\nand upper bounds is rendered. For example, if set to <cite>(1, 10)</cite> the\nslider will have a selectable range between 1 and 10.\nDefaults to min_value.</p>\n", + "default": "min_value" + }, + { + "name": "step", + "type_name": "int, float, timedelta, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The stepping interval.\nDefaults to 1 if the value is an int, 0.01 if a float,\ntimedelta(days=1) if a date/datetime, timedelta(minutes=15) if a time\n(or if max_value - min_value < 1 day)</p>\n", + "default": "1" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A printf-style format string controlling how the interface should\ndisplay numbers. This does not impact the return value.\nFormatter for int/float supports: %d %e %f %g %i\nFormatter for date/time/datetime uses Moment.js notation:\n<a class=\"reference external\" href=\"https://momentjs.com/docs/#/displaying/format/\">https://momentjs.com/docs/#/displaying/format/</a></p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the slider.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this slider's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the slider if set to True. The\ndefault is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "int/float/date/time/datetime or tuple of int/float/date/time/datetime", + "is_generator": false, + "description": "<p>The current value of the slider widget. The return type will match\nthe data type of the value parameter.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/slider.py#L167" + }, + "streamlit.snow": { + "name": "snow", + "signature": "st.snow()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.snow()\n</pre>\n<p>...then watch your app and get ready for a cool celebration!</p>\n</blockquote>\n", + "description": "<p>Draw celebratory snowfall.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/snow.py#L27" + }, + "streamlit.spinner": { + "name": "spinner", + "signature": "st.spinner(text=\"In progress...\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport time\nimport streamlit as st\n\nwith st.spinner('Wait for it...'):\n time.sleep(5)\nst.success('Done!')\n</pre>\n</blockquote>\n", + "description": "<p>Temporarily displays a message while executing a block of code.</p>\n", + "args": [ + { + "name": "text", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A message to display while executing that block</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/spinner.py#L25" + }, + "streamlit.status": { + "name": "status", + "signature": "st.status(label, *, expanded=False, state=\"running\")", + "examples": "<blockquote>\n<p>You can use the <tt class=\"docutils literal\">with</tt> notation to insert any element into an status container:</p>\n<pre class=\"doctest-block\">\nimport time\nimport streamlit as st\n\nwith st.status("Downloading data..."):\n st.write("Searching for data...")\n time.sleep(2)\n st.write("Found URL.")\n time.sleep(1)\n st.write("Downloading data...")\n time.sleep(1)\n\nst.button("Rerun")\n</pre>\n<Cloud name=\"doc-status\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /><p>You can also use <tt class=\"docutils literal\">.update()</tt> on the container to change the label, state,\nor expanded state:</p>\n<pre class=\"doctest-block\">\nimport time\nimport streamlit as st\n\nwith st.status("Downloading data...", expanded=True) as status:\n st.write("Searching for data...")\n time.sleep(2)\n st.write("Found URL.")\n time.sleep(1)\n st.write("Downloading data...")\n time.sleep(1)\n status.update(label="Download complete!", state="complete", expanded=False)\n\nst.button("Rerun")\n</pre>\n<Cloud name=\"doc-status-update\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Insert a status container to display output from long-running tasks.</p>\n<p>Inserts a container into your app that is typically used to show the status and\ndetails of a process or task. The container can hold multiple elements and can\nbe expanded or collapsed by the user similar to <tt class=\"docutils literal\">st.expander</tt>.\nWhen collapsed, all that is visible is the status icon and label.</p>\n<p>The label, state, and expanded state can all be updated by calling <tt class=\"docutils literal\">.update()</tt>\non the returned object. To add elements to the returned container, you can\nuse <tt class=\"docutils literal\">with</tt> notation (preferred) or just call methods directly on the returned\nobject.</p>\n<p>By default, <tt class=\"docutils literal\">st.status()</tt> initializes in the "running" state. When called using\n<tt class=\"docutils literal\">with</tt> notation, it automatically updates to the "complete" state at the end\nof the "with" block. See examples below for more details.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The initial label of the status container. The label can optionally\ncontain Markdown and supports the following elements: Bold,\nItalics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents)\nrender. Display unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>If True, initializes the status container in "expanded" state. Defaults to\nFalse (collapsed).</p>\n", + "default": "s" + }, + { + "name": "state", + "type_name": "\"running\", \"complete\", or \"error\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The initial state of the status container which determines which icon is\nshown:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">running</tt> (default): A spinner icon is shown.</li>\n<li><tt class=\"docutils literal\">complete</tt>: A checkmark icon is shown.</li>\n<li><tt class=\"docutils literal\">error</tt>: An error icon is shown.</li>\n</ul>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "StatusContainer", + "is_generator": false, + "description": "<p>A mutable status container that can hold multiple elements. The label, state,\nand expanded state can be updated after creation via <tt class=\"docutils literal\">.update()</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/layouts.py#L693" + }, + "streamlit.stop": { + "name": "stop", + "signature": "st.stop()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nname = st.text_input('Name')\nif not name:\n st.warning('Please input a name.')\n st.stop()\nst.success('Thank you for inputting a name.')\n</pre>\n</blockquote>\n", + "description": "<p>Stops execution immediately.</p>\n<p>Streamlit will not run any statements after <cite>st.stop()</cite>.\nWe recommend rendering a message to explain why the script has stopped.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/execution_control.py#L32" + }, + "streamlit.subheader": { + "name": "subheader", + "signature": "st.subheader(body, anchor=None, *, help=None, divider=False)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.subheader('This is a subheader with a divider', divider='rainbow')\nst.subheader('_Streamlit_ is :blue[cool] :sunglasses:')\n</pre>\n<Cloud name=\"doc-subheader\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display text in subheader formatting.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: <a class=\"reference external\" href=\"https://github.github.com/gfm\">https://github.github.com/gfm</a>.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the subheader.</p>\n", + "default": null + }, + { + "name": "divider", + "type_name": "bool or \u201cblue\u201d, \u201cgreen\u201d, \u201corange\u201d, \u201cred\u201d, \u201cviolet\u201d, \u201cgray\u201d/\"grey\", or \u201crainbow\u201d", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Shows a colored divider below the header. If True, successive\nheaders will cycle through divider colors. That is, the first\nheader will have a blue line, the second header will have a\ngreen line, and so on. If a string, the color can be set to one of\nthe following: blue, green, orange, red, violet, gray/grey, or\nrainbow.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/heading.py#L116" + }, + "streamlit.success": { + "name": "success", + "signature": "st.success(body, *, icon=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.success('This is a success message!', icon="\u2705")\n</pre>\n</blockquote>\n", + "description": "<p>Display a success message.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The success text to display.</p>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the alert. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/alert.py#L160" + }, + "streamlit.switch_page": { + "name": "switch_page", + "signature": "st.switch_page(page)", + "example": "<blockquote>\n<p>Consider the following example given this file structure:</p>\n<pre class=\"doctest-block\">\nyour-repository/\n\u251c\u2500\u2500 pages/\n\u2502 \u251c\u2500\u2500 page_1.py\n\u2502 \u2514\u2500\u2500 page_2.py\n\u2514\u2500\u2500 your_app.py\n</pre>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nif st.button("Home"):\n st.switch_page("your_app.py")\nif st.button("Page 1"):\n st.switch_page("pages/page_1.py")\nif st.button("Page 2"):\n st.switch_page("pages/page_2.py")\n</pre>\n<Cloud name=\"doc-switch-page\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /></blockquote>\n", + "description": "<p>Programmatically switch the current page in a multipage app.</p>\n<p>When <tt class=\"docutils literal\">st.switch_page</tt> is called, the current page execution stops and\nthe specified page runs as if the user clicked on it in the sidebar\nnavigation. The specified page must be recognized by Streamlit's multipage\narchitecture (your main Python file or a Python file in a <tt class=\"docutils literal\">pages/</tt>\nfolder). Arbitrary Python scripts cannot be passed to <tt class=\"docutils literal\">st.switch_page</tt>.</p>\n", + "args": [ + { + "name": "page", + "type_name": "str or st.Page", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The file path (relative to the main script) or an st.Page indicating\nthe page to switch to.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/commands/execution_control.py#L98" + }, + "streamlit.table": { + "name": "table", + "signature": "st.table(data=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf = pd.DataFrame(np.random.randn(10, 5), columns=("col %d" % i for i in range(5)))\n\nst.table(df)\n</pre>\n<Cloud name=\"doc-table\" path=\"\" query=\"\" stylePlaceholder=\"height: 480px\" /></blockquote>\n", + "description": "<p>Display a static table.</p>\n<p>This differs from <tt class=\"docutils literal\">st.dataframe</tt> in that the table in this case is\nstatic: its entire contents are laid out directly on the page.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, snowflake.snowpark.table.Table, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The table data.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/arrow.py#L588" + }, + "streamlit.tabs": { + "name": "tabs", + "signature": "st.tabs(tabs)", + "examples": "<blockquote>\n<p>You can use the <tt class=\"docutils literal\">with</tt> notation to insert any element into a tab:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ntab1, tab2, tab3 = st.tabs(["Cat", "Dog", "Owl"])\n\nwith tab1:\n st.header("A cat")\n st.image("https://static.streamlit.io/examples/cat.jpg", width=200)\n\nwith tab2:\n st.header("A dog")\n st.image("https://static.streamlit.io/examples/dog.jpg", width=200)\n\nwith tab3:\n st.header("An owl")\n st.image("https://static.streamlit.io/examples/owl.jpg", width=200)\n</pre>\n<Cloud name=\"doc-tabs1\" path=\"\" query=\"\" stylePlaceholder=\"height: 620px\" /><p>Or you can just call methods directly on the returned objects:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport numpy as np\n\ntab1, tab2 = st.tabs(["\ud83d\udcc8 Chart", "\ud83d\uddc3 Data"])\ndata = np.random.randn(10, 1)\n\ntab1.subheader("A tab with a chart")\ntab1.line_chart(data)\n\ntab2.subheader("A tab with the data")\ntab2.write(data)\n</pre>\n<Cloud name=\"doc-tabs2\" path=\"\" query=\"\" stylePlaceholder=\"height: 700px\" /></blockquote>\n", + "description": "<p>Insert containers separated into tabs.</p>\n<p>Inserts a number of multi-element containers as tabs.\nTabs are a navigational element that allows users to easily\nmove between groups of related content.</p>\n<p>To add elements to the returned containers, you can use the <tt class=\"docutils literal\">with</tt> notation\n(preferred) or just call methods directly on the returned object. See\nexamples below.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">All the content of every tab is always sent to and rendered on the frontend.\nConditional rendering is currently not supported.</p>\n</div>\n", + "args": [ + { + "name": "tabs", + "type_name": "list of str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Creates a tab for each string in the list. The first tab is selected by default.\nThe string is used as the name of the tab and can optionally contain Markdown,\nsupporting the following elements: Bold, Italics, Strikethroughs, Inline Code,\nEmojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "list of containers", + "is_generator": false, + "description": "<p>A list of container objects.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/layouts.py#L330" + }, + "streamlit.text": { + "name": "text", + "signature": "st.text(body, *, help=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.text('This is some text.')\n</pre>\n</blockquote>\n", + "description": "<p>Write fixed-width and preformatted text.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The string to display.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the text.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/text.py#L29" + }, + "streamlit.text_area": { + "name": "text_area", + "signature": "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\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ntxt = st.text_area(\n "Text to analyze",\n "It was the best of times, it was the worst of times, it was the age of "\n "wisdom, it was the age of foolishness, it was the epoch of belief, it "\n "was the epoch of incredulity, it was the season of Light, it was the "\n "season of Darkness, it was the spring of hope, it was the winter of "\n "despair, (...)",\n )\n\nst.write(f"You wrote {len(txt)} characters.")\n</pre>\n<Cloud name=\"doc-text-area\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Display a multi-line text input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "object or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The text value of this widget when it first renders. This will be\ncast to str internally. If <tt class=\"docutils literal\">None</tt>, will initialize empty and\nreturn <tt class=\"docutils literal\">None</tt> until the user provides input. Defaults to empty string.</p>\n", + "default": "empty" + }, + { + "name": "height", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Desired height of the UI element expressed in pixels. If None, a\ndefault height is used.</p>\n", + "default": "height" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Maximum number of characters allowed in text area.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the textarea.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this text_area's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string displayed when the text area is empty. If None,\nno text is displayed.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the text area if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str or None", + "is_generator": false, + "description": "<p>The current value of the text area widget or <tt class=\"docutils literal\">None</tt> if no value has been\nprovided by the user.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/text_widgets.py#L388" + }, + "streamlit.text_input": { + "name": "text_input", + "signature": "st.text_input(label, value=\"\", max_chars=None, key=None, type=\"default\", help=None, autocomplete=None, on_change=None, args=None, kwargs=None, *, placeholder=None, disabled=False, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\ntitle = st.text_input("Movie title", "Life of Brian")\nst.write("The current movie title is", title)\n</pre>\n<Cloud name=\"doc-text-input\" path=\"\" query=\"\" stylePlaceholder=\"height: 260px\" /></blockquote>\n", + "description": "<p>Display a single-line text input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "object or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The text value of this widget when it first renders. This will be\ncast to str internally. If <tt class=\"docutils literal\">None</tt>, will initialize empty and\nreturn <tt class=\"docutils literal\">None</tt> until the user provides input. Defaults to empty string.</p>\n", + "default": "empty" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Max number of characters allowed in text input.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "type", + "type_name": "\"default\" or \"password\"", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The type of the text input. This can be either "default" (for\na regular text input), or "password" (for a text input that\nmasks the user's typed value). Defaults to "default".</p>\n", + "default": "s" + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the input.</p>\n", + "default": null + }, + { + "name": "autocomplete", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional value that will be passed to the <input> element's\nautocomplete property. If unspecified, this value will be set to\n"new-password" for "password" inputs, and the empty string for\n"default" inputs. For more details, see <a class=\"reference external\" href=\"https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete\">https://developer.mozilla.org/en-US/docs/Web/HTML/Attributes/autocomplete</a></p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this text input's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "placeholder", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string displayed when the text input is empty. If None,\nno text is displayed.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the text input if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "str or None", + "is_generator": false, + "description": "<p>The current value of the text input widget or <tt class=\"docutils literal\">None</tt> if no value has been\nprovided by the user.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/text_widgets.py#L117" + }, + "streamlit.time_input": { + "name": "time_input", + "signature": "st.time_input(label, value=\"now\", key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\", step=0:15:00)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport datetime\nimport streamlit as st\n\nt = st.time_input("Set an alarm for", datetime.time(8, 45))\nst.write("Alarm is set for", t)\n</pre>\n<Cloud name=\"doc-time-input\" path=\"\" query=\"\" stylePlaceholder=\"height: 260px\" /><p>To initialize an empty time input, use <tt class=\"docutils literal\">None</tt> as the value:</p>\n<pre class=\"doctest-block\">\nimport datetime\nimport streamlit as st\n\nt = st.time_input("Set an alarm for", value=None)\nst.write("Alarm is set for", t)\n</pre>\n<Cloud name=\"doc-time-input-empty\" path=\"\" query=\"\" stylePlaceholder=\"height: 260px\" /></blockquote>\n", + "description": "<p>Display a time input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this time input is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "datetime.time/datetime.datetime, \"now\" or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The value of this widget when it first renders. This will be\ncast to str internally. If <tt class=\"docutils literal\">None</tt>, will initialize empty and\nreturn <tt class=\"docutils literal\">None</tt> until the user selects a time. If "now" (default),\nwill initialize with the current time.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the input.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this time_input's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the time input if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it above the widget (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + }, + { + "name": "step", + "type_name": "int or timedelta", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The stepping interval in seconds. Defaults to 900, i.e. 15 minutes.\nYou can also pass a datetime.timedelta object.</p>\n", + "default": "900" + } + ], + "returns": [ + { + "type_name": "datetime.time or None", + "is_generator": false, + "description": "<p>The current value of the time input widget or <tt class=\"docutils literal\">None</tt> if no time has been\nselected.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/time_widgets.py#L291" + }, + "streamlit.title": { + "name": "title", + "signature": "st.title(body, anchor=None, *, help=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.title('This is a title')\nst.title('_Streamlit_ is :blue[cool] :sunglasses:')\n</pre>\n<Cloud name=\"doc-title\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display text in title formatting.</p>\n<p>Each document should have a single <cite>st.title()</cite>, although this is not\nenforced.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The text to display as Github-flavored Markdown. Syntax\ninformation can be found at: <a class=\"reference external\" href=\"https://github.github.com/gfm\">https://github.github.com/gfm</a>.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "anchor", + "type_name": "str or False", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The anchor name of the header that can be accessed with #anchor\nin the URL. If omitted, it generates an anchor using the body.\nIf False, the anchor is not shown in the UI.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed next to the title.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/heading.py#L189" + }, + "streamlit.toast": { + "name": "toast", + "signature": "st.toast(body, *, icon=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.toast('Your edited image was saved!', icon='\ud83d\ude0d')\n</pre>\n</blockquote>\n", + "description": "<p>Display a short message, known as a notification "toast".</p>\n<p>The toast appears in the app's bottom-right corner and disappears after four seconds.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\"><tt class=\"docutils literal\">st.toast</tt> is not compatible with Streamlit's <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/architecture/caching\">caching</a> and\ncannot be called within a cached function.</p>\n</div>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The string to display as Github-flavored Markdown. Syntax\ninformation can be found at: <a class=\"reference external\" href=\"https://github.github.com/gfm\">https://github.github.com/gfm</a>.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the alert. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/toast.py#L39" + }, + "streamlit.toggle": { + "name": "toggle", + "signature": "st.toggle(label, value=False, key=None, help=None, on_change=None, args=None, kwargs=None, *, disabled=False, label_visibility=\"visible\")", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\non = st.toggle("Activate feature")\n\nif on:\n st.write("Feature activated!")\n</pre>\n<Cloud name=\"doc-toggle\" path=\"\" query=\"\" stylePlaceholder=\"height: 220px\" /></blockquote>\n", + "description": "<p>Display a toggle widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short label explaining to the user what this toggle is for.\nThe label can optionally contain Markdown and supports the following\nelements: Bold, Italics, Strikethroughs, Inline Code, Emojis, and Links.</p>\n<p>This also supports:</p>\n<ul class=\"simple\">\n<li>Emoji shortcodes, such as <tt class=\"docutils literal\">:+1:</tt> and <tt class=\"docutils literal\">:sunglasses:</tt>.\nFor a list of all supported codes,\nsee <a class=\"reference external\" href=\"https://share.streamlit.io/streamlit/emoji-shortcodes\">https://share.streamlit.io/streamlit/emoji-shortcodes</a>.</li>\n<li>LaTeX expressions, by wrapping them in "$" or "$$" (the "$$"\nmust be on their own lines). Supported LaTeX functions are listed\nat <a class=\"reference external\" href=\"https://katex.org/docs/supported.html\">https://katex.org/docs/supported.html</a>.</li>\n<li>Colored text and background colors for text, using the syntax\n<tt class=\"docutils literal\">:color[text to be colored]</tt> and <tt class=\"docutils literal\"><span class=\"pre\">:color-background[text</span> to be colored]</tt>,\nrespectively. <tt class=\"docutils literal\">color</tt> must be replaced with any of the following\nsupported colors: blue, green, orange, red, violet, gray/grey, rainbow.\nFor example, you can use <tt class=\"docutils literal\">:orange[your text here]</tt> or\n<tt class=\"docutils literal\"><span class=\"pre\">:blue-background[your</span> text here]</tt>.</li>\n</ul>\n<p>Unsupported elements are unwrapped so only their children (text contents) render.\nDisplay unsupported elements as literal characters by\nbackslash-escaping them. E.g. <tt class=\"docutils literal\">1\\. Not an ordered list</tt>.</p>\n<p>For accessibility reasons, you should never set an empty label (label="")\nbut hide it with label_visibility if needed. In the future, we may disallow\nempty labels by raising an exception.</p>\n", + "default": null + }, + { + "name": "value", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Preselect the toggle when it first renders. This will be\ncast to bool internally.</p>\n", + "default": null + }, + { + "name": "key", + "type_name": "str or int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional string or integer to use as the unique key for the widget.\nIf this is omitted, a key will be generated for the widget\nbased on its content. Multiple widgets of the same type may\nnot share the same key.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tooltip that gets displayed next to the toggle.</p>\n", + "default": null + }, + { + "name": "on_change", + "type_name": "callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional callback invoked when this toggle's value changes.</p>\n", + "default": null + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional tuple of args to pass to the callback.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An optional dict of kwargs to pass to the callback.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional boolean, which disables the toggle if set to True.\nThe default is False.</p>\n", + "default": "False" + }, + { + "name": "label_visibility", + "type_name": "\"visible\", \"hidden\", or \"collapsed\"", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The visibility of the label. If "hidden", the label doesn't show but there\nis still empty space for it (equivalent to label="").\nIf "collapsed", both the label and the space are removed. Default is\n"visible".</p>\n", + "default": "is" + } + ], + "returns": [ + { + "type_name": "bool", + "is_generator": false, + "description": "<p>Whether or not the toggle is checked.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/widgets/checkbox.py#L163" + }, + "streamlit.vega_lite_chart": { + "name": "vega_lite_chart", + "signature": "st.vega_lite_chart(data=None, spec=None, *, use_container_width=False, theme=\"streamlit\", key=None, on_select=\"ignore\", selection_mode=None, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nchart_data = pd.DataFrame(np.random.randn(200, 3), columns=["a", "b", "c"])\n\nst.vega_lite_chart(\n chart_data,\n {\n "mark": {"type": "circle", "tooltip": True},\n "encoding": {\n "x": {"field": "a", "type": "quantitative"},\n "y": {"field": "b", "type": "quantitative"},\n "size": {"field": "c", "type": "quantitative"},\n "color": {"field": "c", "type": "quantitative"},\n },\n },\n)\n</pre>\n<Cloud name=\"doc-vega-lite-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 450px\" /><p>Examples of Vega-Lite usage without Streamlit can be found at\n<a class=\"reference external\" href=\"https://vega.github.io/vega-lite/examples/\">https://vega.github.io/vega-lite/examples/</a>. Most of those can be easily\ntranslated to the syntax shown above.</p>\n</blockquote>\n", + "description": "<p>Display a chart using the Vega-Lite library.</p>\n<p><a class=\"reference external\" href=\"https://vega.github.io/vega-lite/\">Vega-Lite</a> is a high-level\ngrammar for defining interactive graphics.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Either the data to be plotted or a Vega-Lite spec containing the\ndata (which more closely follows the Vega-Lite API).</p>\n", + "default": null + }, + { + "name": "spec", + "type_name": "dict or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The Vega-Lite spec for the chart. If <tt class=\"docutils literal\">spec</tt> is <tt class=\"docutils literal\">None</tt> (default),\nStreamlit uses the spec passed in <tt class=\"docutils literal\">data</tt>. You cannot pass a spec\nto both <tt class=\"docutils literal\">data</tt> and <tt class=\"docutils literal\">spec</tt>. See\n<a class=\"reference external\" href=\"https://vega.github.io/vega-lite/docs/\">https://vega.github.io/vega-lite/docs/</a> for more info.</p>\n", + "default": null + }, + { + "name": "use_container_width", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to override the figure's native width with the width of\nthe parent container. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">False</tt>\n(default), Streamlit sets the width of the chart to fit its contents\naccording to the plotting library, up to the width of the parent\ncontainer. If <tt class=\"docutils literal\">use_container_width</tt> is <tt class=\"docutils literal\">True</tt>, Streamlit sets\nthe width of the figure to match the width of the parent container.</p>\n", + "default": null + }, + { + "name": "theme", + "type_name": "\"streamlit\" or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The theme of the chart. If <tt class=\"docutils literal\">theme</tt> is <tt class=\"docutils literal\">"streamlit"</tt> (default),\nStreamlit uses its own design default. If <tt class=\"docutils literal\">theme</tt> is <tt class=\"docutils literal\">None</tt>,\nStreamlit falls back to the default behavior of the library.</p>\n", + "default": "behavior" + }, + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional string to use for giving this element a stable\nidentity. If <tt class=\"docutils literal\">key</tt> is <tt class=\"docutils literal\">None</tt> (default), this element's identity\nwill be determined based on the values of the other parameters.</p>\n<p>Additionally, if selections are activated and <tt class=\"docutils literal\">key</tt> is provided,\nStreamlit will register the key in Session State to store the\nselection state. The selection state is read-only.</p>\n", + "default": null + }, + { + "name": "on_select", + "type_name": "\"ignore\", \"rerun\", or callable", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>How the figure should respond to user selection events. This\ncontrols whether or not the figure behaves like an input widget.\n<tt class=\"docutils literal\">on_select</tt> can be one of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">"ignore"</tt> (default): Streamlit will not react to any selection\nevents in the chart. The figure will not behave like an input\nwidget.</li>\n<li><tt class=\"docutils literal\">"rerun"</tt>: Streamlit will rerun the app when the user selects\ndata in the chart. In this case, <tt class=\"docutils literal\">st.vega_lite_chart</tt> will\nreturn the selection data as a dictionary.</li>\n<li>A <tt class=\"docutils literal\">callable</tt>: Streamlit will rerun the app and execute the\n<tt class=\"docutils literal\">callable</tt> as a callback function before the rest of the app.\nIn this case, <tt class=\"docutils literal\">st.vega_lite_chart</tt> will return the selection data\nas a dictionary.</li>\n</ul>\n<p>To use selection events, the Vega-Lite spec defined in <tt class=\"docutils literal\">data</tt> or\n<tt class=\"docutils literal\">spec</tt> must include selection parameters from the the charting\nlibrary. To learn about defining interactions in Vega-Lite, see\n<a class=\"reference external\" href=\"https://vega.github.io/vega-lite/docs/parameter.html\">Dynamic Behaviors with Parameters</a>\nin Vega-Lite's documentation.</p>\n", + "default": null + }, + { + "name": "selection_mode", + "type_name": "str or Iterable of str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The selection parameters Streamlit should use. If\n<tt class=\"docutils literal\">selection_mode</tt> is <tt class=\"docutils literal\">None</tt> (default), Streamlit will use all\nselection parameters defined in the chart's Vega-Lite spec.</p>\n<p>When Streamlit uses a selection parameter, selections from that\nparameter will trigger a rerun and be included in the selection\nstate. When Streamlit does not use a selection parameter,\nselections from that parameter will not trigger a rerun and not be\nincluded in the selection state.</p>\n<p>Selection parameters are identified by their <tt class=\"docutils literal\">name</tt> property.</p>\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The Vega-Lite spec for the chart as keywords. This is an alternative\nto <tt class=\"docutils literal\">spec</tt>.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "element or dict", + "is_generator": false, + "description": "<p>If <tt class=\"docutils literal\">on_select</tt> is <tt class=\"docutils literal\">"ignore"</tt> (default), this method returns an\ninternal placeholder for the chart element that can be used with\nthe <tt class=\"docutils literal\">.add_rows()</tt> method. Otherwise, this method returns a\ndictionary-like object that supports both key and attribute\nnotation. The attributes are described by the <tt class=\"docutils literal\">VegaLiteState</tt>\ndictionary schema.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L1554" + }, + "streamlit.video": { + "name": "video", + "signature": "st.video(data, format=\"video/mp4\", start_time=0, *, subtitles=None, end_time=None, loop=False, autoplay=False, muted=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nvideo_file = open('myvideo.mp4', 'rb')\nvideo_bytes = video_file.read()\n\nst.video(video_bytes)\n</pre>\n<Cloud name=\"doc-video\" path=\"\" query=\"\" stylePlaceholder=\"height: 700px\" /><p>When you include subtitles, they will be turned on by default. A viewer\ncan turn off the subtitles (or captions) from the browser's default video\ncontrol menu, usually located in the lower-right corner of the video.</p>\n<p>Here is a simple VTT file (<tt class=\"docutils literal\">subtitles.vtt</tt>):</p>\n<pre class=\"doctest-block\">\nWEBVTT\n\n0:00:01.000 --> 0:00:02.000\nLook!\n\n0:00:03.000 --> 0:00:05.000\nLook at the pretty stars!\n</pre>\n<p>If the above VTT file lives in the same directory as your app, you can\nadd subtitles like so:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nVIDEO_URL = "https://example.com/not-youtube.mp4"\nst.video(VIDEO_URL, subtitles="subtitles.vtt")\n</pre>\n<Cloud name=\"doc-video-subtitles\" path=\"\" query=\"\" stylePlaceholder=\"height: 700px\" /><p>See additional examples of supported subtitle input types in our\n<a class=\"reference external\" href=\"https://doc-video-subtitle-inputs.streamlit.app/\">video subtitles feature demo</a>.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Some videos may not display if they are encoded using MP4V (which is an export option in OpenCV), as this codec is\nnot widely supported by browsers. Converting your video to H.264 will allow the video to be displayed in Streamlit.\nSee this <a class=\"reference external\" href=\"https://stackoverflow.com/a/49535220/2394542\">StackOverflow post</a> or this\n<a class=\"reference external\" href=\"https://discuss.streamlit.io/t/st-video-doesnt-show-opencv-generated-mp4/3193/2\">Streamlit forum post</a>\nfor more information.</p>\n</div>\n</blockquote>\n", + "description": "<p>Display a video player.</p>\n", + "args": [ + { + "name": "data", + "type_name": "str, bytes, io.BytesIO, numpy.ndarray, or file", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Raw video data, filename, or URL pointing to a video to load.\nIncludes support for YouTube URLs.\nNumpy arrays and raw data formats must include all necessary file\nheaders to match specified file format.</p>\n", + "default": null + }, + { + "name": "format", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The mime type for the video file. Defaults to <tt class=\"docutils literal\">"video/mp4"</tt>.\nSee <a class=\"reference external\" href=\"https://tools.ietf.org/html/rfc4281\">https://tools.ietf.org/html/rfc4281</a> for more info.</p>\n", + "default": "s" + }, + { + "name": "start_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The time from which the element should start playing. This can be\none of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default): The element plays from the beginning.</li>\n<li>An <tt class=\"docutils literal\">int</tt> or <tt class=\"docutils literal\">float</tt> specifying the time in seconds. <tt class=\"docutils literal\">float</tt>\nvalues are rounded down to whole seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas'\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"2 minute"</tt>, <tt class=\"docutils literal\">"20s"</tt>, or <tt class=\"docutils literal\">"1m14s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(seconds=70)</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "subtitles", + "type_name": "str, bytes, Path, io.BytesIO, or dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Optional subtitle data for the video, supporting several input types:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default): No subtitles.</li>\n<li>A string, bytes, or Path: File path to a subtitle file in <tt class=\"docutils literal\">.vtt</tt> or <tt class=\"docutils literal\">.srt</tt> formats, or\nthe raw content of subtitles conforming to these formats.\nIf providing raw content, the string must adhere to the WebVTT or SRT\nformat specifications.</li>\n<li>io.BytesIO: A BytesIO stream that contains valid <tt class=\"docutils literal\">.vtt</tt> or <tt class=\"docutils literal\">.srt</tt>\nformatted subtitle data.</li>\n<li>A dictionary: Pairs of labels and file paths or raw subtitle content in\n<tt class=\"docutils literal\">.vtt</tt> or <tt class=\"docutils literal\">.srt</tt> formats to enable multiple subtitle tracks.\nThe label will be shown in the video player. Example:\n<tt class=\"docutils literal\">{"English": "path/to/english.vtt", "French": "path/to/french.srt"}</tt></li>\n</ul>\n<p>When provided, subtitles are displayed by default. For multiple\ntracks, the first one is displayed by default. If you don't want any\nsubtitles displayed by default, use an empty string for the value\nin a dictrionary's first pair: <tt class=\"docutils literal\">{"None": "", "English": "path/to/english.vtt"}</tt></p>\n<p>Not supported for YouTube videos.</p>\n", + "default": null + }, + { + "name": "end_time", + "type_name": "int, float, timedelta, str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The time at which the element should stop playing. This can be\none of the following:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default): The element plays through to the end.</li>\n<li>An <tt class=\"docutils literal\">int</tt> or <tt class=\"docutils literal\">float</tt> specifying the time in seconds. <tt class=\"docutils literal\">float</tt>\nvalues are rounded down to whole seconds.</li>\n<li>A string specifying the time in a format supported by <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.Timedelta.html\">Pandas'\nTimedelta constructor</a>,\ne.g. <tt class=\"docutils literal\">"2 minute"</tt>, <tt class=\"docutils literal\">"20s"</tt>, or <tt class=\"docutils literal\">"1m14s"</tt>.</li>\n<li>A <tt class=\"docutils literal\">timedelta</tt> object from <a class=\"reference external\" href=\"https://docs.python.org/3/library/datetime.html#timedelta-objects\">Python's built-in datetime library</a>,\ne.g. <tt class=\"docutils literal\">timedelta(seconds=70)</tt>.</li>\n</ul>\n", + "default": null + }, + { + "name": "loop", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether the video should loop playback.</p>\n", + "default": null + }, + { + "name": "autoplay", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether the video should start playing automatically. This is\n<tt class=\"docutils literal\">False</tt> by default. Browsers will not autoplay unmuted videos\nif the user has not interacted with the page by clicking somewhere.\nTo enable autoplay without user interaction, you must also set\n<tt class=\"docutils literal\">muted=True</tt>.</p>\n", + "default": null + }, + { + "name": "muted", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether the video should play with the audio silenced. This is\n<tt class=\"docutils literal\">False</tt> by default. Use this in conjunction with <tt class=\"docutils literal\">autoplay=True</tt>\nto enable autoplay without user interaction.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/media.py#L197" + }, + "streamlit.warning": { + "name": "warning", + "signature": "st.warning(body, *, icon=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.warning('This is a warning', icon="\u26a0\ufe0f")\n</pre>\n</blockquote>\n", + "description": "<p>Display warning message.</p>\n", + "args": [ + { + "name": "body", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The warning text to display.</p>\n", + "default": null + }, + { + "name": "icon", + "type_name": "str, None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional emoji or icon to display next to the alert. If <tt class=\"docutils literal\">icon</tt>\nis <tt class=\"docutils literal\">None</tt> (default), no icon is displayed. If <tt class=\"docutils literal\">icon</tt> is a\nstring, the following options are valid:</p>\n<ul>\n<li><p class=\"first\">A single-character emoji. For example, you can set <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udea8"</span></tt>\nor <tt class=\"docutils literal\"><span class=\"pre\">icon="\ud83d\udd25"</span></tt>. Emoji short codes are not supported.</p>\n</li>\n<li><p class=\"first\">An icon from the Material Symbols library (outlined style) in the\nformat <tt class=\"docutils literal\">":material/icon_name:"</tt> where "icon_name" is the name\nof the icon in snake case.</p>\n<p>For example, <tt class=\"docutils literal\"><span class=\"pre\">icon=":material/thumb_up:"</span></tt> will display the\nThumb Up icon. Find additional icons in the <a class=\"reference external\" href=\"https://fonts.google.com/icons?icon.set=Material+Symbols&icon.style=Outlined\">Material Symbols</a>\nfont library.</p>\n</li>\n</ul>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/alert.py#L73" + }, + "streamlit.write": { + "name": "write", + "signature": "st.write(*args, unsafe_allow_html=False, **kwargs)", + "example": "<blockquote>\n<p>Its basic use case is to draw Markdown-formatted text, whenever the\ninput is a string:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.write('Hello, *World!* :sunglasses:')\n</pre>\n<Cloud name=\"doc-write1\" path=\"\" query=\"\" stylePlaceholder=\"height: 150px\" /><p>As mentioned earlier, <tt class=\"docutils literal\">st.write()</tt> also accepts other data formats, such as\nnumbers, data frames, styled data frames, and assorted objects:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\n\nst.write(1234)\nst.write(pd.DataFrame({\n 'first column': [1, 2, 3, 4],\n 'second column': [10, 20, 30, 40],\n}))\n</pre>\n<Cloud name=\"doc-write2\" path=\"\" query=\"\" stylePlaceholder=\"height: 350px\" /><p>Finally, you can pass in multiple arguments to do things like:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.write('1 + 1 = ', 2)\nst.write('Below is a DataFrame:', data_frame, 'Above is a dataframe.')\n</pre>\n<Cloud name=\"doc-write3\" path=\"\" query=\"\" stylePlaceholder=\"height: 410px\" /><p>Oh, one more thing: <tt class=\"docutils literal\">st.write</tt> accepts chart objects too! For example:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\ndf = pd.DataFrame(\n np.random.randn(200, 3),\n columns=['a', 'b', 'c'])\n\nc = alt.Chart(df).mark_circle().encode(\n x='a', y='b', size='c', color='c', tooltip=['a', 'b', 'c'])\n\nst.write(c)\n</pre>\n<Cloud name=\"doc-vega-lite-chart\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Write arguments to the app.</p>\n<p>This is the Swiss Army knife of Streamlit commands: it does different\nthings depending on what you throw at it. Unlike other Streamlit commands,\nwrite() has some unique properties:</p>\n<ol class=\"arabic simple\">\n<li>You can pass in multiple arguments, all of which will be written.</li>\n<li>Its behavior depends on the input types as follows.</li>\n<li>It returns None, so its "slot" in the App cannot be reused.</li>\n</ol>\n", + "args": [ + { + "name": "*args", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>One or many objects to print to the App.</p>\n<p>Arguments are handled as follows:</p>\n<ul class=\"simple\">\n<li><dl class=\"first docutils\">\n<dt>write(string) <span class=\"classifier-delimiter\">:</span> <span class=\"classifier\">Prints the formatted Markdown string, with</span></dt>\n<dd>support for LaTeX expression, emoji shortcodes, and colored text.\nSee docs for st.markdown for more.</dd>\n</dl>\n</li>\n<li>write(data_frame) : Displays the DataFrame as a table.</li>\n<li>write(error) : Prints an exception specially.</li>\n<li>write(func) : Displays information about a function.</li>\n<li>write(module) : Displays information about the module.</li>\n<li>write(class) : Displays information about a class.</li>\n<li>write(dict) : Displays dict in an interactive widget.</li>\n<li>write(mpl_fig) : Displays a Matplotlib figure.</li>\n<li>write(generator) : Streams the output of a generator.</li>\n<li>write(openai.Stream) : Streams the output of an OpenAI stream.</li>\n<li>write(altair) : Displays an Altair chart.</li>\n<li>write(PIL.Image) : Displays an image.</li>\n<li>write(keras) : Displays a Keras model.</li>\n<li>write(graphviz) : Displays a Graphviz graph.</li>\n<li>write(plotly_fig) : Displays a Plotly figure.</li>\n<li>write(bokeh_fig) : Displays a Bokeh figure.</li>\n<li>write(sympy_expr) : Prints SymPy expression using LaTeX.</li>\n<li>write(htmlable) : Prints _repr_html_() for the object if available.</li>\n<li>write(obj) : Prints str(obj) if otherwise unknown.</li>\n</ul>\n", + "default": null + }, + { + "name": "unsafe_allow_html", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether to render HTML within <tt class=\"docutils literal\">*args</tt>. This only applies to\nstrings or objects falling back on <tt class=\"docutils literal\">_repr_html_()</tt>. If this is\n<tt class=\"docutils literal\">False</tt> (default), any HTML tags found in <tt class=\"docutils literal\">body</tt> will be\nescaped and therefore treated as raw text. If this is <tt class=\"docutils literal\">True</tt>, any\nHTML expressions within <tt class=\"docutils literal\">body</tt> will be rendered.</p>\n<p>Adding custom HTML to your app impacts safety, styling, and\nmaintainability.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">If you only want to insert HTML or CSS without Markdown text,\nwe recommend using <tt class=\"docutils literal\">st.html</tt> instead.</p>\n</div>\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "any", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Keyword arguments. Not used.</p>\n", + "default": null, + "deprecated": { + "deprecated": true, + "deprecatedText": "<p><tt class=\"docutils literal\">**kwargs</tt> is deprecated and will be removed in a later version.\nUse other, more specific Streamlit commands to pass additional\nkeyword arguments.</p>\n" + } + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/write.py#L233" + }, + "streamlit.write_stream": { + "name": "write_stream", + "signature": "st.write_stream(stream)", + "example": "<blockquote>\n<p>You can pass an OpenAI stream as shown in our tutorial, <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/tutorials/llms/build-conversational-apps#build-a-chatgpt-like-app\">Build a basic LLM chat app</a>. Alternatively,\nyou can pass a generic generator function as input:</p>\n<pre class=\"doctest-block\">\nimport time\nimport numpy as np\nimport pandas as pd\nimport streamlit as st\n\n_LOREM_IPSUM = """\nLorem ipsum dolor sit amet, **consectetur adipiscing** elit, sed do eiusmod tempor\nincididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis\nnostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.\n"""\n\n\ndef stream_data():\n for word in _LOREM_IPSUM.split(" "):\n yield word + " "\n time.sleep(0.02)\n\n yield pd.DataFrame(\n np.random.randn(5, 10),\n columns=["a", "b", "c", "d", "e", "f", "g", "h", "i", "j"],\n )\n\n for word in _LOREM_IPSUM.split(" "):\n yield word + " "\n time.sleep(0.02)\n\n\nif st.button("Stream data"):\n st.write_stream(stream_data)\n</pre>\n<Cloud name=\"doc-write-stream-data\" path=\"\" query=\"\" stylePlaceholder=\"height: 550px\" /></blockquote>\n", + "description": "<p>Stream a generator, iterable, or stream-like sequence to the app.</p>\n<p><tt class=\"docutils literal\">st.write_stream</tt> iterates through the given sequences and writes all\nchunks to the app. String chunks will be written using a typewriter effect.\nOther data types will be written using <tt class=\"docutils literal\">st.write</tt>.</p>\n", + "args": [ + { + "name": "stream", + "type_name": "Callable, Generator, Iterable, OpenAI Stream, or LangChain Stream", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The generator or iterable to stream.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">To use additional LLM libraries, you can create a wrapper to\nmanually define a generator function and include custom output\nparsing.</p>\n</div>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "str or list", + "is_generator": false, + "description": "<p>The full response. If the streamed output only contains text, this\nis a string. Otherwise, this is a list of all the streamed objects.\nThe return value is fully compatible as input for <tt class=\"docutils literal\">st.write</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/write.py#L59" + }, + "streamlit.experimental_memo.clear": { + "name": "experimental_memo.clear", + "signature": "st.experimental_memo.clear()", + "description": "<p>Clear all in-memory and on-disk data caches.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_data_api.py#L608" + }, + "streamlit.cache_data.clear": { + "name": "cache_data.clear", + "signature": "st.cache_data.clear()", + "description": "<p>Clear all in-memory and on-disk data caches.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_data_api.py#L608" + }, + "streamlit.experimental_singleton.clear": { + "name": "experimental_singleton.clear", + "signature": "st.experimental_singleton.clear()", + "description": "<p>Clear all cache_resource caches.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_resource_api.py#L457" + }, + "streamlit.cache_resource.clear": { + "name": "cache_resource.clear", + "signature": "st.cache_resource.clear()", + "description": "<p>Clear all cache_resource caches.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_resource_api.py#L457" + }, + "streamlit.query_params.clear": { + "name": "clear", + "signature": "st.query_params.clear()", + "description": "<p>Clear all query parameters from the URL of the app.</p>\n", + "args": [], + "returns": [ + { + "type_name": "None", + "is_generator": false, + "description": "", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/state/query_params_proxy.py#L132" + }, + "streamlit.query_params.from_dict": { + "name": "from_dict", + "signature": "st.query_params.from_dict(params)", + "example": "<pre class=\"doctest-block\">\nimport streamlit as st\n\nst.query_params.from_dict({"foo": "bar", "baz": [1, "two"]})\n</pre>\n", + "description": "<p>Set all of the query parameters from a dictionary or dictionary-like object.</p>\n<p>This method primarily exists for advanced users who want to control\nmultiple query parameters in a single update. To set individual query\nparameters, use key or attribute notation instead.</p>\n<p>This method inherits limitations from <tt class=\"docutils literal\">st.query_params</tt> and can't be\nused to set embedding options as described in <a class=\"reference external\" href=\"https://docs.streamlit.io/deploy/streamlit-community-cloud/share-your-app/embed-your-app#embed-options\">Embed your app</a>.</p>\n<p>To handle repeated keys, the value in a key-value pair should be a list.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\"><tt class=\"docutils literal\">.from_dict()</tt> is not a direct inverse of <tt class=\"docutils literal\">.to_dict()</tt> if\nyou are working with repeated keys. A true inverse operation is\n<tt class=\"docutils literal\">{key: st.query_params.get_all(key) for key st.query_params}</tt>.</p>\n</div>\n", + "args": [ + { + "name": "params", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A dictionary used to replace the current query parameters.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/state/query_params_proxy.py#L174" + }, + "streamlit.query_params.get_all": { + "name": "get_all", + "signature": "st.query_params.get_all(key)", + "description": "<p>Get a list of all query parameter values associated to a given key.</p>\n<p>When a key is repeated as a query parameter within the URL, this method\nallows all values to be obtained. In contrast, dict-like methods only\nretrieve the last value when a key is repeated in the URL.</p>\n", + "args": [ + { + "name": "key", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label of the query parameter in the URL.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "List[str]", + "is_generator": false, + "description": "<p>A list of values associated to the given key. May return zero, one,\nor multiple values.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/state/query_params_proxy.py#L109" + }, + "streamlit.query_params.to_dict": { + "name": "to_dict", + "signature": "st.query_params.to_dict()", + "description": "<p>Get all query parameters as a dictionary.</p>\n<p>This method primarily exists for internal use and is not needed for\nmost cases. <tt class=\"docutils literal\">st.query_params</tt> returns an object that inherits from\n<tt class=\"docutils literal\">dict</tt> by default.</p>\n<p>When a key is repeated as a query parameter within the URL, this method\nwill return only the last value of each unique key.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "<p>A dictionary of the current query paramters in the app's URL.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/state/query_params_proxy.py#L144" + }, + "streamlit.query_params.update": { + "name": "update", + "signature": "st.query_params.update(other=(), /, **kwds)", + "description": "<p>Update one or more values in query_params at once from a dictionary or</p>\n<p>dictionary-like object.</p>\n<p>See <cite>Mapping.update()</cite> from Python's <cite>collections</cite> library.</p>\n", + "args": [ + { + "name": "other", + "type_name": "SupportsKeysAndGetItem[str, str] | Iterable[tuple[str, str]]", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A dictionary or mapping of strings to strings.</p>\n", + "default": null + }, + { + "name": "**kwds", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Additional key/value pairs to update passed as keyword arguments.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/state/query_params_proxy.py#L87" + }, + "streamlit.connections.BaseConnection": { + "name": "BaseConnection", + "signature": "st.connections.BaseConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L27", + "description": "<p>The abstract base class that all Streamlit Connections must inherit from.</p>\n<p>This base class provides connection authors with a standardized way to hook into the\n<tt class=\"docutils literal\">st.connection()</tt> factory function: connection authors are required to provide an\nimplementation for the abstract method <tt class=\"docutils literal\">_connect</tt> in their subclasses.</p>\n<p>Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">While providing an implementation of <tt class=\"docutils literal\">_connect</tt> is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a <tt class=\"docutils literal\">query()</tt> method for\nreads and a <tt class=\"docutils literal\">session</tt> property for more complex operations.</p>\n</div>\n", + "args": [], + "returns": [] + }, + "streamlit.connections.ExperimentalBaseConnection": { + "name": "ExperimentalBaseConnection", + "signature": "st.connections.ExperimentalBaseConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L27", + "description": "<p>The abstract base class that all Streamlit Connections must inherit from.</p>\n<p>This base class provides connection authors with a standardized way to hook into the\n<tt class=\"docutils literal\">st.connection()</tt> factory function: connection authors are required to provide an\nimplementation for the abstract method <tt class=\"docutils literal\">_connect</tt> in their subclasses.</p>\n<p>Additionally, it also provides a few methods/properties designed to make\nimplementation of connections more convenient. See the docstrings for each of the\nmethods of this class for more information</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">While providing an implementation of <tt class=\"docutils literal\">_connect</tt> is technically all that's\nrequired to define a valid connection, connections should also provide the user\nwith context-specific ways of interacting with the underlying connection object.\nFor example, the first-party SQLConnection provides a <tt class=\"docutils literal\">query()</tt> method for\nreads and a <tt class=\"docutils literal\">session</tt> property for more complex operations.</p>\n</div>\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SQLConnection": { + "name": "SQLConnection", + "signature": "st.connections.SQLConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "connect", + "signature": "st.connections.connect.connect()", + "description": "<p>Call <tt class=\"docutils literal\">.connect()</tt> on the underlying SQLAlchemy Engine, returning a new <tt class=\"docutils literal\">sqlalchemy.engine.Connection</tt> object.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L251" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Run a read-only query.</p>", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The read-only SQL query to execute.</p>\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.</p>\n", + "default": "to" + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + }, + { + "name": "index_col", + "type_name": "str, list of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column(s) to set as index(MultiIndex). Default is None.</p>\n", + "default": "None" + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.</p>\n", + "default": "None" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in <a class=\"reference external\" href=\"https://peps.python.org/pep-0249/#paramstyle\">PEP 249\nparamstyle</a>, is supported.\nDefault is None.</p>\n", + "default": "None" + }, + { + "name": "**kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Additional keyword arguments are passed to <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.read_sql.html\"><tt class=\"docutils literal\">pandas.read_sql</tt></a>.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "<p>The result of running the query, formatted as a pandas DataFrame.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L125" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + } + ], + "properties": [ + { + "name": "driver", + "signature": "st.connections.driver.driver", + "description": "<p>The name of the driver used by the underlying SQLAlchemy Engine.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L270" + }, + { + "name": "engine", + "signature": "st.connections.engine.engine", + "description": "<p>The underlying SQLAlchemy Engine.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L262" + }, + { + "name": "session", + "signature": "st.connections.session.session", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn = st.connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n with conn.session as session:\n session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n session.commit()\n</pre>\n</blockquote>\n", + "description": "<p>Return a SQLAlchemy Session.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L278" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L49", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>A connection to a SQL database using a SQLAlchemy Engine. Initialize using <tt class=\"docutils literal\"><span class=\"pre\">st.connection("<name>",</span> <span class=\"pre\">type="sql")</span></tt>.</p>\n<p>SQLConnection provides the <tt class=\"docutils literal\">query()</tt> convenience method, which can be used to\nrun simple read-only queries with both caching and simple error handling/retries.\nMore complex DB interactions can be performed by using the <tt class=\"docutils literal\">.session</tt> property\nto receive a regular SQLAlchemy Session.</p>\n<p>SQLConnections should always be created using <tt class=\"docutils literal\">st.connection()</tt>, <strong>not</strong>\ninitialized directly. Connection parameters for a SQLConnection can be specified\nusing either <tt class=\"docutils literal\">st.secrets</tt> or <tt class=\"docutils literal\">**kwargs</tt>. Some frequently used parameters include:</p>\n<ul class=\"simple\">\n<li><strong>url</strong> or arguments for <a class=\"reference external\" href=\"https://docs.sqlalchemy.org/en/20/core/engines.html#sqlalchemy.engine.URL.create\">sqlalchemy.engine.URL.create()</a>.\nMost commonly it includes a dialect, host, database, username and password.</li>\n<li><strong>create_engine_kwargs</strong> can be passed via <tt class=\"docutils literal\">st.secrets</tt>, such as for\n<a class=\"reference external\" href=\"https://github.com/snowflakedb/snowflake-sqlalchemy#key-pair-authentication-support\">snowflake-sqlalchemy</a>\nor <a class=\"reference external\" href=\"https://github.com/googleapis/python-bigquery-sqlalchemy#authentication\">Google BigQuery</a>.\nThese can also be passed directly as <tt class=\"docutils literal\">**kwargs</tt> to connection().</li>\n<li><strong>autocommit=True</strong> to run with isolation level <tt class=\"docutils literal\">AUTOCOMMIT</tt>. Default is False.</li>\n</ul>\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SnowflakeConnection": { + "name": "SnowflakeConnection", + "signature": "st.connections.SnowflakeConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "cursor", + "signature": "st.connections.cursor.cursor()", + "description": "<p>Return a PEP 249-compliant cursor object.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L264" + }, + { + "name": "query", + "signature": "st.connections.query.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Run a read-only SQL query.</p>", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The read-only SQL query to execute.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.</p>\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>List of parameters to pass to the execute method. This connector supports\nbinding data to a SQL statement using qmark bindings. For more information\nand examples, see the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#using-qmark-or-numeric-binding\">Snowflake Python Connector documentation</a>.\nDefault is None.</p>\n", + "default": "None" + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "<p>The result of running the query, formatted as a pandas DataFrame.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L121" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + }, + { + "name": "session", + "signature": "st.connections.session.session()", + "description": "<p>Create a new Snowpark Session from this connection.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L281" + }, + { + "name": "write_pandas", + "signature": "st.connections.write_pandas.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "description": "<p>Call snowflake.connector.pandas_tools.write_pandas with this connection.</p>", + "args": [], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "<dl class=\"docutils\">\n<dt>A tuple containing three values:</dt>\n<dd><ol class=\"first last arabic simple\">\n<li>A bool that is True if the write was successful.</li>\n<li>An int giving the number of chunks of data that were copied.</li>\n<li>An int giving the number of rows that were inserted.</li>\n</ol>\n</dd>\n</dl>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L226" + } + ], + "properties": [ + { + "name": "raw_connection", + "signature": "st.connections.raw_connection.raw_connection", + "description": "<p>Access the underlying Snowflake Python connector object.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L272" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L42", + "description": "<p>A connection to Snowflake using the Snowflake Python Connector. Initialize using</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">st.connection("<name>",</span> <span class=\"pre\">type="snowflake")</span></tt>.</p>\n<p>SnowflakeConnection supports direct SQL querying using <tt class=\"docutils literal\"><span class=\"pre\">.query("...")</span></tt>, access to\nthe underlying Snowflake Python Connector object with <tt class=\"docutils literal\">.raw_connection</tt>, and other\nconvenience functions. See the methods below for more information.\nSnowflakeConnections should always be created using <tt class=\"docutils literal\">st.connection()</tt>, <strong>not</strong>\ninitialized directly.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SnowparkConnection": { + "name": "SnowparkConnection", + "signature": "st.connections.SnowparkConnection(connection_name, **kwargs)", + "is_class": true, + "methods": [ + { + "name": "query", + "signature": "st.connections.query.query(sql, ttl=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Run a read-only SQL query.</p>", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The read-only SQL query to execute.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "<p>The result of running the query, formatted as a pandas DataFrame.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L95" + }, + { + "name": "reset", + "signature": "st.connections.reset.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + }, + { + "name": "safe_session", + "signature": "st.connections.safe_session.safe_session()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("snowpark")\nwith conn.safe_session() as session:\n df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Grab the underlying Snowpark session in a thread-safe manner.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L188" + } + ], + "properties": [ + { + "name": "session", + "signature": "st.connections.session.session", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nsession = st.connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Access the underlying Snowpark session.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L165" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L47", + "description": "<p>A connection to Snowpark using snowflake.snowpark.session.Session. Initialize using</p>\n<p><tt class=\"docutils literal\"><span class=\"pre\">st.connection("<name>",</span> <span class=\"pre\">type="snowpark")</span></tt>.</p>\n<p>In addition to providing access to the Snowpark Session, SnowparkConnection supports\ndirect SQL querying using <tt class=\"docutils literal\"><span class=\"pre\">query("...")</span></tt> and thread safe access using\n<tt class=\"docutils literal\">with <span class=\"pre\">conn.safe_session():</span></tt>. See methods below for more information.\nSnowparkConnections should always be created using <tt class=\"docutils literal\">st.connection()</tt>, <strong>not</strong>\ninitialized directly.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">We don't expect this iteration of SnowparkConnection to be able to scale\nwell in apps with many concurrent users due to the lock contention that will occur\nover the single underlying Session object under high load.</p>\n</div>\n", + "args": [], + "returns": [] + }, + "streamlit.connections.SQLConnection.connect": { + "name": "connect", + "signature": "SQLConnection.connect()", + "description": "<p>Call <tt class=\"docutils literal\">.connect()</tt> on the underlying SQLAlchemy Engine, returning a new <tt class=\"docutils literal\">sqlalchemy.engine.Connection</tt> object.</p>\n<p>Calling this method is equivalent to calling <tt class=\"docutils literal\">self._instance.connect()</tt>.</p>\n<p>NOTE: This method should not be confused with the internal <tt class=\"docutils literal\">_connect</tt> method used\nto implement a Streamlit Connection.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L251" + }, + "streamlit.connections.SQLConnection.driver": { + "name": "driver", + "signature": "SQLConnection.driver", + "description": "<p>The name of the driver used by the underlying SQLAlchemy Engine.</p>\n<p>This is equivalent to accessing <tt class=\"docutils literal\">self._instance.driver</tt>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L270" + }, + "streamlit.connections.SQLConnection.engine": { + "name": "engine", + "signature": "SQLConnection.engine", + "description": "<p>The underlying SQLAlchemy Engine.</p>\n<p>This is equivalent to accessing <tt class=\"docutils literal\">self._instance</tt>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L262" + }, + "streamlit.connections.SQLConnection.query": { + "name": "query", + "signature": "SQLConnection.query(sql, *, show_spinner=\"Running `sql.query(...)`.\", ttl=None, index_col=None, chunksize=None, params=None, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("sql")\ndf = conn.query("select * from pet_owners where owner = :owner", ttl=3600, params={"owner":"barbara"})\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Run a read-only query.</p>\n<p>This method implements both query result caching (with caching behavior\nidentical to that of using <tt class=\"docutils literal\">@st.cache_data</tt>) as well as simple error handling/retries.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Queries that are run without a specified ttl are cached indefinitely.</p>\n</div>\n<p>Aside from the <tt class=\"docutils literal\">ttl</tt> kwarg, all kwargs passed to this function are passed down\nto <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.read_sql.html\"><tt class=\"docutils literal\">pandas.read_sql</tt></a>\nand have the behavior described in the pandas documentation.</p>\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The read-only SQL query to execute.</p>\n", + "default": null + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.</p>\n", + "default": "to" + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + }, + { + "name": "index_col", + "type_name": "str, list of str, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Column(s) to set as index(MultiIndex). Default is None.</p>\n", + "default": "None" + }, + { + "name": "chunksize", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>If specified, return an iterator where chunksize is the number of\nrows to include in each chunk. Default is None.</p>\n", + "default": "None" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>List of parameters to pass to the execute method. The syntax used to pass\nparameters is database driver dependent. Check your database driver\ndocumentation for which of the five syntax styles, described in <a class=\"reference external\" href=\"https://peps.python.org/pep-0249/#paramstyle\">PEP 249\nparamstyle</a>, is supported.\nDefault is None.</p>\n", + "default": "None" + }, + { + "name": "**kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Additional keyword arguments are passed to <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.read_sql.html\"><tt class=\"docutils literal\">pandas.read_sql</tt></a>.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "<p>The result of running the query, formatted as a pandas DataFrame.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L125" + }, + "streamlit.connections.SQLConnection.reset": { + "name": "reset", + "signature": "SQLConnection.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>\n<p>This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use <tt class=\"docutils literal\">reset()</tt>\nin their error handling code.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + }, + "streamlit.connections.SQLConnection.session": { + "name": "session", + "signature": "SQLConnection.session", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nconn = st.connection("sql")\nn = st.slider("Pick a number")\nif st.button("Add the number!"):\n with conn.session as session:\n session.execute("INSERT INTO numbers (val) VALUES (:n);", {"n": n})\n session.commit()\n</pre>\n</blockquote>\n", + "description": "<p>Return a SQLAlchemy Session.</p>\n<p>Users of this connection should use the contextmanager pattern for writes,\ntransactions, and anything more complex than simple read queries.</p>\n<p>See the usage example below, which assumes we have a table <tt class=\"docutils literal\">numbers</tt> with a\nsingle integer column <tt class=\"docutils literal\">val</tt>. The <a class=\"reference external\" href=\"https://docs.sqlalchemy.org/en/20/orm/session_basics.html\">SQLAlchemy</a> docs also contain\nmuch more information on the usage of sessions.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/sql_connection.py#L278" + }, + "streamlit.connections.SnowparkConnection.query": { + "name": "query", + "signature": "SnowparkConnection.query(sql, ttl=None)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("snowpark")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Run a read-only SQL query.</p>\n<p>This method implements both query result caching (with caching behavior\nidentical to that of using <tt class=\"docutils literal\">@st.cache_data</tt>) as well as simple error handling/retries.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Queries that are run without a specified ttl are cached indefinitely.</p>\n</div>\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The read-only SQL query to execute.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "<p>The result of running the query, formatted as a pandas DataFrame.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L95" + }, + "streamlit.connections.SnowparkConnection.reset": { + "name": "reset", + "signature": "SnowparkConnection.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>\n<p>This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use <tt class=\"docutils literal\">reset()</tt>\nin their error handling code.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + }, + "streamlit.connections.SnowparkConnection.safe_session": { + "name": "safe_session", + "signature": "SnowparkConnection.safe_session()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("snowpark")\nwith conn.safe_session() as session:\n df = session.table("mytable").limit(10).to_pandas()\n\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Grab the underlying Snowpark session in a thread-safe manner.</p>\n<p>As operations on a Snowpark session are not thread safe, we need to take care\nwhen using a session in the context of a Streamlit app where each script run\noccurs in its own thread. Using the contextmanager pattern to do this ensures\nthat access on this connection's underlying Session is done in a thread-safe\nmanner.</p>\n<p>Information on how to use Snowpark sessions can be found in the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/snowpark/python/working-with-dataframes\">Snowpark documentation</a>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L188" + }, + "streamlit.connections.SnowparkConnection.session": { + "name": "session", + "signature": "SnowparkConnection.session", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nsession = st.connection("snowpark").session\ndf = session.table("mytable").limit(10).to_pandas()\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Access the underlying Snowpark session.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Snowpark sessions are <strong>not</strong> thread safe. Users of this method are\nresponsible for ensuring that access to the session returned by this method is\ndone in a thread-safe manner. For most users, we recommend using the thread-safe\nsafe_session() method and a <tt class=\"docutils literal\">with</tt> block.</p>\n</div>\n<p>Information on how to use Snowpark sessions can be found in the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/snowpark/python/working-with-dataframes\">Snowpark documentation</a>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowpark_connection.py#L165" + }, + "streamlit.connections.SnowflakeConnection.cursor": { + "name": "cursor", + "signature": "SnowflakeConnection.cursor()", + "description": "<p>Return a PEP 249-compliant cursor object.</p>\n<p>For more information, see the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#object-cursor\">Snowflake Python Connector documentation</a>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L264" + }, + "streamlit.connections.SnowflakeConnection.query": { + "name": "query", + "signature": "SnowflakeConnection.query(sql, *, ttl=None, show_spinner=\"Running `snowflake.query(...)`.\", params=None, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("snowflake")\ndf = conn.query("select * from pet_owners")\nst.dataframe(df)\n</pre>\n</blockquote>\n", + "description": "<p>Run a read-only SQL query.</p>\n<p>This method implements both query result caching (with caching behavior\nidentical to that of using <tt class=\"docutils literal\">@st.cache_data</tt>) as well as simple error handling/retries.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\">Queries that are run without a specified ttl are cached indefinitely.</p>\n</div>\n", + "args": [ + { + "name": "sql", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The read-only SQL query to execute.</p>\n", + "default": null + }, + { + "name": "ttl", + "type_name": "float, int, timedelta or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to keep results in the cache, or\nNone if cached results should not expire. The default is None.</p>\n", + "default": "None" + }, + { + "name": "show_spinner", + "type_name": "boolean or string", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Enable the spinner. The default is to show a spinner when there is a\n"cache miss" and the cached resource is being created. If a string, the value\nof the show_spinner param will be used for the spinner text.</p>\n", + "default": "to" + }, + { + "name": "params", + "type_name": "list, tuple, dict or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>List of parameters to pass to the execute method. This connector supports\nbinding data to a SQL statement using qmark bindings. For more information\nand examples, see the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example#using-qmark-or-numeric-binding\">Snowflake Python Connector documentation</a>.\nDefault is None.</p>\n", + "default": "None" + } + ], + "returns": [ + { + "type_name": "pandas.DataFrame", + "is_generator": false, + "description": "<p>The result of running the query, formatted as a pandas DataFrame.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L121" + }, + "streamlit.connections.SnowflakeConnection.raw_connection": { + "name": "raw_connection", + "signature": "SnowflakeConnection.raw_connection", + "description": "<p>Access the underlying Snowflake Python connector object.</p>\n<p>Information on how to use the Snowflake Python Connector can be found in the\n<a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-example\">Snowflake Python Connector documentation</a>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L272" + }, + "streamlit.connections.SnowflakeConnection.reset": { + "name": "reset", + "signature": "SnowflakeConnection.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>\n<p>This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use <tt class=\"docutils literal\">reset()</tt>\nin their error handling code.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + }, + "streamlit.connections.SnowflakeConnection.session": { + "name": "session", + "signature": "SnowflakeConnection.session()", + "description": "<p>Create a new Snowpark Session from this connection.</p>\n<p>Information on how to use Snowpark sessions can be found in the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/snowpark/python/working-with-dataframes\">Snowpark documentation</a>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L281" + }, + "streamlit.connections.SnowflakeConnection.write_pandas": { + "name": "write_pandas", + "signature": "SnowflakeConnection.write_pandas(df, table_name, database=None, schema=None, chunk_size=None, **kwargs)", + "description": "<p>Call snowflake.connector.pandas_tools.write_pandas with this connection.</p>\n<p>This convenience method is simply a thin wrapper around the <tt class=\"docutils literal\">write_pandas</tt>\nfunction of the same name from <tt class=\"docutils literal\">snowflake.connector.pandas_tools</tt>. For more\ninformation, see the <a class=\"reference external\" href=\"https://docs.snowflake.com/en/developer-guide/python-connector/python-connector-api#write_pandas\">Snowflake Python Connector documentation</a>.</p>\n", + "args": [], + "returns": [ + { + "type_name": "tuple[bool, int, int]", + "is_generator": false, + "description": "<dl class=\"docutils\">\n<dt>A tuple containing three values:</dt>\n<dd><ol class=\"first last arabic simple\">\n<li>A bool that is True if the write was successful.</li>\n<li>An int giving the number of chunks of data that were copied.</li>\n<li>An int giving the number of rows that were inserted.</li>\n</ol>\n</dd>\n</dl>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/snowflake_connection.py#L226" + }, + "streamlit.connections.BaseConnection.reset": { + "name": "reset", + "signature": "BaseConnection.reset()", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\n\nconn = st.connection("my_conn")\n\n# Reset the connection before using it if it isn't healthy\n# Note: is_healthy() isn't a real method and is just shown for example here.\nif not conn.is_healthy():\n conn.reset()\n\n# Do stuff with conn...\n</pre>\n</blockquote>\n", + "description": "<p>Reset this connection so that it gets reinitialized the next time it's used.</p>\n<p>This method can be useful when a connection has become stale, an auth token has\nexpired, or in similar scenarios where a broken connection might be fixed by\nreinitializing it. Note that some connection methods may already use <tt class=\"docutils literal\">reset()</tt>\nin their error handling code.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/connections/base_connection.py#L149" + }, + "streamlit.column_config.AreaChartColumn": { + "name": "AreaChartColumn", + "signature": "st.column_config.AreaChartColumn(label=None, *, width=None, help=None, y_min=None, y_max=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.AreaChartColumn(\n "Sales (last 6 months)",\n width="medium",\n help="The sales volume in the last 6 months",\n y_min=0,\n y_max=100,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-areachart-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure an area chart column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>Cells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the <tt class=\"docutils literal\">column_config</tt> parameter\nof <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum value on the y-axis for all cells in the column.\nIf None (default), every cell will use the minimum of its data.</p>\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum value on the y-axis for all cells in the column. If None (default),\nevery cell will use the maximum of its data.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L948" + }, + "streamlit.column_config.BarChartColumn": { + "name": "BarChartColumn", + "signature": "st.column_config.BarChartColumn(label=None, *, width=None, help=None, y_min=None, y_max=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.BarChartColumn(\n "Sales (last 6 months)",\n help="The sales volume in the last 6 months",\n y_min=0,\n y_max=100,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-barchart-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a bar chart column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>Cells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the <tt class=\"docutils literal\">column_config</tt> parameter\nof <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum value on the y-axis for all cells in the column.\nIf None (default), every cell will use the minimum of its data.</p>\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum value on the y-axis for all cells in the column. If None (default),\nevery cell will use the maximum of its data.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L787" + }, + "streamlit.column_config.CheckboxColumn": { + "name": "CheckboxColumn", + "signature": "st.column_config.CheckboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],\n "favorite": [True, False, False, True],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "favorite": st.column_config.CheckboxColumn(\n "Your favorite?",\n help="Select your **favorite** widgets",\n default=False,\n )\n },\n disabled=["widgets"],\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-checkbox-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a checkbox column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for boolean values. This command needs to be used in\nthe <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.\nWhen used with <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled with a checkbox widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L606" + }, + "streamlit.column_config.Column": { + "name": "Column", + "signature": "st.column_config.Column(label=None, *, width=None, help=None, disabled=None, required=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "widgets": st.column_config.Column(\n "Streamlit Widgets",\n help="Streamlit **widget** commands \ud83c\udf88",\n width="medium",\n required=True,\n )\n },\n hide_index=True,\n num_rows="dynamic",\n)\n</pre>\n<Cloud name=\"doc-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a generic column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>The type of the column will be automatically inferred from the data type.\nThis command needs to be used in the <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt>\nor <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>To change the type of the column and enable type-specific configuration options,\nuse one of the column types in the <tt class=\"docutils literal\">st.column_config</tt> namespace,\ne.g. <tt class=\"docutils literal\">st.column_config.NumberColumn</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L196" + }, + "streamlit.column_config.DateColumn": { + "name": "DateColumn", + "signature": "st.column_config.DateColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nfrom datetime import date\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "birthday": [\n date(1980, 1, 1),\n date(1990, 5, 3),\n date(1974, 5, 19),\n date(2001, 8, 17),\n ]\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "birthday": st.column_config.DateColumn(\n "Birthday",\n min_value=date(1900, 1, 1),\n max_value=date(2005, 1, 1),\n format="DD.MM.YYYY",\n step=1,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-date-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a date column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for date values. This command needs to be used in\nthe <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>. When used\nwith <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled with a date picker widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A momentJS format string controlling how times are displayed. See\n<a class=\"reference external\" href=\"https://momentjs.com/docs/#/displaying/format/\">momentJS docs</a> for available\nformats. If None (default), uses <tt class=\"docutils literal\"><span class=\"pre\">YYYY-MM-DD</span></tt>.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum date that can be entered.\nIf None (default), there will be no minimum.</p>\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.date or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum date that can be entered.\nIf None (default), there will be no maximum.</p>\n", + "default": null + }, + { + "name": "step", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The stepping interval in days. If None (default), the step will be 1 day.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L1400" + }, + "streamlit.column_config.DatetimeColumn": { + "name": "DatetimeColumn", + "signature": "st.column_config.DatetimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, format=None, min_value=None, max_value=None, step=None, timezone=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nfrom datetime import datetime\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "appointment": [\n datetime(2024, 2, 5, 12, 30),\n datetime(2023, 11, 10, 18, 0),\n datetime(2024, 3, 11, 20, 10),\n datetime(2023, 9, 12, 3, 0),\n ]\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "appointment": st.column_config.DatetimeColumn(\n "Appointment",\n min_value=datetime(2023, 6, 1),\n max_value=datetime(2025, 1, 1),\n format="D MMM YYYY, h:mm a",\n step=60,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-datetime-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a datetime column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for datetime values. This command needs to be\nused in the <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or\n<tt class=\"docutils literal\">st.data_editor</tt>. When used with <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled\nwith a datetime picker widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A momentJS format string controlling how datetimes are displayed. See\n<a class=\"reference external\" href=\"https://momentjs.com/docs/#/displaying/format/\">momentJS docs</a> for available\nformats. If None (default), uses <tt class=\"docutils literal\"><span class=\"pre\">YYYY-MM-DD</span> HH:mm:ss</tt>.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum datetime that can be entered.\nIf None (default), there will be no minimum.</p>\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.datetime or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum datetime that can be entered.\nIf None (default), there will be no maximum.</p>\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, datetime.timedelta, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The stepping interval in seconds. If None (default), the step will be 1 second.</p>\n", + "default": null + }, + { + "name": "timezone", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The timezone of this column. If None (default),\nthe timezone is inferred from the underlying data.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L1165" + }, + "streamlit.column_config.ImageColumn": { + "name": "ImageColumn", + "signature": "st.column_config.ImageColumn(label=None, *, width=None, help=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "apps": [\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/5435b8cb-6c6c-490b-9608-799b543655d3/Home_Page.png",\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/ef9a7627-13f2-47e5-8f65-3f69bb38a5c2/Home_Page.png",\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/31b99099-8eae-4ff8-aa89-042895ed3843/Home_Page.png",\n "https://storage.googleapis.com/s4a-prod-share-preview/default/st_app_screenshot_image/6a399b09-241e-4ae7-a31f-7640dc1d181e/Home_Page.png",\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "apps": st.column_config.ImageColumn(\n "Preview Image", help="Streamlit app preview screenshots"\n )\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-image-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure an image column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>The cell values need to be one of:</p>\n<ul class=\"simple\">\n<li>A URL to fetch the image from. This can also be a relative URL of an image\ndeployed via <a class=\"reference external\" href=\"https://docs.streamlit.io/develop/concepts/configuration/serving-static-files\">static file serving</a>.\nNote that you can NOT use an arbitrary local image if it is not available through\na public URL.</li>\n<li>A data URL containing an SVG XML like <tt class=\"docutils literal\"><span class=\"pre\">data:image/svg+xml;utf8,<svg</span> <span class=\"pre\">xmlns=...</svg></span></tt>.</li>\n<li>A data URL containing a Base64 encoded image like <tt class=\"docutils literal\"><span class=\"pre\">data:image/png;base64,iVBO...</span></tt>.</li>\n</ul>\n<p>Image columns are not editable at the moment. This command needs to be used in the\n<tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L1029" + }, + "streamlit.column_config.LineChartColumn": { + "name": "LineChartColumn", + "signature": "st.column_config.LineChartColumn(label=None, *, width=None, help=None, y_min=None, y_max=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.LineChartColumn(\n "Sales (last 6 months)",\n width="medium",\n help="The sales volume in the last 6 months",\n y_min=0,\n y_max=100,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-linechart-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a line chart column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>Cells need to contain a list of numbers. Chart columns are not editable\nat the moment. This command needs to be used in the <tt class=\"docutils literal\">column_config</tt> parameter\nof <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "y_min", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum value on the y-axis for all cells in the column.\nIf None (default), every cell will use the minimum of its data.</p>\n", + "default": null + }, + { + "name": "y_max", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum value on the y-axis for all cells in the column. If None (default),\nevery cell will use the maximum of its data.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L867" + }, + "streamlit.column_config.LinkColumn": { + "name": "LinkColumn", + "signature": "st.column_config.LinkColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, max_chars=None, validate=None, display_text=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "apps": [\n "https://roadmap.streamlit.app",\n "https://extras.streamlit.app",\n "https://issues.streamlit.app",\n "https://30days.streamlit.app",\n ],\n "creator": [\n "https://github.com/streamlit",\n "https://github.com/arnaudmiribel",\n "https://github.com/streamlit",\n "https://github.com/streamlit",\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "apps": st.column_config.LinkColumn(\n "Trending apps",\n help="The top trending Streamlit apps",\n validate="^https://[a-z]+\\.streamlit\\.app$",\n max_chars=100,\n display_text="https://(.*?)\\.streamlit\\.app"\n ),\n "creator": st.column_config.LinkColumn(\n "App Creator", display_text="Open profile"\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-link-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a link column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>The cell values need to be string and will be shown as clickable links.\nThis command needs to be used in the column_config parameter of <tt class=\"docutils literal\">st.dataframe</tt>\nor <tt class=\"docutils literal\">st.data_editor</tt>. When used with <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled\nwith a text input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of characters that can be entered. If None (default),\nthere will be no maximum.</p>\n", + "default": null + }, + { + "name": "validate", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A regular expression (JS flavor, e.g. <tt class=\"docutils literal\"><span class=\"pre\">"^https://.+$"</span></tt>) that edited values are validated against.\nIf the input is invalid, it will not be submitted.</p>\n", + "default": null + }, + { + "name": "display_text", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The text that is displayed in the cell. Can be one of:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> (default) to display the URL itself.</li>\n<li>A string that is displayed in every cell, e.g. <tt class=\"docutils literal\">"Open link"</tt>.</li>\n<li>A regular expression (JS flavor, detected by usage of parentheses)\nto extract a part of the URL via a capture group, e.g. <tt class=\"docutils literal\"><span class=\"pre\">"https://(.*?)\\.example\\.com"</span></tt>\nto extract the display text "foo" from the URL "https://foo.example.com".</li>\n</ul>\n<!-- Comment: The backslash in front of foo.example.com prevents a hyperlink. -->\n<p>For more complex cases, you may use <a class=\"reference external\" href=\"https://pandas.pydata.org/docs/reference/api/pandas.io.formats.style.Styler.format.html\">Pandas Styler's format</a>\nfunction on the underlying dataframe. Note that this makes the app slow,\ndoesn't work with editable columns, and might be removed in the future.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L475" + }, + "streamlit.column_config.ListColumn": { + "name": "ListColumn", + "signature": "st.column_config.ListColumn(label=None, *, width=None, help=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [\n [0, 4, 26, 80, 100, 40],\n [80, 20, 80, 35, 40, 100],\n [10, 20, 80, 80, 70, 0],\n [10, 100, 20, 100, 30, 100],\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.ListColumn(\n "Sales (last 6 months)",\n help="The sales volume in the last 6 months",\n width="medium",\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-list-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a list column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for list-like values. List columns are not editable\nat the moment. This command needs to be used in the <tt class=\"docutils literal\">column_config</tt> parameter of\n<tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L1100" + }, + "streamlit.column_config.NumberColumn": { + "name": "NumberColumn", + "signature": "st.column_config.NumberColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "price": [20, 950, 250, 500],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "price": st.column_config.NumberColumn(\n "Price (in USD)",\n help="The price of the product in USD",\n min_value=0,\n max_value=1000,\n step=1,\n format="$%d",\n )\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-number-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a number column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for integer and float values. This command needs to\nbe used in the <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.\nWhen used with <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled with a numeric input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A printf-style format string controlling how numbers are displayed.\nThis does not impact the return value. Valid formatters: %d %e %f %g %i %u.\nYou can also add prefixes and suffixes, e.g. <tt class=\"docutils literal\">"$ %.2f"</tt> to show a dollar prefix.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum value that can be entered.\nIf None (default), there will be no minimum.</p>\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum value that can be entered.\nIf None (default), there will be no maximum.</p>\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The stepping interval. Specifies the precision of numbers that can be entered.\nIf None (default), uses 1 for integers and unrestricted precision for floats.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L271" + }, + "streamlit.column_config.ProgressColumn": { + "name": "ProgressColumn", + "signature": "st.column_config.ProgressColumn(label=None, *, width=None, help=None, format=None, min_value=None, max_value=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "sales": [200, 550, 1000, 80],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "sales": st.column_config.ProgressColumn(\n "Sales volume",\n help="The sales volume in USD",\n format="$%f",\n min_value=0,\n max_value=1000,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-progress-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a progress column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>Cells need to contain a number. Progress columns are not editable at the moment.\nThis command needs to be used in the <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt>\nor <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A printf-style format string controlling how numbers are displayed.\nValid formatters: %d %e %f %g %i %u. You can also add prefixes and suffixes,\ne.g. <tt class=\"docutils literal\">"$ %.2f"</tt> to show a dollar prefix.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum value of the progress bar.\nIf None (default), will be 0.</p>\n", + "default": null + }, + { + "name": "max_value", + "type_name": "int, float, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum value of the progress bar. If None (default), will be 100 for\ninteger values and 1 for float values.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L1513" + }, + "streamlit.column_config.SelectboxColumn": { + "name": "SelectboxColumn", + "signature": "st.column_config.SelectboxColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, options=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "category": [\n "\ud83d\udcca Data Exploration",\n "\ud83d\udcc8 Data Visualization",\n "\ud83e\udd16 LLM",\n "\ud83d\udcca Data Exploration",\n ],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "category": st.column_config.SelectboxColumn(\n "App Category",\n help="The category of the app",\n width="medium",\n options=[\n "\ud83d\udcca Data Exploration",\n "\ud83d\udcc8 Data Visualization",\n "\ud83e\udd16 LLM",\n ],\n required=True,\n )\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-selectbox-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a selectbox column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for Pandas categorical values. This command needs to\nbe used in the <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.\nWhen used with <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled with a selectbox widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "str, int, float, bool, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "options", + "type_name": "Iterable of str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The options that can be selected during editing. If None (default), this will be\ninferred from the underlying dataframe column if its dtype is "category"\n(<a class=\"reference external\" href=\"https://pandas.pydata.org/docs/user_guide/categorical.html\">see Pandas docs on categorical data</a>).</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L688" + }, + "streamlit.column_config.TextColumn": { + "name": "TextColumn", + "signature": "st.column_config.TextColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, max_chars=None, validate=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "widgets": ["st.selectbox", "st.number_input", "st.text_area", "st.button"],\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "widgets": st.column_config.TextColumn(\n "Widgets",\n help="Streamlit **widget** commands \ud83c\udf88",\n default="st.",\n max_chars=50,\n validate="^st\\.[a-z_]+$",\n )\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-text-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a text column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for string values. This command needs to be used in the\n<tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>. When used with\n<tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled with a text input widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "max_chars", + "type_name": "int or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of characters that can be entered. If None (default),\nthere will be no maximum.</p>\n", + "default": null + }, + { + "name": "validate", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A regular expression (JS flavor, e.g. <tt class=\"docutils literal\"><span class=\"pre\">"^[a-z]+$"</span></tt>) that edited values are validated against.\nIf the input is invalid, it will not be submitted.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L381" + }, + "streamlit.column_config.TimeColumn": { + "name": "TimeColumn", + "signature": "st.column_config.TimeColumn(label=None, *, width=None, help=None, disabled=None, required=None, default=None, format=None, min_value=None, max_value=None, step=None)", + "examples": "<blockquote>\n<pre class=\"doctest-block\">\nfrom datetime import time\nimport pandas as pd\nimport streamlit as st\n\ndata_df = pd.DataFrame(\n {\n "appointment": [\n time(12, 30),\n time(18, 0),\n time(9, 10),\n time(16, 25),\n ]\n }\n)\n\nst.data_editor(\n data_df,\n column_config={\n "appointment": st.column_config.TimeColumn(\n "Appointment",\n min_value=time(8, 0, 0),\n max_value=time(19, 0, 0),\n format="hh:mm a",\n step=60,\n ),\n },\n hide_index=True,\n)\n</pre>\n<Cloud name=\"doc-time-column\" path=\"\" query=\"\" stylePlaceholder=\"height: 300px\" /></blockquote>\n", + "description": "<p>Configure a time column in <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>.</p>\n<p>This is the default column type for time values. This command needs to be used in\nthe <tt class=\"docutils literal\">column_config</tt> parameter of <tt class=\"docutils literal\">st.dataframe</tt> or <tt class=\"docutils literal\">st.data_editor</tt>. When\nused with <tt class=\"docutils literal\">st.data_editor</tt>, editing will be enabled with a time picker widget.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The label shown at the top of the column. If None (default),\nthe column name is used.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "\"small\", \"medium\", \"large\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The display width of the column. Can be one of "small", "medium", or "large".\nIf None (default), the column will be sized to fit the cell contents.</p>\n", + "default": null + }, + { + "name": "help", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tooltip that gets displayed when hovering over the column label.</p>\n", + "default": null + }, + { + "name": "disabled", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether editing should be disabled for this column. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "required", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Whether edited cells in the column need to have a value. If True, an edited cell\ncan only be submitted if it has a value other than None. Defaults to False.</p>\n", + "default": "False" + }, + { + "name": "default", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Specifies the default value in this column when a new row is added by the user.</p>\n", + "default": "value" + }, + { + "name": "format", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A momentJS format string controlling how times are displayed. See\n<a class=\"reference external\" href=\"https://momentjs.com/docs/#/displaying/format/\">momentJS docs</a> for available\nformats. If None (default), uses <tt class=\"docutils literal\">HH:mm:ss</tt>.</p>\n", + "default": null + }, + { + "name": "min_value", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The minimum time that can be entered.\nIf None (default), there will be no minimum.</p>\n", + "default": null + }, + { + "name": "max_value", + "type_name": "datetime.time or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum time that can be entered.\nIf None (default), there will be no maximum.</p>\n", + "default": null + }, + { + "name": "step", + "type_name": "int, float, datetime.timedelta, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The stepping interval in seconds. If None (default), the step will be 1 second.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/column_types.py#L1286" + }, + "streamlit.components.v1.declare_component": { + "name": "declare_component", + "signature": "st.components.v1.declare_component(name, path=None, url=None)", + "description": "<p>Create a custom component and register it if there is a <tt class=\"docutils literal\">ScriptRunContext</tt>.</p>\n<p>The component is not registered when there is no <tt class=\"docutils literal\">ScriptRunContext</tt>.\nThis can happen when a <tt class=\"docutils literal\">CustomComponent</tt> is executed as standalone\ncommand (e.g. for testing).</p>\n<p>To use this function, import it from the <tt class=\"docutils literal\">streamlit.components.v1</tt>\nmodule.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Using <tt class=\"docutils literal\">st.components.v1.declare_component</tt> directly (instead of\nimporting its module) is deprecated and will be disallowd in a later\nversion.</p>\n</div>\n", + "args": [ + { + "name": "name", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A short, descriptive name for the component, like "slider".</p>\n", + "default": null + }, + { + "name": "path", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The path to serve the component's frontend files from. If <tt class=\"docutils literal\">path</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit will server the component from the\nlocation in <tt class=\"docutils literal\">url</tt>. Either <tt class=\"docutils literal\">path</tt> or <tt class=\"docutils literal\">url</tt> must be specified, but\nnot both.</p>\n", + "default": null + }, + { + "name": "url", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The URL that the component is served from. If <tt class=\"docutils literal\">url</tt> is <tt class=\"docutils literal\">None</tt>\n(default), Streamlit will server the component from the location in\n<tt class=\"docutils literal\">path</tt>. Either <tt class=\"docutils literal\">path</tt> or <tt class=\"docutils literal\">url</tt> must be specified, but not both.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "CustomComponent", + "is_generator": false, + "description": "<p>A <tt class=\"docutils literal\">CustomComponent</tt> that can be called like a function.\nCalling the component will create a new instance of the component\nin the Streamlit app.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/components/v1/component_registry.py#L50" + }, + "streamlit.components.v1.html": { + "name": "html", + "signature": "st.components.v1.html(html, width=None, height=None, scrolling=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit.components.v1 as components\n\ncomponents.html(\n "<p><span style='text-decoration: line-through double red;'>Oops</span>!</p>"\n)\n</pre>\n</blockquote>\n", + "description": "<p>Display an HTML string in an iframe.</p>\n<p>To use this function, import it from the <tt class=\"docutils literal\">streamlit.components.v1</tt>\nmodule.</p>\n<p>If you want to insert HTML text into your app without an iframe, try\n<tt class=\"docutils literal\">st.html</tt> instead.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Using <tt class=\"docutils literal\">st.components.v1.html</tt> directly (instead of importing\nits module) is deprecated and will be disallowd in a later version.</p>\n</div>\n", + "args": [ + { + "name": "html", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The HTML string to embed in the iframe.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The width of the iframe in CSS pixels. By default, this is the\napp's default element width.</p>\n", + "default": "element" + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The height of the frame in CSS pixels. By default, this is <tt class=\"docutils literal\">150</tt>.</p>\n", + "default": null + }, + { + "name": "scrolling", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to allow scrolling in the iframe. If this <tt class=\"docutils literal\">False</tt>\n(default), Streamlit crops any content larger than the iframe and\ndoes not show a scrollbar. If this is <tt class=\"docutils literal\">True</tt>, Streamlit shows a\nscrollbar when the content is larger than the iframe.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/iframe.py#L80" + }, + "streamlit.components.v1.iframe": { + "name": "iframe", + "signature": "st.components.v1.iframe(src, width=None, height=None, scrolling=False)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit.components.v1 as components\n\ncomponents.iframe("https://example.com", height=500)\n</pre>\n</blockquote>\n", + "description": "<p>Load a remote URL in an iframe.</p>\n<p>To use this function, import it from the <tt class=\"docutils literal\">streamlit.components.v1</tt>\nmodule.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">Using <tt class=\"docutils literal\">st.components.v1.iframe</tt> directly (instead of importing\nits module) is deprecated and will be disallowd in a later version.</p>\n</div>\n", + "args": [ + { + "name": "src", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The URL of the page to embed.</p>\n", + "default": null + }, + { + "name": "width", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The width of the iframe in CSS pixels. By default, this is the\napp's default element width.</p>\n", + "default": "element" + }, + { + "name": "height", + "type_name": "int", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The height of the frame in CSS pixels. By default, this is <tt class=\"docutils literal\">150</tt>.</p>\n", + "default": null + }, + { + "name": "scrolling", + "type_name": "bool", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Whether to allow scrolling in the iframe. If this <tt class=\"docutils literal\">False</tt>\n(default), Streamlit crops any content larger than the iframe and\ndoes not show a scrollbar. If this is <tt class=\"docutils literal\">True</tt>, Streamlit shows a\nscrollbar when the content is larger than the iframe.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/iframe.py#L27" + }, + "DeltaGenerator.add_rows": { + "name": "add_rows", + "signature": "element.add_rows(data=None, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\ndf1 = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))\n\nmy_table = st.table(df1)\n\ndf2 = pd.DataFrame(np.random.randn(50, 20), columns=("col %d" % i for i in range(20)))\n\nmy_table.add_rows(df2)\n# Now the table shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n</pre>\n<p>You can do the same thing with plots. For example, if you want to add\nmore data to a line chart:</p>\n<pre class=\"doctest-block\">\n# Assuming df1 and df2 from the example above still exist...\nmy_chart = st.line_chart(df1)\nmy_chart.add_rows(df2)\n# Now the chart shown in the Streamlit app contains the data for\n# df1 followed by the data for df2.\n</pre>\n<p>And for plots whose datasets are named, you can pass the data with a\nkeyword argument where the key is the name:</p>\n<pre class=\"doctest-block\">\nmy_chart = st.vega_lite_chart({\n 'mark': 'line',\n 'encoding': {'x': 'a', 'y': 'b'},\n 'datasets': {\n 'some_fancy_name': df1, # <-- named dataset\n },\n 'data': {'name': 'some_fancy_name'},\n}),\nmy_chart.add_rows(some_fancy_name=df2) # <-- name used as keyword\n</pre>\n</blockquote>\n", + "description": "<p>Concatenate a dataframe to the bottom of the current one.</p>\n", + "args": [ + { + "name": "data", + "type_name": "pandas.DataFrame, pandas.Styler, pyarrow.Table, numpy.ndarray, pyspark.sql.DataFrame, snowflake.snowpark.dataframe.DataFrame, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Table to concat. Optional.</p>\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "pandas.DataFrame, numpy.ndarray, Iterable, dict, or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The named dataset to concat. Optional. You can only pass in 1\ndataset (including the one in the data parameter).</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/arrow.py#L631" + }, + "StatusContainer.update": { + "name": "update", + "signature": "StatusContainer.update(*, label=None, expanded=None, state=None)", + "description": "<p>Update the status container.</p>\n<p>Only specified arguments are updated. Container contents and unspecified\narguments remain unchanged.</p>\n", + "args": [ + { + "name": "label", + "type_name": "str or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>A new label of the status container. If None, the label is not\nchanged.</p>\n", + "default": null + }, + { + "name": "expanded", + "type_name": "bool or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The new expanded state of the status container. If None,\nthe expanded state is not changed.</p>\n", + "default": null + }, + { + "name": "state", + "type_name": "\"running\", \"complete\", \"error\", or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The new state of the status container. This mainly changes the\nicon. If None, the state is not changed.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/lib/mutable_status_container.py#L98" + }, + "streamlit.testing.v1.AppTest": { + "name": "AppTest", + "signature": "st.testing.v1.AppTest(script_path, *, default_timeout, args=None, kwargs=None)", + "is_class": true, + "methods": [ + { + "name": "get", + "signature": "st.testing.v1.get.get(element_type)", + "description": "<p>Get elements or widgets of the specified type.</p>", + "args": [ + { + "name": "element_type", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An element attribute of <tt class=\"docutils literal\">AppTest</tt>. For example, "button",\n"caption", or "chat_input".</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of Elements", + "is_generator": false, + "description": "<p>Sequence of elements of the given type. Individual elements can\nbe accessed from a Sequence by index (order on the page). When\ngetting and <tt class=\"docutils literal\">element_type</tt> that is a widget, individual widgets\ncan be accessed by key. For example, <tt class=\"docutils literal\"><span class=\"pre\">at.get("text")[0]</span></tt> for the\nfirst <tt class=\"docutils literal\">st.text</tt> element or <tt class=\"docutils literal\"><span class=\"pre\">at.get("slider")(key="my_key")</span></tt> for\nthe <tt class=\"docutils literal\">st.slider</tt> widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L1009" + }, + { + "name": "run", + "signature": "st.testing.v1.run.run(*, timeout=None)", + "description": "<p>Run the script from the current state.</p>", + "args": [ + { + "name": "timeout", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. If <tt class=\"docutils literal\">timeout</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit uses the default timeout set for the\ninstance of <tt class=\"docutils literal\">AppTest</tt>.</p>\n", + "default": "timeout" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>self</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L367" + }, + { + "name": "switch_page", + "signature": "st.testing.v1.switch_page.switch_page(page_path)", + "description": "<p>Switch to another page of the app.</p>", + "args": [ + { + "name": "page_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Path of the page to switch to. The path must be relative to the\nmain script's location (e.g. <tt class=\"docutils literal\">"pages/my_page.py"</tt>).</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>self</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L390" + } + ], + "properties": [ + { + "name": "button", + "signature": "st.testing.v1.button.button", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.button</tt> and <tt class=\"docutils literal\">st.form_submit_button</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Button", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.button</tt> and <tt class=\"docutils literal\">st.form_submit_button</tt>\nwidgets. Individual widgets can be accessed from a WidgetList by\nindex (order on the page) or key. For example, <tt class=\"docutils literal\">at.button[0]</tt> for\nthe first widget or <tt class=\"docutils literal\"><span class=\"pre\">at.button(key="my_key")</span></tt> for a widget with a\ngiven key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L444" + }, + { + "name": "caption", + "signature": "st.testing.v1.caption.caption", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.caption</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Caption", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.caption</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.caption[0]</tt> for the first element. Caption is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L459" + }, + { + "name": "chat_input", + "signature": "st.testing.v1.chat_input.chat_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_input</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ChatInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.chat_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.chat_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L473" + }, + { + "name": "chat_message", + "signature": "st.testing.v1.chat_message.chat_message", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_message</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "Sequence of ChatMessage", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_message</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.chat_message[0]</tt> for the first element. ChatMessage\nis an extension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L487" + }, + { + "name": "checkbox", + "signature": "st.testing.v1.checkbox.checkbox", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.checkbox</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Checkbox", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.checkbox</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.checkbox[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.checkbox(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L501" + }, + { + "name": "code", + "signature": "st.testing.v1.code.code", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.code</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Code", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.code</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.code[0]</tt> for the first element. Code is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L515" + }, + { + "name": "color_picker", + "signature": "st.testing.v1.color_picker.color_picker", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.color_picker</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ColorPicker", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.color_picker</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.color_picker[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.color_picker(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L529" + }, + { + "name": "columns", + "signature": "st.testing.v1.columns.columns", + "description": "<p>Sequence of all columns within <tt class=\"docutils literal\">st.columns</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "Sequence of Column", + "is_generator": false, + "description": "<p>Sequence of all columns within <tt class=\"docutils literal\">st.columns</tt> elements. Individual\ncolumns can be accessed from an ElementList by index (order on the\npage). For example, <tt class=\"docutils literal\">at.columns[0]</tt> for the first column. Column\nis an extension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L543" + }, + { + "name": "dataframe", + "signature": "st.testing.v1.dataframe.dataframe", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.dataframe</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Dataframe", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.dataframe</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.dataframe[0]</tt> for the first element. Dataframe is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L560" + }, + { + "name": "date_input", + "signature": "st.testing.v1.date_input.date_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.date_input</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.date_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.date_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.date_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L574" + }, + { + "name": "divider", + "signature": "st.testing.v1.divider.divider", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.divider</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Divider", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.divider</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.divider[0]</tt> for the first element. Divider is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L588" + }, + { + "name": "error", + "signature": "st.testing.v1.error.error", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.error</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Error", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.error</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.error[0]</tt> for the first element. Error is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L602" + }, + { + "name": "exception", + "signature": "st.testing.v1.exception.exception", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.exception</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Exception", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.exception</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.exception[0]</tt> for the first element. Exception is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L616" + }, + { + "name": "expander", + "signature": "st.testing.v1.expander.expander", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.expander</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "Sequence of Expandable", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.expander</tt> elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.expander[0]</tt> for the first element. Expandable is an\nextension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L630" + }, + { + "name": "header", + "signature": "st.testing.v1.header.header", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.header</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Header", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.header</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.header[0]</tt> for the first element. Header is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L644" + }, + { + "name": "info", + "signature": "st.testing.v1.info.info", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.info</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Info", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.info</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.info[0]</tt> for the first element. Info is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L658" + }, + { + "name": "json", + "signature": "st.testing.v1.json.json", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.json</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Json", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.json</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.json[0]</tt> for the first element. Json is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L672" + }, + { + "name": "latex", + "signature": "st.testing.v1.latex.latex", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.latex</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Latex", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.latex</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.latex[0]</tt> for the first element. Latex is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L686" + }, + { + "name": "main", + "signature": "st.testing.v1.main.main", + "description": "<p>Sequence of elements within the main body of the app.</p>", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "<p>A container of elements. Block can be queried for elements in the\nsame manner as <tt class=\"docutils literal\">AppTest</tt>. For example, <tt class=\"docutils literal\">Block.checkbox</tt> will\nreturn all <tt class=\"docutils literal\">st.checkbox</tt> within the associated container.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L418" + }, + { + "name": "markdown", + "signature": "st.testing.v1.markdown.markdown", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.markdown</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Markdown", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.markdown</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.markdown[0]</tt> for the first element. Markdown is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L700" + }, + { + "name": "metric", + "signature": "st.testing.v1.metric.metric", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.metric</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Metric", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.metric</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.metric[0]</tt> for the first element. Metric is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L714" + }, + { + "name": "multiselect", + "signature": "st.testing.v1.multiselect.multiselect", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.multiselect</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Multiselect", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.multiselect</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.multiselect[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.multiselect(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L728" + }, + { + "name": "number_input", + "signature": "st.testing.v1.number_input.number_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.number_input</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of NumberInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.number_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.number_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.number_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L742" + }, + { + "name": "radio", + "signature": "st.testing.v1.radio.radio", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.radio</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Radio", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.radio</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.radio[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.radio(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L756" + }, + { + "name": "select_slider", + "signature": "st.testing.v1.select_slider.select_slider", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.select_slider</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of SelectSlider", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.select_slider</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.select_slider[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.select_slider(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L770" + }, + { + "name": "selectbox", + "signature": "st.testing.v1.selectbox.selectbox", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.selectbox</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Selectbox", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.selectbox</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.selectbox[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.selectbox(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L784" + }, + { + "name": "sidebar", + "signature": "st.testing.v1.sidebar.sidebar", + "description": "<p>Sequence of all elements within <tt class=\"docutils literal\">st.sidebar</tt>.</p>", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "<p>A container of elements. Block can be queried for elements in the\nsame manner as <tt class=\"docutils literal\">AppTest</tt>. For example, <tt class=\"docutils literal\">Block.checkbox</tt> will\nreturn all <tt class=\"docutils literal\">st.checkbox</tt> within the associated container.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L431" + }, + { + "name": "slider", + "signature": "st.testing.v1.slider.slider", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.slider</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Slider", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.slider</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.slider[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.slider(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L798" + }, + { + "name": "status", + "signature": "st.testing.v1.status.status", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.status</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "Sequence of Status", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.status</tt> elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.status[0]</tt> for the first element. Status is an\nextension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L840" + }, + { + "name": "subheader", + "signature": "st.testing.v1.subheader.subheader", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.subheader</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Subheader", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.subheader</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.subheader[0]</tt> for the first element. Subheader is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L812" + }, + { + "name": "success", + "signature": "st.testing.v1.success.success", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.success</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Success", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.success</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.success[0]</tt> for the first element. Success is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L826" + }, + { + "name": "table", + "signature": "st.testing.v1.table.table", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.table</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Table", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.table</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.table[0]</tt> for the first element. Table is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L854" + }, + { + "name": "tabs", + "signature": "st.testing.v1.tabs.tabs", + "description": "<p>Sequence of all tabs within <tt class=\"docutils literal\">st.tabs</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "Sequence of Tab", + "is_generator": false, + "description": "<p>Sequence of all tabs within <tt class=\"docutils literal\">st.tabs</tt> elements. Individual\ntabs can be accessed from an ElementList by index (order on the\npage). For example, <tt class=\"docutils literal\">at.tabs[0]</tt> for the first tab. Tab is an\nextension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L868" + }, + { + "name": "text", + "signature": "st.testing.v1.text.text", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Text", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.text[0]</tt> for the first element. Text is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L888" + }, + { + "name": "text_area", + "signature": "st.testing.v1.text_area.text_area", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_area</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextArea", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_area</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.text_area[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.text_area(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L902" + }, + { + "name": "text_input", + "signature": "st.testing.v1.text_input.text_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_input</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.text_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.text_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L916" + }, + { + "name": "time_input", + "signature": "st.testing.v1.time_input.time_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.time_input</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TimeInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.time_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.time_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.time_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L930" + }, + { + "name": "title", + "signature": "st.testing.v1.title.title", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.title</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Title", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.title</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.title[0]</tt> for the first element. Title is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L944" + }, + { + "name": "toast", + "signature": "st.testing.v1.toast.toast", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toast</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Toast", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toast</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.toast[0]</tt> for the first element. Toast is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L958" + }, + { + "name": "toggle", + "signature": "st.testing.v1.toggle.toggle", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toggle</tt> widgets.</p>", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Toggle", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toggle</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.toggle[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.toggle(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L972" + }, + { + "name": "warning", + "signature": "st.testing.v1.warning.warning", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.warning</tt> elements.</p>", + "args": [], + "returns": [ + { + "type_name": "ElementList of Warning", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.warning</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.warning[0]</tt> for the first element. Warning is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L986" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L95", + "description": "<p>A simulated Streamlit app to check the correctness of displayed elements and outputs.</p>\n<p>An instance of <tt class=\"docutils literal\">AppTest</tt> simulates a running Streamlit app. This class\nprovides methods to set up, manipulate, and inspect the app contents via\nAPI instead of a browser UI. It can be used to write automated tests of an\napp in various scenarios. These can then be run using a tool like pytest.</p>\n<p><tt class=\"docutils literal\">AppTest</tt> can be initialized by one of three class methods:</p>\n<ul class=\"simple\">\n<li><a class=\"reference external\" href=\"#apptestfrom_file\"><tt class=\"docutils literal\">st.testing.v1.AppTest.from_file</tt></a> (recommended)</li>\n<li><a class=\"reference external\" href=\"#apptestfrom_string\"><tt class=\"docutils literal\">st.testing.v1.AppTest.from_string</tt></a></li>\n<li><a class=\"reference external\" href=\"#apptestfrom_function\"><tt class=\"docutils literal\">st.testing.v1.AppTest.from_function</tt></a></li>\n</ul>\n<p>Once initialized, Session State and widget values can be updated and the\nscript can be run. Unlike an actual live-running Streamlit app, you need to\ncall <tt class=\"docutils literal\">AppTest.run()</tt> explicitly to re-run the app after changing a widget\nvalue. Switching pages also requires an explicit, follow-up call to\n<tt class=\"docutils literal\">AppTest.run()</tt>.</p>\n<p><tt class=\"docutils literal\">AppTest</tt> enables developers to build tests on their app as-is, in the\nfamiliar python test format, without major refactoring or abstracting out\nlogic to be tested separately from the UI. Tests can run quickly with very\nlow overhead. A typical pattern is to build a suite of tests for an app\nthat ensure consistent functionality as the app evolves, and run the tests\nlocally and/or in a CI environment like Github Actions.</p>\n<div class=\"admonition note\">\n<p class=\"first admonition-title\">Note</p>\n<p class=\"last\"><tt class=\"docutils literal\">AppTest</tt> only supports testing a single page of an app per\ninstance. For multipage apps, each page will need to be tested\nseparately. No methods exist to programatically switch pages within\n<tt class=\"docutils literal\">AppTest</tt>.</p>\n</div>\n", + "args": [ + { + "name": "secrets", + "type_name": "dict[str, Any]", + "is_optional": false, + "description": "<p>Dictionary of secrets to be used the simulated app. Use dict-like\nsyntax to set secret values for the simulated app.</p>\n", + "default": null + }, + { + "name": "session_state", + "type_name": "SafeSessionState", + "is_optional": false, + "description": "<p>Session State for the simulated app. SafeSessionState object supports\nread and write operations as usual for Streamlit apps.</p>\n", + "default": null + }, + { + "name": "query_params", + "type_name": "dict[str, Any]", + "is_optional": false, + "description": "<p>Dictionary of query parameters to be used by the simluated app. Use\ndict-like syntax to set <tt class=\"docutils literal\">query_params</tt> values for the simulated app.</p>\n", + "default": null + } + ], + "returns": [] + }, + "AppTest.button": { + "name": "button", + "signature": "AppTest.button", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.button</tt> and <tt class=\"docutils literal\">st.form_submit_button</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Button", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.button</tt> and <tt class=\"docutils literal\">st.form_submit_button</tt>\nwidgets. Individual widgets can be accessed from a WidgetList by\nindex (order on the page) or key. For example, <tt class=\"docutils literal\">at.button[0]</tt> for\nthe first widget or <tt class=\"docutils literal\"><span class=\"pre\">at.button(key="my_key")</span></tt> for a widget with a\ngiven key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L444" + }, + "AppTest.caption": { + "name": "caption", + "signature": "AppTest.caption", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.caption</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Caption", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.caption</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.caption[0]</tt> for the first element. Caption is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L459" + }, + "AppTest.chat_input": { + "name": "chat_input", + "signature": "AppTest.chat_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_input</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ChatInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.chat_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.chat_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L473" + }, + "AppTest.chat_message": { + "name": "chat_message", + "signature": "AppTest.chat_message", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_message</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of ChatMessage", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.chat_message</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.chat_message[0]</tt> for the first element. ChatMessage\nis an extension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L487" + }, + "AppTest.checkbox": { + "name": "checkbox", + "signature": "AppTest.checkbox", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.checkbox</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Checkbox", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.checkbox</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.checkbox[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.checkbox(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L501" + }, + "AppTest.code": { + "name": "code", + "signature": "AppTest.code", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.code</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Code", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.code</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.code[0]</tt> for the first element. Code is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L515" + }, + "AppTest.color_picker": { + "name": "color_picker", + "signature": "AppTest.color_picker", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.color_picker</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of ColorPicker", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.color_picker</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.color_picker[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.color_picker(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L529" + }, + "AppTest.columns": { + "name": "columns", + "signature": "AppTest.columns", + "description": "<p>Sequence of all columns within <tt class=\"docutils literal\">st.columns</tt> elements.</p>\n<p>Each column within a single <tt class=\"docutils literal\">st.columns</tt> will be returned as a\nseparate Column in the Sequence.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Column", + "is_generator": false, + "description": "<p>Sequence of all columns within <tt class=\"docutils literal\">st.columns</tt> elements. Individual\ncolumns can be accessed from an ElementList by index (order on the\npage). For example, <tt class=\"docutils literal\">at.columns[0]</tt> for the first column. Column\nis an extension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L543" + }, + "AppTest.dataframe": { + "name": "dataframe", + "signature": "AppTest.dataframe", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.dataframe</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Dataframe", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.dataframe</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.dataframe[0]</tt> for the first element. Dataframe is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L560" + }, + "AppTest.date_input": { + "name": "date_input", + "signature": "AppTest.date_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.date_input</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of DateInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.date_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.date_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.date_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L574" + }, + "AppTest.divider": { + "name": "divider", + "signature": "AppTest.divider", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.divider</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Divider", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.divider</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.divider[0]</tt> for the first element. Divider is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L588" + }, + "AppTest.error": { + "name": "error", + "signature": "AppTest.error", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.error</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Error", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.error</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.error[0]</tt> for the first element. Error is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L602" + }, + "AppTest.exception": { + "name": "exception", + "signature": "AppTest.exception", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.exception</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Exception", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.exception</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.exception[0]</tt> for the first element. Exception is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L616" + }, + "AppTest.expander": { + "name": "expander", + "signature": "AppTest.expander", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.expander</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Expandable", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.expander</tt> elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.expander[0]</tt> for the first element. Expandable is an\nextension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L630" + }, + "AppTest.from_file": { + "name": "from_file", + "signature": "AppTest.from_file(cls, script_path, *, default_timeout=3)", + "description": "<p>Create an instance of <tt class=\"docutils literal\">AppTest</tt> to simulate an app page defined within a file.</p>\n<p>This option is most convenient for CI workflows and testing of\npublished apps. The script must be executable on its own and so must\ncontain all necessary imports.</p>\n", + "args": [ + { + "name": "script_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Path to a script file. The path should be absolute or relative to\nthe file calling <tt class=\"docutils literal\">.from_file</tt>.</p>\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Default time in seconds before a script run is timed out. Can be\noverridden for individual <tt class=\"docutils literal\">.run()</tt> calls.</p>\n", + "default": "time" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>A simulated Streamlit app for testing. The simulated app can be\nexecuted via <tt class=\"docutils literal\">.run()</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L265" + }, + "AppTest.from_function": { + "name": "from_function", + "signature": "AppTest.from_function(cls, script, *, default_timeout=3, args=None, kwargs=None)", + "description": "<p>Create an instance of <tt class=\"docutils literal\">AppTest</tt> to simulate an app page defined within a function.</p>\n<p>This is similar to <tt class=\"docutils literal\">AppTest.from_string()</tt>, but more convenient to\nwrite with IDE assistance. The script must be executable on its own and\nso must contain all necessary imports.</p>\n", + "args": [ + { + "name": "script", + "type_name": "Callable", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>A function whose body will be used as a script. Must be runnable\nin isolation, so it must include any necessary imports.</p>\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Default time in seconds before a script run is timed out. Can be\noverridden for individual <tt class=\"docutils literal\">.run()</tt> calls.</p>\n", + "default": "time" + }, + { + "name": "args", + "type_name": "tuple", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional tuple of args to pass to the script function.</p>\n", + "default": null + }, + { + "name": "kwargs", + "type_name": "dict", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>An optional dict of kwargs to pass to the script function.</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>A simulated Streamlit app for testing. The simulated app can be\nexecuted via <tt class=\"docutils literal\">.run()</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L218" + }, + "AppTest.from_string": { + "name": "from_string", + "signature": "AppTest.from_string(cls, script, *, default_timeout=3)", + "description": "<p>Create an instance of <tt class=\"docutils literal\">AppTest</tt> to simulate an app page defined within a string.</p>\n<p>This is useful for testing short scripts that fit comfortably as an\ninline string in the test itself, without having to create a separate\nfile for it. The script must be executable on its own and so must\ncontain all necessary imports.</p>\n", + "args": [ + { + "name": "script", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>The string contents of the script to be run.</p>\n", + "default": null + }, + { + "name": "default_timeout", + "type_name": "float", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Default time in seconds before a script run is timed out. Can be\noverridden for individual <tt class=\"docutils literal\">.run()</tt> calls.</p>\n", + "default": "time" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>A simulated Streamlit app for testing. The simulated app can be\nexecuted via <tt class=\"docutils literal\">.run()</tt>.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L175" + }, + "AppTest.get": { + "name": "get", + "signature": "AppTest.get(element_type)", + "description": "<p>Get elements or widgets of the specified type.</p>\n<p>This method returns the collection of all elements or widgets of\nthe specified type on the current page. Retrieve a specific element by\nusing its index (order on page) or key lookup.</p>\n", + "args": [ + { + "name": "element_type", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>An element attribute of <tt class=\"docutils literal\">AppTest</tt>. For example, "button",\n"caption", or "chat_input".</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "Sequence of Elements", + "is_generator": false, + "description": "<p>Sequence of elements of the given type. Individual elements can\nbe accessed from a Sequence by index (order on the page). When\ngetting and <tt class=\"docutils literal\">element_type</tt> that is a widget, individual widgets\ncan be accessed by key. For example, <tt class=\"docutils literal\"><span class=\"pre\">at.get("text")[0]</span></tt> for the\nfirst <tt class=\"docutils literal\">st.text</tt> element or <tt class=\"docutils literal\"><span class=\"pre\">at.get("slider")(key="my_key")</span></tt> for\nthe <tt class=\"docutils literal\">st.slider</tt> widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L1009" + }, + "AppTest.header": { + "name": "header", + "signature": "AppTest.header", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.header</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Header", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.header</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.header[0]</tt> for the first element. Header is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L644" + }, + "AppTest.info": { + "name": "info", + "signature": "AppTest.info", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.info</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Info", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.info</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.info[0]</tt> for the first element. Info is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L658" + }, + "AppTest.json": { + "name": "json", + "signature": "AppTest.json", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.json</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Json", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.json</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.json[0]</tt> for the first element. Json is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L672" + }, + "AppTest.latex": { + "name": "latex", + "signature": "AppTest.latex", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.latex</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Latex", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.latex</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.latex[0]</tt> for the first element. Latex is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L686" + }, + "AppTest.main": { + "name": "main", + "signature": "AppTest.main", + "description": "<p>Sequence of elements within the main body of the app.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "<p>A container of elements. Block can be queried for elements in the\nsame manner as <tt class=\"docutils literal\">AppTest</tt>. For example, <tt class=\"docutils literal\">Block.checkbox</tt> will\nreturn all <tt class=\"docutils literal\">st.checkbox</tt> within the associated container.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L418" + }, + "AppTest.markdown": { + "name": "markdown", + "signature": "AppTest.markdown", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.markdown</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Markdown", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.markdown</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.markdown[0]</tt> for the first element. Markdown is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L700" + }, + "AppTest.metric": { + "name": "metric", + "signature": "AppTest.metric", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.metric</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Metric", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.metric</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.metric[0]</tt> for the first element. Metric is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L714" + }, + "AppTest.multiselect": { + "name": "multiselect", + "signature": "AppTest.multiselect", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.multiselect</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Multiselect", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.multiselect</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.multiselect[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.multiselect(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L728" + }, + "AppTest.number_input": { + "name": "number_input", + "signature": "AppTest.number_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.number_input</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of NumberInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.number_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.number_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.number_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L742" + }, + "AppTest.radio": { + "name": "radio", + "signature": "AppTest.radio", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.radio</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Radio", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.radio</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.radio[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.radio(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L756" + }, + "AppTest.run": { + "name": "run", + "signature": "AppTest.run(*, timeout=None)", + "description": "<p>Run the script from the current state.</p>\n<p>This is equivalent to manually rerunning the app or the rerun that\noccurs upon user interaction. <tt class=\"docutils literal\">AppTest.run()</tt> must be manually called\nafter updating a widget value or switching pages as script reruns do\nnot occur automatically as they do for live-running Streamlit apps.</p>\n", + "args": [ + { + "name": "timeout", + "type_name": "float or None", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. If <tt class=\"docutils literal\">timeout</tt> is\n<tt class=\"docutils literal\">None</tt> (default), Streamlit uses the default timeout set for the\ninstance of <tt class=\"docutils literal\">AppTest</tt>.</p>\n", + "default": "timeout" + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>self</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L367" + }, + "AppTest.select_slider": { + "name": "select_slider", + "signature": "AppTest.select_slider", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.select_slider</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of SelectSlider", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.select_slider</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.select_slider[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.select_slider(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L770" + }, + "AppTest.selectbox": { + "name": "selectbox", + "signature": "AppTest.selectbox", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.selectbox</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Selectbox", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.selectbox</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.selectbox[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.selectbox(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L784" + }, + "AppTest.sidebar": { + "name": "sidebar", + "signature": "AppTest.sidebar", + "description": "<p>Sequence of all elements within <tt class=\"docutils literal\">st.sidebar</tt>.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Block", + "is_generator": false, + "description": "<p>A container of elements. Block can be queried for elements in the\nsame manner as <tt class=\"docutils literal\">AppTest</tt>. For example, <tt class=\"docutils literal\">Block.checkbox</tt> will\nreturn all <tt class=\"docutils literal\">st.checkbox</tt> within the associated container.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L431" + }, + "AppTest.slider": { + "name": "slider", + "signature": "AppTest.slider", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.slider</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Slider", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.slider</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.slider[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.slider(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L798" + }, + "AppTest.status": { + "name": "status", + "signature": "AppTest.status", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.status</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Status", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.status</tt> elements. Individual elements can be\naccessed from a Sequence by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.status[0]</tt> for the first element. Status is an\nextension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L840" + }, + "AppTest.subheader": { + "name": "subheader", + "signature": "AppTest.subheader", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.subheader</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Subheader", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.subheader</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.subheader[0]</tt> for the first element. Subheader is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L812" + }, + "AppTest.success": { + "name": "success", + "signature": "AppTest.success", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.success</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Success", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.success</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.success[0]</tt> for the first element. Success is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L826" + }, + "AppTest.switch_page": { + "name": "switch_page", + "signature": "AppTest.switch_page(page_path)", + "description": "<p>Switch to another page of the app.</p>\n<p>This method does not automatically rerun the app. Use a follow-up call\nto <tt class=\"docutils literal\">AppTest.run()</tt> to obtain the elements on the selected page.</p>\n", + "args": [ + { + "name": "page_path", + "type_name": "str", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Path of the page to switch to. The path must be relative to the\nmain script's location (e.g. <tt class=\"docutils literal\">"pages/my_page.py"</tt>).</p>\n", + "default": null + } + ], + "returns": [ + { + "type_name": "AppTest", + "is_generator": false, + "description": "<p>self</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L390" + }, + "AppTest.table": { + "name": "table", + "signature": "AppTest.table", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.table</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Table", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.table</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.table[0]</tt> for the first element. Table is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L854" + }, + "AppTest.tabs": { + "name": "tabs", + "signature": "AppTest.tabs", + "description": "<p>Sequence of all tabs within <tt class=\"docutils literal\">st.tabs</tt> elements.</p>\n<p>Each tab within a single <tt class=\"docutils literal\">st.tabs</tt> will be returned as a separate Tab\nin the Sequence. Additionally, the tab labels are forwarded to each\nTab element as a property. For example, <tt class=\"docutils literal\"><span class=\"pre\">st.tabs("A","B")</span></tt> will\nyield two Tab objects, with <tt class=\"docutils literal\">Tab.label</tt> returning "A" and "B",\nrespectively.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Sequence of Tab", + "is_generator": false, + "description": "<p>Sequence of all tabs within <tt class=\"docutils literal\">st.tabs</tt> elements. Individual\ntabs can be accessed from an ElementList by index (order on the\npage). For example, <tt class=\"docutils literal\">at.tabs[0]</tt> for the first tab. Tab is an\nextension of the Block class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L868" + }, + "AppTest.text": { + "name": "text", + "signature": "AppTest.text", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Text", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.text[0]</tt> for the first element. Text is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L888" + }, + "AppTest.text_area": { + "name": "text_area", + "signature": "AppTest.text_area", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_area</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextArea", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_area</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.text_area[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.text_area(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L902" + }, + "AppTest.text_input": { + "name": "text_input", + "signature": "AppTest.text_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_input</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TextInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.text_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.text_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.text_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L916" + }, + "AppTest.time_input": { + "name": "time_input", + "signature": "AppTest.time_input", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.time_input</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of TimeInput", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.time_input</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.time_input[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.time_input(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L930" + }, + "AppTest.title": { + "name": "title", + "signature": "AppTest.title", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.title</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Title", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.title</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.title[0]</tt> for the first element. Title is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L944" + }, + "AppTest.toast": { + "name": "toast", + "signature": "AppTest.toast", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toast</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Toast", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toast</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.toast[0]</tt> for the first element. Toast is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L958" + }, + "AppTest.toggle": { + "name": "toggle", + "signature": "AppTest.toggle", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toggle</tt> widgets.</p>\n", + "args": [], + "returns": [ + { + "type_name": "WidgetList of Toggle", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.toggle</tt> widgets. Individual widgets can\nbe accessed from a WidgetList by index (order on the page) or key.\nFor example, <tt class=\"docutils literal\">at.toggle[0]</tt> for the first widget or\n<tt class=\"docutils literal\"><span class=\"pre\">at.toggle(key="my_key")</span></tt> for a widget with a given key.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L972" + }, + "AppTest.warning": { + "name": "warning", + "signature": "AppTest.warning", + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.warning</tt> elements.</p>\n", + "args": [], + "returns": [ + { + "type_name": "ElementList of Warning", + "is_generator": false, + "description": "<p>Sequence of all <tt class=\"docutils literal\">st.warning</tt> elements. Individual elements can be\naccessed from an ElementList by index (order on the page). For\nexample, <tt class=\"docutils literal\">at.warning[0]</tt> for the first element. Warning is an\nextension of the Element class.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/app_test.py#L986" + }, + "streamlit.testing.v1.element_tree.Button": { + "name": "Button", + "signature": "st.testing.v1.element_tree.Button(proto, root)", + "is_class": true, + "methods": [ + { + "name": "click", + "signature": "st.testing.v1.element_tree.click.click()", + "description": "<p>Set the value of the button to True.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L340" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the button.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L335" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The value of the button. (bool)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L325" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L302", + "description": "<p>A representation of <tt class=\"docutils literal\">st.button</tt> and <tt class=\"docutils literal\">st.form_submit_button</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ChatInput": { + "name": "ChatInput", + "signature": "st.testing.v1.element_tree.ChatInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L357" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The value of the widget. (str)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L370" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L345", + "description": "<p>A representation of <tt class=\"docutils literal\">st.chat_input</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Checkbox": { + "name": "Checkbox", + "signature": "st.testing.v1.element_tree.Checkbox(proto, root)", + "is_class": true, + "methods": [ + { + "name": "check", + "signature": "st.testing.v1.element_tree.check.check()", + "description": "<p>Set the value of the widget to True.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L418" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L413" + }, + { + "name": "uncheck", + "signature": "st.testing.v1.element_tree.uncheck.uncheck()", + "description": "<p>Set the value of the widget to False.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L422" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The value of the widget. (bool)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L403" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L381", + "description": "<p>A representation of <tt class=\"docutils literal\">st.checkbox</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.ColorPicker": { + "name": "ColorPicker", + "signature": "st.testing.v1.element_tree.ColorPicker(proto, root)", + "is_class": true, + "methods": [ + { + "name": "pick", + "signature": "st.testing.v1.element_tree.pick.pick(v)", + "description": "<p>Set the value of the widget as a hex string. May omit the "#" prefix.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L490" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget as a hex string.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L485" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The currently selected value as a hex string. (str)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L464" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L449", + "description": "<p>A representation of <tt class=\"docutils literal\">st.color_picker</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.DateInput": { + "name": "DateInput", + "signature": "st.testing.v1.element_tree.DateInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L536" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The value of the widget. (date or Tuple of date)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L550" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L516", + "description": "<p>A representation of <tt class=\"docutils literal\">st.date_input</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Element": { + "name": "Element", + "signature": "st.testing.v1.element_tree.Element(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The value or contents of the element.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L133" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L104", + "description": "<p>Element base class for testing.</p>\n<p>This class's methods and attributes are universal for all elements\nimplemented in testing. For example, <tt class=\"docutils literal\">Caption</tt>, <tt class=\"docutils literal\">Code</tt>, <tt class=\"docutils literal\">Text</tt>, and\n<tt class=\"docutils literal\">Title</tt> inherit from <tt class=\"docutils literal\">Element</tt>. All widget classes also\ninherit from Element, but have additional methods specific to each\nwidget type. See the <tt class=\"docutils literal\">AppTest</tt> class for the full list of supported\nelements.</p>\n<p>For all element classes, parameters of the original element can be obtained\nas properties. For example, <tt class=\"docutils literal\">Button.label</tt>, <tt class=\"docutils literal\">Caption.help</tt>, and\n<tt class=\"docutils literal\">Toast.icon</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Multiselect": { + "name": "Multiselect", + "signature": "st.testing.v1.element_tree.Multiselect(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "<p>Add a selection to the widget. Do nothing if the value is already selected. If testing a multiselect widget with repeated options, use <tt class=\"docutils literal\">set_value</tt> instead.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L753" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the multiselect widget. (list)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L747" + }, + { + "name": "unselect", + "signature": "st.testing.v1.element_tree.unselect.unselect(v)", + "description": "<p>Remove a selection from the widget. Do nothing if the value is not already selected. If a value is selected multiple times, the first instance is removed.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L768" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "<p>The widget's formatting function for displaying options. (callable)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L741" + }, + { + "name": "indices", + "signature": "st.testing.v1.element_tree.indices.indices", + "description": "<p>The indices of the currently selected values from the options. (list)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L736" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The currently selected values from the options. (list)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L726" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L697", + "description": "<p>A representation of <tt class=\"docutils literal\">st.multiselect</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.NumberInput": { + "name": "NumberInput", + "signature": "st.testing.v1.element_tree.NumberInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "decrement", + "signature": "st.testing.v1.element_tree.decrement.decrement()", + "description": "<p>Decrement the <tt class=\"docutils literal\">st.number_input</tt> widget as if the user clicked "-".</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L841" + }, + { + "name": "increment", + "signature": "st.testing.v1.element_tree.increment.increment()", + "description": "<p>Increment the <tt class=\"docutils literal\">st.number_input</tt> widget as if the user clicked "+".</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L833" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the <tt class=\"docutils literal\">st.number_input</tt> widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L808" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>Get the current value of the <tt class=\"docutils literal\">st.number_input</tt> widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L821" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L788", + "description": "<p>A representation of <tt class=\"docutils literal\">st.number_input</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Radio": { + "name": "Radio", + "signature": "st.testing.v1.element_tree.Radio(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the selection by value.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L892" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "<p>The widget's formatting function for displaying options. (callable)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L886" + }, + { + "name": "index", + "signature": "st.testing.v1.element_tree.index.index", + "description": "<p>The index of the current selection. (int)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L869" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The currently selected value from the options. (Any)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L876" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L850", + "description": "<p>A representation of <tt class=\"docutils literal\">st.radio</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.SelectSlider": { + "name": "SelectSlider", + "signature": "st.testing.v1.element_tree.SelectSlider(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_range", + "signature": "st.testing.v1.element_tree.set_range.set_range(lower, upper)", + "description": "<p>Set the ranged selection by values.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1038" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the (single) selection by value.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1000" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "<p>The widget's formatting function for displaying options. (callable)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1032" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The currently selected value or range. (Any or Sequence of Any)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1021" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L982", + "description": "<p>A representation of <tt class=\"docutils literal\">st.select_slider</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Selectbox": { + "name": "Selectbox", + "signature": "st.testing.v1.element_tree.Selectbox(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "select", + "signature": "st.testing.v1.element_tree.select.select(v)", + "description": "<p>Set the selection by value.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L959" + }, + { + "name": "select_index", + "signature": "st.testing.v1.element_tree.select_index.select_index(index)", + "description": "<p>Set the selection by index.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L963" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the selection by value.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L954" + } + ], + "properties": [ + { + "name": "format_func", + "signature": "st.testing.v1.element_tree.format_func.format_func", + "description": "<p>The widget's formatting function for displaying options. (callable)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L948" + }, + { + "name": "index", + "signature": "st.testing.v1.element_tree.index.index", + "description": "<p>The index of the current selection. (int)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L928" + }, + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The currently selected value from the options. (Any)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L938" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L910", + "description": "<p>A representation of <tt class=\"docutils literal\">st.selectbox</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Slider": { + "name": "Slider", + "signature": "st.testing.v1.element_tree.Slider(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_range", + "signature": "st.testing.v1.element_tree.set_range.set_range(lower, upper)", + "description": "<p>Set the ranged value of the slider.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1091" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the (single) value of the slider.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1062" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The currently selected value or range. (Any or Sequence of Any)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1080" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1043", + "description": "<p>A representation of <tt class=\"docutils literal\">st.slider</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TextArea": { + "name": "TextArea", + "signature": "st.testing.v1.element_tree.TextArea(proto, root)", + "is_class": true, + "methods": [ + { + "name": "input", + "signature": "st.testing.v1.element_tree.input.input(v)", + "description": "<p>Set the value of the widget only if the value does not exceed the maximum allowed characters.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1172" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1148" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The current value of the widget. (str)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1161" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1130", + "description": "<p>A representation of <tt class=\"docutils literal\">st.text_area</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TextInput": { + "name": "TextInput", + "signature": "st.testing.v1.element_tree.TextInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "input", + "signature": "st.testing.v1.element_tree.input.input(v)", + "description": "<p>Set the value of the widget only if the value does not exceed the maximum allowed characters.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1225" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1201" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The current value of the widget. (str)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1214" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1183", + "description": "<p>A representation of <tt class=\"docutils literal\">st.text_input</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.TimeInput": { + "name": "TimeInput", + "signature": "st.testing.v1.element_tree.TimeInput(proto, root)", + "is_class": true, + "methods": [ + { + "name": "decrement", + "signature": "st.testing.v1.element_tree.decrement.decrement()", + "description": "<p>Select the previous available time.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1290" + }, + { + "name": "increment", + "signature": "st.testing.v1.element_tree.increment.increment()", + "description": "<p>Select the next available time.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1283" + }, + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1255" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The current value of the widget. (time)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1271" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1239", + "description": "<p>A representation of <tt class=\"docutils literal\">st.time_input</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Toggle": { + "name": "Toggle", + "signature": "st.testing.v1.element_tree.Toggle(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1347" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The current value of the widget. (bool)</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1337" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L1314", + "description": "<p>A representation of <tt class=\"docutils literal\">st.toggle</tt>.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.testing.v1.element_tree.Widget": { + "name": "Widget", + "signature": "st.testing.v1.element_tree.Widget(proto, root)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": "st.testing.v1.element_tree.run.run(*, timeout=None)", + "description": "<p>Run the <tt class=\"docutils literal\">AppTest</tt> script which contains the element.</p>", + "args": [ + { + "name": "timeout", + "type_name": null, + "is_optional": null, + "is_kwarg_only": true, + "description": "<p>The maximum number of seconds to run the script. None means\nuse the AppTest's default.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L143" + }, + { + "name": "set_value", + "signature": "st.testing.v1.element_tree.set_value.set_value(v)", + "description": "<p>Set the value of the widget.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L194" + } + ], + "properties": [ + { + "name": "value", + "signature": "st.testing.v1.element_tree.value.value", + "description": "<p>The value or contents of the element.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L133" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/testing/v1/element_tree.py#L179", + "description": "<p>Widget base class for testing.</p>\n", + "args": [], + "returns": [] + }, + "streamlit.experimental_user.to_dict": { + "name": "experimental_user.to_dict", + "signature": "st.experimental_user.to_dict()", + "description": "<p>Get user info as a dictionary.</p>\n<p>This method primarily exists for internal use and is not needed for\nmost cases. <tt class=\"docutils literal\">st.experimental_user</tt> returns an object that inherits from\n<tt class=\"docutils literal\">dict</tt> by default.</p>\n", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "<p>A dictionary of the current user's information.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/user_info.py#L84" + }, + "CachedFunc.clear": { + "name": "clear", + "signature": "CachedFunc.clear(*args, **kwargs)", + "example": "<blockquote>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport time\n\n@st.cache_data\ndef foo(bar):\n time.sleep(2)\n st.write(f"Executed foo({bar}).")\n return bar\n\nif st.button("Clear all cached values for `foo`", on_click=foo.clear):\n foo.clear()\n\nif st.button("Clear the cached value of `foo(1)`"):\n foo.clear(1)\n\nfoo(1)\nfoo(2)\n</pre>\n</blockquote>\n", + "description": "<p>Clear the cached function's associated cache.</p>\n<p>If no arguments are passed, Streamlit will clear all values cached for\nthe function. If arguments are passed, Streamlit will clear the cached\nvalue for these arguments only.</p>\n", + "args": [ + { + "name": "*args", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": false, + "description": "<p>Arguments of the cached functions.</p>\n", + "default": null + }, + { + "name": "**kwargs", + "type_name": "Any", + "is_optional": false, + "is_kwarg_only": true, + "description": "<p>Keyword arguments of the cached function.</p>\n", + "default": null + } + ], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/runtime/caching/cache_utils.py#L309" + }, + "StreamlitPage": { + "name": "StreamlitPage", + "signature": "StreamlitPage(page, *, title=None, icon=None, url_path=None, default=False)", + "is_class": true, + "methods": [ + { + "name": "run", + "signature": ".run.run()", + "description": "<p>Execute the page.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L254" + } + ], + "properties": [ + { + "name": "icon", + "signature": ".icon.icon", + "description": "<p>The icon of the page.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L231" + }, + { + "name": "title", + "signature": ".title.title", + "description": "<p>The title of the page.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L220" + }, + { + "name": "url_path", + "signature": ".url_path.url_path", + "description": "<p>The page's URL pathname, which is the path relative to the app's root URL.</p>", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L239" + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L127", + "description": "<p>A page within a multipage Streamlit app.</p>\n<p>Use <tt class=\"docutils literal\">st.Page</tt> to initialize a <tt class=\"docutils literal\">StreamlitPage</tt> object.</p>\n", + "args": [ + { + "name": "icon", + "type_name": "str", + "is_optional": false, + "description": "<p>The icon of the page.</p>\n<p>If no icon was declared in <tt class=\"docutils literal\">st.Page</tt>, this property returns <tt class=\"docutils literal\">""</tt>.</p>\n", + "default": null + }, + { + "name": "title", + "type_name": "str", + "is_optional": false, + "description": "<p>The title of the page.</p>\n<p>Unless declared otherwise in <tt class=\"docutils literal\">st.Page</tt>, the page title is inferred\nfrom the filename or callable name. For more information, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/st.page.automatic-page-labels\">Overview of multipage apps</a>.</p>\n", + "default": null + }, + { + "name": "url_path", + "type_name": "str", + "is_optional": false, + "description": "<p>The page's URL pathname, which is the path relative to the app's root\nURL.</p>\n<p>Unless declared otherwise in <tt class=\"docutils literal\">st.Page</tt>, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/st.page.automatic-page-urls\">Overview of multipage apps</a>.</p>\n<p>The default page will always have a <tt class=\"docutils literal\">url_path</tt> of <tt class=\"docutils literal\">""</tt> to indicate\nthe root URL (e.g. homepage).</p>\n", + "default": "page" + } + ], + "returns": [] + }, + "StreamlitPage.icon": { + "name": "icon", + "signature": "StreamlitPage.icon", + "description": "<p>The icon of the page.</p>\n<p>If no icon was declared in <tt class=\"docutils literal\">st.Page</tt>, this property returns <tt class=\"docutils literal\">""</tt>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L231" + }, + "StreamlitPage.run": { + "name": "run", + "signature": "StreamlitPage.run()", + "description": "<p>Execute the page.</p>\n<p>When a page is returned by <tt class=\"docutils literal\">st.navigation</tt>, use the <tt class=\"docutils literal\">.run()</tt> method\nwithin your entrypoint file to render the page. You can only call this\nmethod on the page returned by <tt class=\"docutils literal\">st.navigation</tt>. You can only call\nthis method once per run of your entrypoint file.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L254" + }, + "StreamlitPage.title": { + "name": "title", + "signature": "StreamlitPage.title", + "description": "<p>The title of the page.</p>\n<p>Unless declared otherwise in <tt class=\"docutils literal\">st.Page</tt>, the page title is inferred\nfrom the filename or callable name. For more information, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/st.page.automatic-page-labels\">Overview of multipage apps</a>.</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L220" + }, + "StreamlitPage.url_path": { + "name": "url_path", + "signature": "StreamlitPage.url_path", + "description": "<p>The page's URL pathname, which is the path relative to the app's root URL.</p>\n<p>Unless declared otherwise in <tt class=\"docutils literal\">st.Page</tt>, the URL pathname is inferred\nfrom the filename or callable name. For more information, see\n<a class=\"reference external\" href=\"https://docs.streamlit.io/st.page.automatic-page-urls\">Overview of multipage apps</a>.</p>\n<p>The default page will always have a <tt class=\"docutils literal\">url_path</tt> of <tt class=\"docutils literal\">""</tt> to indicate\nthe root URL (e.g. homepage).</p>\n", + "args": [], + "returns": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/navigation/page.py#L239" + }, + "streamlit.experimental_user": { + "name": "experimental_user", + "signature": "st.experimental_user()", + "is_class": true, + "methods": [ + { + "name": "to_dict", + "signature": "st.to_dict.to_dict()", + "description": "<p>Get user info as a dictionary.</p>", + "args": [], + "returns": [ + { + "type_name": "Dict[str,str]", + "is_generator": false, + "description": "<p>A dictionary of the current user's information.</p>\n", + "return_name": null + } + ], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/user_info.py#L84" + } + ], + "properties": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/user_info.py#L34", + "description": "<p>A read-only, dict-like object for accessing information about current user.</p>\n<p><tt class=\"docutils literal\">st.experimental_user</tt> is dependant on the host platform running the\nStreamlit app. If the host platform has not configured the function, it\nwill behave as it does in a locally running app.</p>\n<p>Properties can by accessed via key or attribute notation. For example,\n<tt class=\"docutils literal\"><span class=\"pre\">st.experimental_user["email"]</span></tt> or <tt class=\"docutils literal\">st.experimental_user.email</tt>.</p>\n", + "args": [ + { + "name": "email", + "type_name": "str", + "is_optional": false, + "description": "<p>If running locally, this property returns the string literal\n<tt class=\"docutils literal\">"test@example.com"</tt>.</p>\n<p>If running on Streamlit Community Cloud, this\nproperty returns one of two values:</p>\n<ul class=\"simple\">\n<li><tt class=\"docutils literal\">None</tt> if the user is not logged in or not a member of the app's workspace. Such users appear under anonymous pseudonyms in the app's analytics.</li>\n<li>The user's email if the the user is logged in and a member of the app's workspace. Such users are identified by their email in the app's analytics.</li>\n</ul>\n", + "default": null + } + ], + "returns": [] + }, + "PlotlyState": { + "name": "PlotlyState", + "signature": "PlotlyState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/plotly_chart.py#L175", + "example": "<p>Try selecting points by any of the three available methods (direct click,\nbox, or lasso). The current selection state is available through Session\nState or as the output of the chart function.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport plotly.express as px\n\ndf = px.data.iris() # iris is a pandas DataFrame\nfig = px.scatter(df, x="sepal_width", y="sepal_length")\n\nevent = st.plotly_chart(fig, key="iris", on_select="rerun")\n\nevent\n</pre>\n<Cloud name=\"doc-chart-events-plotly-state\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" />", + "description": "<p>The schema for the Plotly chart event state.</p>\n<p>The event state is stored in a dictionary-like object that suports both\nkey and attribute notation. Event states cannot be programmatically\nchanged or set through Session State.</p>\n<p>Only selection events are supported at this time.</p>\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "<p>The state of the <tt class=\"docutils literal\">on_select</tt> event. This attribure returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by the <tt class=\"docutils literal\">PlotlySelectionState</tt> dictionary\nschema.</p>\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "PlotlySelectionState": { + "name": "PlotlySelectionState", + "signature": "PlotlySelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/plotly_chart.py#L87", + "example": "<p>When working with more complicated graphs, the <tt class=\"docutils literal\">points</tt> attribute\ndisplays additional information. Try selecting points in the following\nexample:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport plotly.express as px\n\ndf = px.data.iris()\nfig = px.scatter(\n df,\n x="sepal_width",\n y="sepal_length",\n color="species",\n size="petal_length",\n hover_data=["petal_width"],\n)\n\nevent = st.plotly_chart(fig, key="iris", on_select="rerun")\n\nevent.selection\n</pre>\n<Cloud name=\"doc-chart-events-plotly-selection-state\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" /><p>This is an example of the selection state when selecting a single point:</p>\n<pre class=\"doctest-block\">\n{\n "points": [\n {\n "curve_number": 2,\n "point_number": 9,\n "point_index": 9,\n "x": 3.6,\n "y": 7.2,\n "customdata": [\n 2.5\n ],\n "marker_size": 6.1,\n "legendgroup": "virginica"\n }\n ],\n "point_indices": [\n 9\n ],\n "box": [],\n "lasso": []\n}\n</pre>\n", + "description": "<p>The schema for the Plotly chart selection state.</p>\n<p>The selection state is stored in a dictionary-like object that suports both\nkey and attribute notation. Selection states cannot be programmatically\nchanged or set through Session State.</p>\n", + "args": [ + { + "name": "points", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "<p>The selected data points in the chart, including the data points\nselected by the box and lasso mode. The data includes the values\nassociated to each point and a point index used to populate\n<tt class=\"docutils literal\">point_indices</tt>. If additional information has been assigned to your\npoints, such as size or legend group, this is also included.</p>\n", + "default": null + }, + { + "name": "point_indices", + "type_name": "list[int]", + "is_optional": false, + "description": "<p>The numerical indices of all selected data points in the chart. The\ndetails of each identified point are included in <tt class=\"docutils literal\">points</tt>.</p>\n", + "default": null + }, + { + "name": "box", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "<p>The metadata related to the box selection. This includes the\ncoordinates of the selected area.</p>\n", + "default": null + }, + { + "name": "lasso", + "type_name": "list[dict[str, Any]]", + "is_optional": false, + "description": "<p>The metadata related to the lasso selection. This includes the\ncoordinates of the selected area.</p>\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "VegaLiteState": { + "name": "VegaLiteState", + "signature": "VegaLiteState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/vega_charts.py#L104", + "examples": "<p>The following two examples have equivalent definitions. Each one has a\npoint and interval selection parameter include in the chart definition.\nThe point seleciton parameter is named <tt class=\"docutils literal\">"point_selection"</tt>. The interval\nor box selection parameter is named <tt class=\"docutils literal\">"interval_selection"</tt>.</p>\n<p>The follow example uses <tt class=\"docutils literal\">st.altair_chart</tt>:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\nimport altair as alt\n\nif "data" not in st.session_state:\n st.session_state.data = pd.DataFrame(\n np.random.randn(20, 3), columns=["a", "b", "c"]\n )\ndf = st.session_state.data\n\npoint_selector = alt.selection_point("point_selection")\ninterval_selector = alt.selection_interval("interval_selection")\nchart = (\n alt.Chart(df)\n .mark_circle()\n .encode(\n x="a",\n y="b",\n size="c",\n color="c",\n tooltip=["a", "b", "c"],\n fillOpacity=alt.condition(point_selector, alt.value(1), alt.value(0.3)),\n )\n .add_params(point_selector, interval_selector)\n)\n\nevent = st.altair_chart(chart, key="alt_chart", on_select="rerun")\n\nevent\n</pre>\n<p>The following example uses <tt class=\"docutils literal\">st.vega_lite_chart</tt>:</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nif "data" not in st.session_state:\n st.session_state.data = pd.DataFrame(\n np.random.randn(20, 3), columns=["a", "b", "c"]\n )\n\nspec = {\n "mark": {"type": "circle", "tooltip": True},\n "params": [\n {"name": "interval_selection", "select": "interval"},\n {"name": "point_selection", "select": "point"},\n ],\n "encoding": {\n "x": {"field": "a", "type": "quantitative"},\n "y": {"field": "b", "type": "quantitative"},\n "size": {"field": "c", "type": "quantitative"},\n "color": {"field": "c", "type": "quantitative"},\n "fillOpacity": {\n "condition": {"param": "point_selection", "value": 1},\n "value": 0.3,\n },\n },\n}\n\nevent = st.vega_lite_chart(st.session_state.data, spec, key="vega_chart", on_select="rerun")\n\nevent\n</pre>\n<p>Try selecting points in this interactive example. When you click a point,\nthe selection will appear under the attribute, <tt class=\"docutils literal\">"point_selection"</tt>, which\nis the name given to the point selection parameter. Similarly, when you\nmake an interval selection, it will appear under the attribute\n<tt class=\"docutils literal\">"interval_selection"</tt>. You can give your selection parameters other\nnames if desired.</p>\n<p>If you hold <tt class=\"docutils literal\">Shift</tt> while selecting points, existing point selections\nwill be preserved. Interval selections are not preserved when making\nadditional selections.</p>\n<Cloud name=\"doc-chart-events-vega-lite-state\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" />", + "description": "<p>The schema for the Vega-Lite event state.</p>\n<p>The event state is stored in a dictionary-like object that suports both\nkey and attribute notation. Event states cannot be programmatically\nchanged or set through Session State.</p>\n<p>Only selection events are supported at this time.</p>\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "<p>The state of the <tt class=\"docutils literal\">on_select</tt> event. This attribure returns a\ndictionary-like object that supports both key and attribute notation.\nThe name of each Vega-Lite selection parameter becomes an attribute in\nthe <tt class=\"docutils literal\">selection</tt> dictionary. The format of the data within each\nattribute is determined by the selection parameter definition within\nVega-Lite.</p>\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataframeState": { + "name": "DataframeState", + "signature": "DataframeState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/arrow.py#L148", + "description": "<p>The schema for the dataframe event state.</p>\n<p>The event state is stored in a dictionary-like object that suports both\nkey and attribute notation. Event states cannot be programmatically\nchanged or set through Session State.</p>\n<p>Only selection events are supported at this time.</p>\n", + "args": [ + { + "name": "selection", + "type_name": "dict", + "is_optional": false, + "description": "<p>The state of the <tt class=\"docutils literal\">on_select</tt> event. This attribure returns a\ndictionary-like object that supports both key and attribute notation.\nThe attributes are described by the <tt class=\"docutils literal\">DataframeSelectionState</tt>\ndictionary schema.</p>\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + }, + "DataframeSelectionState": { + "name": "DataframeSelectionState", + "signature": "DataframeSelectionState", + "is_class": true, + "methods": [], + "source": "https://github.com/streamlit/streamlit/blob/1.36.0/lib/streamlit/elements/arrow.py#L90", + "example": "<p>The following example has multi-row and multi-column selections enabled.\nTry selecting some rows. To select multiple columns, hold <tt class=\"docutils literal\">Ctrl</tt> while\nselecting columns. Hold <tt class=\"docutils literal\">Shift</tt> to select a range of columns.</p>\n<pre class=\"doctest-block\">\nimport streamlit as st\nimport pandas as pd\nimport numpy as np\n\nif "df" not in st.session_state:\n st.session_state.df = pd.DataFrame(\n np.random.randn(12, 5), columns=["a", "b", "c", "d", "e"]\n )\n\nevent = st.dataframe(\n st.session_state.df,\n key="data",\n on_select="rerun",\n selection_mode=["multi-row", "multi-column"],\n)\n\nevent.selection\n</pre>\n<Cloud name=\"doc-dataframe-events-selection-state\" path=\"\" query=\"\" stylePlaceholder=\"height: 600px\" />", + "description": "<p>The schema for the dataframe selection state.</p>\n<p>The selection state is stored in a dictionary-like object that suports both\nkey and attribute notation. Selection states cannot be programmatically\nchanged or set through Session State.</p>\n<div class=\"admonition warning\">\n<p class=\"first admonition-title\">Warning</p>\n<p class=\"last\">If a user sorts a dataframe, row selections will be reset. If your\nusers need to sort and filter the dataframe to make selections, direct\nthem to use the search function in the dataframe toolbar instead.</p>\n</div>\n", + "args": [ + { + "name": "rows", + "type_name": "list[int]", + "is_optional": false, + "description": "<p>The selected rows, identified by their integer position. The integer\npositions match the original dataframe, even if the user sorts the\ndataframe in their browser. For a <tt class=\"docutils literal\">pandas.DataFrame</tt>, you can\nretrieve data from its interger position using methods like <tt class=\"docutils literal\">.iloc[]</tt>\nor <tt class=\"docutils literal\">.iat[]</tt>.</p>\n", + "default": null + }, + { + "name": "columns", + "type_name": "list[str]", + "is_optional": false, + "description": "<p>The selected columns, identified by their names.</p>\n", + "default": null + } + ], + "returns": [], + "is_attribute_dict": true + } } } diff --git a/python/tutorial-source/llm-18-lines-of-code/requirements.txt b/python/tutorial-source/llm-18-lines-of-code/requirements.txt index 923d818cc..c03758250 100644 --- a/python/tutorial-source/llm-18-lines-of-code/requirements.txt +++ b/python/tutorial-source/llm-18-lines-of-code/requirements.txt @@ -1,3 +1,3 @@ -streamlit>=1.34.0 +streamlit>=1.36.0 openai langchain diff --git a/scripts/build-search-index.js b/scripts/build-search-index.js index dde62ecb8..a92147add 100644 --- a/scripts/build-search-index.js +++ b/scripts/build-search-index.js @@ -13,15 +13,12 @@ const SKIP_THESE = [ "/500", "/develop/api-reference/caching-and-state/st.experimental_get_query_params", "/develop/api-reference/caching-and-state/st.experimental_set_query_params", - "/develop/api-reference/caching-and-state/st.cache", "/develop/api-reference/connections/st.connections.experimentalbaseconnection", "/develop/api-reference/connections/st.experimental_connection", "/develop/api-reference/caching-and-state/st.experimental_memo", "/develop/api-reference/caching-and-state/st.experimental_singleton", "/develop/api-reference/execution-flow/st.experimental_rerun", "/develop/api-reference/data/st.experimental_data_editor", - "/develop/concepts/architecture/st.cache", - "/develop/concepts/architecture/experimental-cache-primitives", "/develop/quick-reference/older-versions", ];