Skip to content

[WIP] IA: Develop and Deploy #1000

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 50 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
5e577e8
Use _index.md for category page file
sfc-gh-dmatthews Mar 14, 2024
d13331a
Create Develop and Deploy categories
sfc-gh-dmatthews Mar 14, 2024
f0dba3a
Add deployment concepts stubs
sfc-gh-dmatthews Mar 14, 2024
3216855
Move custom components
sfc-gh-dmatthews Mar 14, 2024
a1dfcd7
Move component reference & regroup concepts
sfc-gh-dmatthews Mar 16, 2024
64b7bd2
Autofunction option: show experimental precursor
sfc-gh-dmatthews Mar 17, 2024
dc988fc
Configuration and secrets stubs
sfc-gh-dmatthews Mar 17, 2024
1394363
Remove duplicate experimental features
sfc-gh-dmatthews Mar 17, 2024
f8cbf1d
Remove personalization
sfc-gh-dmatthews Mar 17, 2024
f9d7136
Additional stubs; logical design grouping
sfc-gh-dmatthews Mar 17, 2024
5262067
Update package-lock.json
sfc-gh-dmatthews Mar 17, 2024
68931b2
Move quick references
sfc-gh-dmatthews Mar 17, 2024
f13cae5
A-z function index stub
sfc-gh-dmatthews Mar 17, 2024
9ff78e3
Revert "Autofunction option: show experimental precursor"
sfc-gh-dmatthews Mar 20, 2024
3452a2e
Merge branch 'main' into ia/develop-deploy
sfc-gh-dmatthews Mar 20, 2024
7db2450
Update Autofunction ancestor -> oldName
sfc-gh-dmatthews Mar 20, 2024
812d667
Update menu categories
sfc-gh-dmatthews Mar 20, 2024
8502f6a
Move KB articles to main content
sfc-gh-dmatthews Mar 20, 2024
30e3e2e
Add server-client architecture page
sfc-gh-dmatthews Mar 20, 2024
10de846
Revert "Update package-lock.json"
sfc-gh-dmatthews Mar 21, 2024
0cbced8
Merge branch 'main' into ia/develop-deploy
sfc-gh-dmatthews Mar 21, 2024
a7c7c6c
Add command line category to API reference
sfc-gh-dmatthews Mar 22, 2024
ed34b16
Update multipage guide
sfc-gh-dmatthews Mar 22, 2024
92427cf
Update concepts index page
sfc-gh-dmatthews Mar 23, 2024
fc36d9b
Merge branch 'main' into ia/develop-deploy
sfc-gh-dmatthews Mar 23, 2024
f9eb300
Update Develop, Deploy, KB category pages
sfc-gh-dmatthews Mar 23, 2024
db3a703
Remove manual redirect to API reference
sfc-gh-dmatthews Mar 23, 2024
bbd09a4
Rename deployment concepts
sfc-gh-dmatthews Mar 23, 2024
2a5052d
Update deploy/concepts/dependencies
sfc-gh-dmatthews Mar 24, 2024
a1b0a8a
Update deploy/concepts/secrets
sfc-gh-dmatthews Mar 24, 2024
0070894
Update Deployment concepts category page
sfc-gh-dmatthews Mar 24, 2024
b1f8b0d
Remove A-Z stub and duplicate KB article
sfc-gh-dmatthews Mar 24, 2024
8f847b7
Update API category pages
sfc-gh-dmatthews Mar 24, 2024
e45a9d6
Update streamlit run command reference
sfc-gh-dmatthews Mar 24, 2024
ff00f43
Update secrets reference pages
sfc-gh-dmatthews Mar 24, 2024
912b19a
Merge branch 'main' into ia/develop-deploy
sfc-gh-dmatthews Mar 26, 2024
469f048
Adjust widget API cards for consistency
sfc-gh-dmatthews Mar 27, 2024
dbee2d2
Update homepage and API reference page
sfc-gh-dmatthews Mar 27, 2024
e476e5c
Update category pages
sfc-gh-dmatthews Mar 27, 2024
3fc226f
Update Quick reference category
sfc-gh-dmatthews Mar 27, 2024
15a0c8f
Update menu.md
sfc-gh-dmatthews Mar 28, 2024
ee12f73
Regroup caching, state, navigation, flow
sfc-gh-dmatthews Mar 28, 2024
3db8067
Elements & UI -> App design
sfc-gh-dmatthews Apr 3, 2024
13fced4
Execution model -> architecture
sfc-gh-dmatthews Apr 3, 2024
783ba59
Update animate elements
sfc-gh-dmatthews Apr 3, 2024
939c591
Remove get/set option
sfc-gh-dmatthews Apr 3, 2024
607ef56
Update menu.md
sfc-gh-dmatthews Apr 3, 2024
d25dd10
Readd menu dividers
sfc-gh-dmatthews Apr 3, 2024
702a988
Merge branch 'main' into ia/develop-deploy
sfc-gh-dmatthews Apr 3, 2024
126b8ee
Update category pages
sfc-gh-dmatthews Apr 3, 2024
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
16 changes: 8 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ Do you want to add a new page to the docs?

