Skip to content

Commit

Permalink
Release 1.42.0 (#1224)
Browse files Browse the repository at this point in the history
* 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
  • Loading branch information
sfc-gh-dmatthews authored Feb 4, 2025
1 parent c98a2c4 commit f19fab9
Show file tree
Hide file tree
Showing 45 changed files with 11,417 additions and 796 deletions.
132 changes: 76 additions & 56 deletions content/develop/api-reference/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -195,6 +195,29 @@ Display a horizontal rule.
st.divider()
```

</RefCard>
<RefCard href="/develop/api-reference/text/st.help">

<h4>Get help</h4>

Display object’s doc string, nicely formatted.

```python
st.help(st.write)
st.help(pd.DataFrame)
```

</RefCard>
<RefCard href="/develop/api-reference/text/st.html">

<h4>Render HTML</h4>

Renders HTML strings to your app.

```python
st.html("<p>Foo bar.</p>")
```

</RefCard>
</TileContainer>

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

## App logic and configuration

### Authentication and user info

<br />

<TileContainer>
<RefCard href="/develop/api-reference/user/st.login">

<h4>Log in a user</h4>

`st.login()` starts an authentication flow with an identity provider.

```python
st.login()
```

</RefCard>
<RefCard href="/develop/api-reference/user/st.logout">

<h4>Log out a user</h4>

`st.logout()` removes a user's identity information.

```python
st.logout()
```

</RefCard>
<RefCard href="/develop/api-reference/user/st.user">

<h4>User info</h4>

`st.experimental_user` returns information about a logged-in user.

```python
if st.experimental_user.is_logged_in:
st.write(f"Welcome back, {st.experimental_user.name}!")
```

</RefCard>
</TileContainer>

### Navigation and pages

<br />
Expand Down Expand Up @@ -2152,6 +2216,18 @@ st.query_params[key] = value
st.query_params.clear()
```

</RefCard>
<RefCard href="/develop/api-reference/user/st.context">

<h4>Context</h4>

`st.context` provides a read-only interface to access cookies and headers.

```python
st.context.cookies
st.context.headers
```

</RefCard>

</TileContainer>
Expand Down Expand Up @@ -2370,62 +2446,6 @@ iframe(

</TileContainer>

### Utilities and user info

<br />

<TileContainer>
<RefCard href="/develop/api-reference/utilities/st.context">

<h4>Context</h4>

`st.context` provides a read-only interface to access cookies and headers.

```python
st.context.cookies
st.context.headers
```

</RefCard>
<RefCard href="/develop/api-reference/utilities/st.help">

<h4>Get help</h4>

Display object’s doc string, nicely formatted.

```python
st.help(st.write)
st.help(pd.DataFrame)
```

</RefCard>
<RefCard href="/develop/api-reference/utilities/st.html">

<h4>Render HTML</h4>

Renders HTML strings to your app.

```python
st.html("<p>Foo bar.</p>")
```

</RefCard>
<RefCard href="/develop/api-reference/utilities/st.experimental_user" size="full">

<h4>User info</h4>

`st.experimental_user` returns information about the logged-in user of private apps on Streamlit Community Cloud.

```python
if st.experimental_user.email == "[email protected]":
st.write("Welcome back, ", st.experimental_user.email)
else:
st.write("You are not authorized to view this page.")
```

</RefCard>
</TileContainer>

### Configuration

<br />
Expand Down
51 changes: 15 additions & 36 deletions content/develop/api-reference/caching-and-state/_index.md
Original file line number Diff line number Diff line change
Expand Up @@ -49,12 +49,24 @@ def init_model():

</TileContainer>

## Manage state
## Browser and server state

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

<TileContainer>
<RefCard href="/develop/api-reference/caching-and-state/st.session_state" size="half" >
<RefCard href="/develop/api-reference/utilities/st.context">

<h4>Context</h4>

`st.context` provides a read-only interface to access cookies and headers.

```python
st.context.cookies
st.context.headers
```

</RefCard>
<RefCard href="/develop/api-reference/caching-and-state/st.session_state">

<h4>Session State</h4>

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

</RefCard>
<RefCard href="/develop/api-reference/caching-and-state/st.query_params" size="half">
<RefCard href="/develop/api-reference/caching-and-state/st.query_params">

<h4>Query parameters</h4>

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

<TileContainer>

<RefCard href="/develop/api-reference/caching-and-state/st.experimental_memo" deprecated={true}>

> This command was deprecated in version 1.18.0. Use `st.cache_data` instead.
<h4>Memo</h4>

Experimental function decorator to memoize function executions.

```python
@st.experimental_memo
def fetch_and_clean_data(url):
# Fetch data from URL here, and then clean it up.
return data
```

</RefCard>

<RefCard href="/develop/api-reference/caching-and-state/st.experimental_singleton" deprecated={true}>

> This command was deprecated in version 1.18.0. Use `st.cache_resource` instead.
<h4>Singleton</h4>

Experimental function decorator to store singleton objects.

```python
@st.experimental_singleton
def get_database_session(url):
# Create a database session object that points to the URL.
return session
```

</RefCard>
<RefCard href="/develop/api-reference/caching-and-state/st.experimental_get_query_params" size="half" deprecated={true}>

<h4>Get query parameters</h4>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
title: st.context
slug: /develop/api-reference/utilities/st.context
slug: /develop/api-reference/caching-and-state/st.context
description: st.context displays a read-only dict of cookies and headers
---

Expand Down
Loading

0 comments on commit f19fab9

Please sign in to comment.