Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
streamlit>=1.49.0
streamlit-nightly
webvtt-py
29 changes: 29 additions & 0 deletions python/api-examples-source/data.multiselect_column_1.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
{
"category": [
["exploration", "visualization"],
["llm", "visualization"],
["exploration"],
],
}
)

st.data_editor(
data_df,
column_config={
"category": st.column_config.MultiselectColumn(
"App Categories",
help="The categories of the app",
options=[
"exploration",
"visualization",
"llm",
],
color=["#ffa421", "#803df5", "#00c0f2"],
format_func=lambda x: x.capitalize(),
),
},
)
24 changes: 24 additions & 0 deletions python/api-examples-source/data.multiselect_column_2.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pandas as pd
import streamlit as st

data_df = pd.DataFrame(
{
"category": [
["exploration", "visualization"],
["llm", "visualization"],
["exploration"],
],
}
)

st.dataframe(
data_df,
column_config={
"category": st.column_config.MultiselectColumn(
"App Categories",
options=["exploration", "visualization", "llm"],
color="primary",
format_func=lambda x: x.capitalize(),
),
},
)
13 changes: 13 additions & 0 deletions python/api-examples-source/data.table_confusion.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import pandas as pd
import streamlit as st

confusion_matrix = pd.DataFrame(
{
"Predicted Cat": [85, 3, 2, 1],
"Predicted Dog": [2, 78, 4, 0],
"Predicted Bird": [1, 5, 72, 3],
"Predicted Fish": [0, 2, 1, 89],
},
index=["Actual Cat", "Actual Dog", "Actual Bird", "Actual Fish"],
)
st.table(confusion_matrix)
14 changes: 14 additions & 0 deletions python/api-examples-source/data.table_horizontal_border.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import streamlit as st

product_data = {
"Product": [
":material/devices: Widget Pro",
":material/smart_toy: Smart Device",
":material/inventory: Premium Kit",
],
"Category": [":blue[Electronics]", ":green[IoT]", ":violet[Bundle]"],
"Stock": ["🟢 Full", "🟡 Low", "🔴 Empty"],
"Units sold": [1247, 892, 654],
"Revenue": [125000, 89000, 98000],
}
st.table(product_data, border="horizontal")
2 changes: 1 addition & 1 deletion python/api-examples-source/guides/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
2 changes: 1 addition & 1 deletion python/api-examples-source/hello/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ pandas==1.5.3
numpy==1.23.5
altair==4.2.0
pydeck==0.8.0
streamlit>=1.49.0
streamlit-nightly
15 changes: 15 additions & 0 deletions python/api-examples-source/layout.tabs3.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import streamlit as st

tab1, tab2, tab3 = st.tabs(
[":cat: Cat", ":dog: Dog", ":rainbow[Owl]"], default=":rainbow[Owl]"
)

with tab1:
st.header("A cat")
st.image("https://static.streamlit.io/examples/cat.jpg", width=200)
with tab2:
st.header("A dog")
st.image("https://static.streamlit.io/examples/dog.jpg", width=200)
with tab3:
st.header("An owl")
st.image("https://static.streamlit.io/examples/owl.jpg", width=200)
2 changes: 1 addition & 1 deletion python/api-examples-source/mpa-hello/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ numpy==1.23.5
altair==4.2.0
pydeck==0.8.0
opencv-python-headless==4.8.1.78
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
2 changes: 1 addition & 1 deletion python/api-examples-source/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -11,4 +11,4 @@ pydeck
Faker
openai
vega_datasets
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
streamlit>=1.49.0
streamlit-nightly
toml
sqlalchemy==1.4
duckdb
Expand Down
2 changes: 1 addition & 1 deletion python/api-examples-source/theming/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
streamlit>=1.49.0
streamlit-nightly
vega_datasets
altair==4.2.0
plotly==5.13.0
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
vega_datasets
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
Faker
streamlit>=1.49.0
streamlit-nightly
2 changes: 1 addition & 1 deletion python/api-examples-source/tutorials/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
6 changes: 6 additions & 0 deletions python/api-examples-source/widgets.audio_input_high_rate.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
import streamlit as st

audio_value = st.audio_input("Record high quality audio", sample_rate=48000)

if audio_value:
st.audio(audio_value)
2 changes: 1 addition & 1 deletion python/concept-source/requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
Original file line number Diff line number Diff line change
@@ -1 +1 @@
streamlit>=1.49.0
streamlit-nightly
File renamed without changes.
47 changes: 35 additions & 12 deletions python/generate.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import re

import docstring_parser
import stoutput
import directives.stoutput as stoutput
import streamlit
import streamlit.components.v1 as components
import streamlit.testing.v1.element_tree as element_tree
Expand Down Expand Up @@ -228,20 +228,43 @@ def parse_docstring(obj, docstring, description, is_class, is_class_method, is_p
except:
print(sig)
print(f"Can't find {param.arg_name} as an argument for {obj}")
arg_obj["description"] = (
parse_rst(param.description) if param.description else ""
) # Store the argument description (parsed from RST to HTML)
arg_obj["default"] = param.default # Store the default value

# Check if the argument is deprecated
if docstring_obj.deprecation:
match = re.search("``[^ `]*``", docstring_obj.deprecation.description)
if match is not None and match.group(0) == f"``{param.arg_name}``":
# Add the deprecated flag and the deprecation message to the argument object
# Check for inline deprecation directives within the parameter description
# and extract them before parsing the main description
param_description = param.description or ""
deprecation_text = None

if param_description and ".. deprecated::" in param_description:
# Extract the deprecation message from the parameter description
deprecation_match = re.search(r'\.\.[ ]*deprecated::[ ]*\n(.*?)(?=\n\n|\n[^ ]|\Z)', param_description, re.DOTALL | re.IGNORECASE)
if deprecation_match:
deprecation_text = deprecation_match.group(1).strip()
# Remove leading whitespace from each line to clean up the text
deprecation_lines = [line.strip() for line in deprecation_text.split('\n')]
deprecation_text = '\n'.join(line for line in deprecation_lines if line)

# Remove the entire deprecation directive from the parameter description
param_description = re.sub(r'\.\.[ ]*deprecated::.*?(?=\n\n|\n[^ ]|\Z)', '', param_description, flags=re.DOTALL | re.IGNORECASE).strip()

arg_obj["deprecated"] = {
"deprecated": True,
"deprecatedText": parse_rst(docstring_obj.deprecation.description),
"deprecatedText": parse_rst(deprecation_text),
}

arg_obj["description"] = (
parse_rst(param_description) if param_description else ""
) # Store the argument description (parsed from RST to HTML, with deprecation directive removed)
arg_obj["default"] = param.default # Store the default value

# Check if the argument is deprecated (original global deprecation check - commented out)
# if docstring_obj.deprecation:
# match = re.search("``[^ `]*``", docstring_obj.deprecation.description)
# if match is not None and match.group(0) == f"``{param.arg_name}``":
# # Add the deprecated flag and the deprecation message to the argument object
# arg_obj["deprecated"] = {
# "deprecated": True,
# "deprecatedText": parse_rst(docstring_obj.deprecation.description),
# }

# Append the argument object to the list of arguments
description["args"].append(arg_obj)

Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
streamlit>=1.49.0
streamlit-nightly
langchain-openai