1. First, decide which section the page should live in (Streamlit Library, Streamlit Community Cloud, or Knowledge Base).

2. Next, navigate to the relevant folder and subfolder within `content/` and create a `.md` file whose filename mirrors the title of the page. E.g. For a page titled "Create a component", navigate to `content/library/components/` and create a file named `create-component.md`.
2. Next, navigate to the relevant folder and subfolder within `content/` and create a `.md` file whose filename mirrors the title of the page. E.g. For a page titled "Create a component", navigate to `content/develop/concepts/custom-components/` and create a file named `create-component.md`.

### Structure of the `.md` file

Expand All @@ -159,12 +159,12 @@ Now that you've decided where the file should live and have named the file, it's

Every `.md` file has front matter at the very top that defines the page title which appears in the browser tab bar, and the URL slug which appears after the slash in `docs.streamlit.io/` and `localhost:3000/`.

E.g. For a page titled "Create a component" that should exist at `docs.streamlit.io/library/components/create`, the front matter at the top of `create-component.md` is:
E.g. For a page titled "Create a component" that should exist at `docs.streamlit.io/develop/concepts/custom-components/create`, the front matter at the top of `create-component.md` is:

```markdown
---
title: Create a Component
slug: /library/components/create
slug: /develop/concepts/custom-components/create
---
```

Expand Down Expand Up @@ -272,27 +272,27 @@ If you need to regenerate all function signatures, across all versions, delete t
Suppose a new Streamlit release includes a `st.my_chart` function that you want to include in the "Chart elements" section of the API Reference:

1. Run `make docstrings`
2. Create Markdown file (`my_chart.md`) in `content/library/api/charts/`
2. Create Markdown file (`my_chart.md`) in `content/develop/api/charts/`
3. Add the following to `my_chart.md`:

```markdown
---
title: st.my_chart
slug: /library/api-reference/charts/st.my_chart
slug: /develop/api-reference/charts/st.my_chart
---

<Autofunction function="streamlit.my_chart" />
```

4. Add the following under the "Chart elements" heading in `content/library/api/api-reference.md`:
4. Add the following under the "Chart elements" heading in `content/develop/api/api-reference.md`:
1. A RefCard MDX function containing the URL slug defined in `my_chart.md` . This is the card that will appear on the API Reference landing page.
2. An Image MDX function containing alt text and the location of the image to be displayed on the card.
3. A bold heading that will appear on the card (`#### Heading`). It appears below the card image.
4. A brief description of the `st.my_chart` . It appears below the card heading.
5. A code block illustrating how to use `st.my_chart`. It appears below the card description and has a Copy icon that when clicked copies the code block to the users' clipboard.

````markdown
<RefCard href="/library/api-reference/charts/st.my_chart">
<RefCard href="/develop/api-reference/charts/st.my_chart">
<Image pure alt="Tux, the Linux mascot" src="/img/data-table.png" />

#### My charts
Expand All @@ -310,7 +310,7 @@ Suppose a new Streamlit release includes a `st.my_chart` function that you want

```YAML
- category: Streamlit Library / API Reference / Chart elements / st.my_chart
url: /library/api-reference/charts/st.my_chart
url: /develop/api-reference/charts/st.my_chart
```

