Skip to content

Commit f19fab9

Browse files
Release 1.42.0 (#1224)
* Update markdown table CSS * 1.42.0/auth (#1221) * Add pages and redirects * Update streamlit.json * Update experimental_user for Community Cloud * Update RefCards * Update user RefCard * Update streamlit.json * Typo and style * Move st.context * Update streamlit.json * Update streamlit.json * Update streamlit.json * Update streamlit.json * Authentication concept page * What's new, release notes, cheat sheet * Ref cards * Bump embedded app versions * Dataframe column sort and pin * Move authentication to separate PR * Authentication guide (#1225) * Authentication guide * Review edits * Add link to authenticatino guide
1 parent c98a2c4 commit f19fab9

File tree

45 files changed

+11417
-796
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

45 files changed

+11417
-796
lines changed

content/develop/api-reference/_index.md

Lines changed: 76 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -195,6 +195,29 @@ Display a horizontal rule.
195195
st.divider()
196196
```
197197

198+
</RefCard>
199+
<RefCard href="/develop/api-reference/text/st.help">
200+
201+
<h4>Get help</h4>
202+
203+
Display object’s doc string, nicely formatted.
204+
205+
```python
206+
st.help(st.write)
207+
st.help(pd.DataFrame)
208+
```
209+
210+
</RefCard>
211+
<RefCard href="/develop/api-reference/text/st.html">
212+
213+
<h4>Render HTML</h4>
214+
215+
Renders HTML strings to your app.
216+
217+
```python
218+
st.html("<p>Foo bar.</p>")
219+
```
220+
198221
</RefCard>
199222
</TileContainer>
200223

@@ -1891,6 +1914,47 @@ rain(emoji="🎈", font_size=54,
18911914

18921915
## App logic and configuration
18931916

1917+
### Authentication and user info
1918+
1919+
<br />
1920+
1921+
<TileContainer>
1922+
<RefCard href="/develop/api-reference/user/st.login">
1923+
1924+
<h4>Log in a user</h4>
1925+
1926+
`st.login()` starts an authentication flow with an identity provider.
1927+
1928+
```python
1929+
st.login()
1930+
```
1931+
1932+
</RefCard>
1933+
<RefCard href="/develop/api-reference/user/st.logout">
1934+
1935+
<h4>Log out a user</h4>
1936+
1937+
`st.logout()` removes a user's identity information.
1938+
1939+
```python
1940+
st.logout()
1941+
```
1942+
1943+
</RefCard>
1944+
<RefCard href="/develop/api-reference/user/st.user">
1945+
1946+
<h4>User info</h4>
1947+
1948+
`st.experimental_user` returns information about a logged-in user.
1949+
1950+
```python
1951+
if st.experimental_user.is_logged_in:
1952+
st.write(f"Welcome back, {st.experimental_user.name}!")
1953+
```
1954+
1955+
</RefCard>
1956+
</TileContainer>
1957+
18941958
### Navigation and pages
18951959

18961960
<br />
@@ -2152,6 +2216,18 @@ st.query_params[key] = value
21522216
st.query_params.clear()
21532217
```
21542218

2219+
</RefCard>
2220+
<RefCard href="/develop/api-reference/user/st.context">
2221+
2222+
<h4>Context</h4>
2223+
2224+
`st.context` provides a read-only interface to access cookies and headers.
2225+
2226+
```python
2227+
st.context.cookies
2228+
st.context.headers
2229+
```
2230+
21552231
</RefCard>
21562232

21572233
</TileContainer>
@@ -2370,62 +2446,6 @@ iframe(
23702446

23712447
</TileContainer>
23722448

2373-
### Utilities and user info
2374-
2375-
<br />
2376-
2377-
<TileContainer>
2378-
<RefCard href="/develop/api-reference/utilities/st.context">
2379-
2380-
<h4>Context</h4>
2381-
2382-
`st.context` provides a read-only interface to access cookies and headers.
2383-
2384-
```python
2385-
st.context.cookies
2386-
st.context.headers
2387-
```
2388-
2389-
</RefCard>
2390-
<RefCard href="/develop/api-reference/utilities/st.help">
2391-
2392-
<h4>Get help</h4>
2393-
2394-
Display object’s doc string, nicely formatted.
2395-
2396-
```python
2397-
st.help(st.write)
2398-
st.help(pd.DataFrame)
2399-
```
2400-
2401-
</RefCard>
2402-
<RefCard href="/develop/api-reference/utilities/st.html">
2403-
2404-
<h4>Render HTML</h4>
2405-
2406-
Renders HTML strings to your app.
2407-
2408-
```python
2409-
st.html("<p>Foo bar.</p>")
2410-
```
2411-
2412-
</RefCard>
2413-
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="full">
2414-
2415-
<h4>User info</h4>
2416-
2417-
`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.
2418-
2419-
```python
2420-
if st.experimental_user.email == "foo@corp.com":
2421-
st.write("Welcome back, ", st.experimental_user.email)
2422-
else:
2423-
st.write("You are not authorized to view this page.")
2424-
```
2425-
2426-
</RefCard>
2427-
</TileContainer>
2428-
24292449
### Configuration
24302450

24312451
<br />

content/develop/api-reference/caching-and-state/_index.md

Lines changed: 15 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,24 @@ def init_model():
4949

5050
</TileContainer>
5151

52-
## Manage state
52+
## Browser and server state
5353

5454
Streamlit re-executes your script with each user interaction. Widgets have built-in statefulness between reruns, but Session State lets you do more!
5555

5656
<TileContainer>
57-
<RefCard href="/develop/api-reference/caching-and-state/st.session_state" size="half" >
57+
<RefCard href="/develop/api-reference/utilities/st.context">
58+
59+
<h4>Context</h4>
60+
61+
`st.context` provides a read-only interface to access cookies and headers.
62+
63+
```python
64+
st.context.cookies
65+
st.context.headers
66+
```
67+
68+
</RefCard>
69+
<RefCard href="/develop/api-reference/caching-and-state/st.session_state">
5870

5971
<h4>Session State</h4>
6072

@@ -65,7 +77,7 @@ st.session_state["foo"] = "bar"
6577
```
6678

6779
</RefCard>
68-
<RefCard href="/develop/api-reference/caching-and-state/st.query_params" size="half">
80+
<RefCard href="/develop/api-reference/caching-and-state/st.query_params">
6981

7082
<h4>Query parameters</h4>
7183

@@ -84,39 +96,6 @@ st.query_params.clear()
8496

8597
<TileContainer>
8698

87-
<RefCard href="/develop/api-reference/caching-and-state/st.experimental_memo" deprecated={true}>
88-
89-
> This command was deprecated in version 1.18.0. Use `st.cache_data` instead.
90-
91-
<h4>Memo</h4>
92-
93-
Experimental function decorator to memoize function executions.
94-
95-
```python
96-
@st.experimental_memo
97-
def fetch_and_clean_data(url):
98-
# Fetch data from URL here, and then clean it up.
99-
return data
100-
```
101-
102-
</RefCard>
103-
104-
<RefCard href="/develop/api-reference/caching-and-state/st.experimental_singleton" deprecated={true}>
105-
106-
> This command was deprecated in version 1.18.0. Use `st.cache_resource` instead.
107-
108-
<h4>Singleton</h4>
109-
110-
Experimental function decorator to store singleton objects.
111-
112-
```python
113-
@st.experimental_singleton
114-
def get_database_session(url):
115-
# Create a database session object that points to the URL.
116-
return session
117-
```
118-
119-
</RefCard>
12099
<RefCard href="/develop/api-reference/caching-and-state/st.experimental_get_query_params" size="half" deprecated={true}>
121100

122101
<h4>Get query parameters</h4>

content/develop/api-reference/utilities/context.md renamed to content/develop/api-reference/caching-and-state/context.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
---
22
title: st.context
3-
slug: /develop/api-reference/utilities/st.context
3+
slug: /develop/api-reference/caching-and-state/st.context
44
description: st.context displays a read-only dict of cookies and headers
55
---
66

0 commit comments

Comments
 (0)