6. Save your changes and refresh the browser tab. If all went well, you should see a new entry in the Menu, a new card in the API Reference, and a new page for `st.my_chart`.
Expand Down
12 changes: 3 additions & 9 deletions components/navigation/navItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,9 @@ const NavItem = ({ page, slug, condensed, className }) => {
if (page.url.startsWith("/")) {
navItem = (
<li className={styles.NavItem} id={page.menu_key}>
{page.url === "/library" ? (
<a href={page.url} className="not-link">
{navBox}
</a>
) : (
<Link className="not-link" href={page.url}>
{navBox}
</Link>
)}
<Link className="not-link" href={page.url}>
{navBox}
</Link>
{subNav}
</li>
);
Expand Down
2 changes: 1 addition & 1 deletion components/summaryTiles.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ const SummaryTiles = () => {
title="API reference"
text="Learn about our APIs, with actionable explanations of specific functions and features."
background="indigo-70"
link="/library/api-reference"
link="/develop/api-reference"
/>

<Tile
Expand Down
35 changes: 35 additions & 0 deletions content/deploy/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---
title: Deploy
slug: /deploy
---

# Deploy

Get all the information you need to deploy your app and share it with your users.

<InlineCalloutContainer>
<InlineCallout
color="lightBlue-70"
icon="book"
bold="Concepts."
href="/deploy/concepts"
>Understand the basics of app deployment.</InlineCallout>
<InlineCallout
color="lightBlue-70"
icon="cloud"
bold="Streamlit Community Cloud."
href="/deploy/streamlit-community-cloud"
>Deploy your app on our free platform and join a community of developers who share their apps around the world.</InlineCallout>
<InlineCallout
color="lightBlue-70"
icon="ac_unit"
bold="Streamlit in Snowflake"
href="https://docs.snowflake.com/developer-guide/streamlit/about-streamlit"
>Deploy your app in Snowflake to enjoy a role-based access controlled environment with all your data in one unified, global system.</InlineCallout>
<InlineCallout
color="lightBlue-70"
icon="bolt"
bold="Other platforms."
href="/develop/quick-reference"
>Learn how to deploy your on a variety of platforms with our convenient collection of tutorials.</InlineCallout>
</InlineCalloutContainer>
29 changes: 29 additions & 0 deletions content/deploy/concepts/_index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
title: Deployment concepts
slug: /deploy/concepts
---

# Deployment concepts

Learn the fundamental concepts of app deployment. There are three main processes involved in deploying apps.

- Install Python, Streamlit, and other dependencies in your deployment environment.
- Securely handle your secrets and private information.
- Remote start your app (`streamlit run`).

If you're using Streamlit Community Cloud, we'll do most of the work for you!

<InlineCalloutContainer>
<InlineCallout
color="lightBlue-70"
icon="build_circle"
bold="Dependencies."
href="/deploy/concepts/dependencies"
>Understand the basics of configuring your deployment environment.</InlineCallout>
<InlineCallout
color="lightBlue-70"
icon="password"
bold="Secrets."
href="/deploy/concepts/secrets"
>Understand the basics of secret management.</InlineCallout>
</InlineCalloutContainer>
55 changes: 55 additions & 0 deletions content/deploy/concepts/dependencies.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
---
title: Managing dependencies when deploying your app
slug: /deploy/concepts/dependencies
---

# Managing dependencies when deploying your app

Before you began developing your app, you set up and configured your development environment by installing Python and Streamlit. When you deploy your app, you need to set up and configure your deploymnet environment in the same way. When you deploy your app to a cloud service, your app's [Python server](/develop/concepts/architecture/architecture#python-backend-server) will be running on a remote machine. This remote machine will not have access all the files and programs on your personal computer.

All Streamlit apps have at least two dependencies: Python and Streamlit. Your app may have additional dependencies in the form of Python packages or software that must be installed to properly execute your script. If you are using a service like Streamlit Community Cloud which is designed for Streamlit apps, we'll take care of Python and Streamlit for you!

## Install Python and other software

If you are using Streamlit Community Cloud, Python is already installed. You can just pick the version in the deployment dialog. If you need to install Python yourself or you have other non-Python software to install, follow your platform's instructions to install additional software. You will commonly use a package management tool to do this.
For example, Streamlit Community Cloud uses Advanced Package Tool (`apt`) for Debian-based Linux systems. For more information about installing non-Python depencies on Streamlit Community Cloud, see [`apt-get` dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#apt-get-dependencies).

## Install Python packages

Once you have Python installed in your deployment environment, you'll need to install all the necessary Python packages, including Streamlit! With each `import` of an installed package, you add a Python dependency to your script. You need to install those dependencies in your deployment environment through a Python package manager.

If you are using Streamlit Community Cloud, you'll have the latest version of Streamlit and all of its dependencies installed by default. So, if you're making a simple app and don't need additional dependencies, you won't have to do anything at all!

### `pip` and `requirements.txt`

Since `pip` comes by default with Python, the most common way to configure your Python environment is with a `requirements.txt` file. Each line of a `requirements.txt` file is a package to `pip install`. You should _not_ include <a href="https://docs.python.org/3/py-modindex.html" target="_blank">built-in Python libraries</a> like `math` or `random` in your `requirements.txt` file. These are a part of Python and aren't installed separately.

If you have a script like the following, you would only need to install Streamlit. No extra dependencies would be needed since `pandas` and `numpy` are installed as direct dependencies of `streamlit`. Similarly, `math` and `random` are built into Python.

```python
import streamlit as st
import pandas as pd
import numpy as np
import math
import random

st.write('Hi!')
```

However, it's a best practice accurately record pacakges you use, so the recommended `requirements.txt` file would be:

```none
streamlit
pandas
numpy
```

If you needed to specify certain versions, another valid example would be:

```none
streamlit==1.24.1
pandas>2.0
numpy<=1.25.1
```

A `requirements.txt` file is commonly saved in the root of your repository or file directory. If you are using Streamlit Community Cloud, see [Add Python dependencies](/deploy/streamlit-community-cloud/deploy-your-app/app-dependencies#add-python-dependencies) for more information. Othwerwise, check your platform's documentation.
14 changes: 14 additions & 0 deletions content/deploy/concepts/secrets.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
---
title: Managing secrets when deploying your app
slug: /deploy/concepts/secrets
---

# Managing secrets when deploying your app

If you are connecting to data sources or external services, you will likely be handling secret information like credentials or keys. Secret information should be stored and transmitted in a secure manner. When you deploy your app, ensure that you understand your platform's features and mechanisms for handling secrets so you can follow best practice.

Avoid saving secrets directly in your code and keep `.gitignore` updated to prevent accidentally committing a local secret to your repository. For helpful reminders, see [Security reminders](/develop/concepts/connections/security-reminders).

If you are using Streamlit Community Cloud, [Secrets management](/deploy/streamlit-community-cloud/deploy-your-app/secrets-management) allows you save environment variables and store secrets outside of your code. If you are using another platform designed for Streamlit, check if they have a built-in mechanism for working with `st.secrets` or securely uploading your `secrets.toml` file.

For information about using `st.connection` with environment variables, see [Global secrets, managing multiple apps and multiple data stores](/develop/concepts/connections/connecting-to-data#global-secrets-managing-multiple-apps-and-multiple-data-stores).
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
---
title: Get started
title: Get started with Streamlit
slug: /get-started
---

# Get started
# Get started with Streamlit

This Get Started guide explains how Streamlit works, how to install Streamlit on your preferred
operating system, and how to create your first Streamlit app!
Expand All @@ -24,7 +24,7 @@ operating system, and how to create your first Streamlit app!
<InlineCallout
color="orange-70"
icon="auto_awesome"
bold="Tutorials"
bold="First steps"
href="/get-started/tutorials"
>walks you through creating apps using core features to fetch and cache data, draw charts, plot information on a map, and use interactive widgets to filter results.</InlineCallout>
<InlineCallout
Expand Down
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
---
title: Fundamentals
title: Fundamental concepts
slug: /get-started/fundamentals
---

# Fundamentals
# Fundamental concepts

Are you new to Streamlit and want the grand tour? If so, you're in the right place!

<InlineCalloutContainer>
<InlineCallout
color="orange-70"
icon="description"
bold="Main concepts."
bold="Basic concepts."
href="/get-started/fundamentals/main-concepts"
>Learn the fundamental concepts of Streamlit. How is a Streamlit app structured? How does it run? How does it magically get your data on a webpage?</InlineCallout>
<InlineCallout
Expand Down
14 changes: 7 additions & 7 deletions content/get-started/fundamentals/additional-features.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ slug: /get-started/fundamentals/additional-features

# Additional Streamlit features

So you've read all about Streamlit's [Main concepts](/get-started/fundamentals/main-concepts) and gotten a tase of caching and Session State in [Advanced concepts](/get-started/fundamentals/advanced-concepts). But what about the bells and whistles? Here's a quick look at some extra features to take your app to the next level.
So you've read all about Streamlit's [Basic concepts](/get-started/fundamentals/main-concepts) and gotten a tase of caching and Session State in [Advanced concepts](/get-started/fundamentals/advanced-concepts). But what about the bells and whistles? Here's a quick look at some extra features to take your app to the next level.

## Theming

Expand All @@ -25,13 +25,13 @@ out different colors and see your app update live.
![Editing Themes](/images/edit_theme.gif)

When you're happy with your work, themes can be saved by
[setting config options](/library/advanced-features/configuration#set-configuration-options)
[setting config options](/develop/concepts/configuration#set-configuration-options)
in the `[theme]` config section. After you've defined a theme for your app, it
will appear as "Custom Theme" in the theme selector and will be applied by
default instead of the included Light and Dark themes.

More information about the options available when defining a theme can be found
in the [theme option documentation](/library/advanced-features/theming).
in the [theme option documentation](/develop/concepts/configuration/theming).

<Note>

Expand Down Expand Up @@ -101,11 +101,11 @@ Now run `streamlit run main_page.py` and view your shiny new multipage app!

<Image src="/images/mpa-main-concepts.gif" />

Our documentation on [Multipage apps](/library/advanced-features/multipage-apps) teaches you how to add pages to your app, including how to define pages, structure and run multipage apps, and navigate between pages. Once you understand the basics, [create your first multipage app](/get-started/tutorials/create-a-multipage-app)!
Our documentation on [Multipage apps](/develop/concepts/multipage-apps) teaches you how to add pages to your app, including how to define pages, structure and run multipage apps, and navigate between pages. Once you understand the basics, [create your first multipage app](/get-started/tutorials/create-a-multipage-app)!

## Custom components

If you can't find the right component within the Streamlit library, try out custom components to extend Streamlit's built-in functionality. Explore and browse through popular, community-created components in the [Components gallery](https://streamlit.io/components). If you dabble in frontend development, you can build your own custom component with Streamlit's [components API](/library/components/components-api).
If you can't find the right component within the Streamlit library, try out custom components to extend Streamlit's built-in functionality. Explore and browse through popular, community-created components in the [Components gallery](https://streamlit.io/components). If you dabble in frontend development, you can build your own custom component with Streamlit's [components API](/develop/concepts/custom-components/intro).

## Static file serving

Expand All @@ -118,8 +118,8 @@ your-project/
└── streamlit_app.py
```

To learn more, read our guide on [Static file serving](/library/advanced-features/static-file-serving).
To learn more, read our guide on [Static file serving](/develop/concepts/configuration/static-file-serving).

## App testing

Good development hygeine includes testing your code. Automated testing allows you to write higher quality code, faster! Streamlit has a built-in testing framework that let's you build tests easily. Use your favorite testing framework to run your tests. We like [`pytest`](https://pypi.org/project/pytest/). When you test a Streamlit app, you simulate running the app, declare user input, and inspect the results. You can use GitHub workflows to automate your tests and get instant alerts about breaking changes. Learn more in our guide to [App testing](/library/advanced-features/app-testing).
Good development hygeine includes testing your code. Automated testing allows you to write higher quality code, faster! Streamlit has a built-in testing framework that let's you build tests easily. Use your favorite testing framework to run your tests. We like [`pytest`](https://pypi.org/project/pytest/). When you test a Streamlit app, you simulate running the app, declare user input, and inspect the results. You can use GitHub workflows to automate your tests and get instant alerts about breaking changes. Learn more in our guide to [App testing](/develop/concepts/app-testing).
Loading