视觉画布设计
canvas-design
基于设计原则创作静态视觉作品,用于海报与品牌图形。
using-streamlit-cli【文档与办公】Documents Streamlit CLI commands for running apps, managing configuration, and diagnostics. Use when starting Streamlit apps, configuring runtime options, or troubleshooting CLI issues.
独立 GitHub 快照 · 自动分类 · 以原作者文档为准
The Streamlit CLI is the primary tool for running Streamlit applications and managing configuration. This skill covers all essential commands and configuration options.
streamlit run [<entrypoint>] [-- config options] [script args]
| Argument | Behavior |
|---|---|
| (none) | Looks for streamlit_app.py in current directory |
| Directory path | Runs streamlit_app.py within that directory |
| File path | Runs the specified file directly |
| URL | Runs a remote script (e.g., from GitHub) |
# Run default app in current directory
streamlit run
# Run a specific file
streamlit run app.py
# Run from a URL
streamlit run https://raw.githubusercontent.com/streamlit/demo-uber-nyc-pickups/master/streamlit_app.py
# Alternative: run as Python module (useful for IDE configuration)
python -m streamlit run app.py
uv (recommended)Use uv run to run Streamlit in a virtual environment with automatic dependency management:
# Run with uv (automatically uses/creates virtual environment)
uv run streamlit run app.py
# With configuration options
uv run streamlit run app.py --server.headless=true
# With script arguments
uv run streamlit run app.py -- arg1 arg2
Using uv run is the recommended approach because it:
pyproject.tomlstreamlit runConfiguration options follow the pattern --<section>.<option>=<value> and must come after the script name.
Recommendation: For persistent configuration, use
.streamlit/config.tomlin your project directory instead of command-line flags. This keeps your run command simple and makes configuration easier to manage and share with your team.
streamlit run app.py --server.port=8080
streamlit run app.py --server.headless=true
streamlit run app.py --server.runOnSave=true
streamlit run app.py --server.address=0.0.0.0
streamlit run app.py --client.showErrorDetails=false
streamlit run app.py --theme.primaryColor=blue
streamlit run app.py \
--server.port=8080 \
--server.headless=true \
--theme.primaryColor=blue \
--client.showErrorDetails=false
Script arguments come after configuration options. Use sys.argv to access them:
streamlit run app.py -- arg1 arg2 "arg with spaces"
In your script:
import sys
# sys.argv[0] = script path
# sys.argv[1:] = your arguments
args = sys.argv[1:]
# Show all current configuration settings
streamlit config show
# Clear all cached data from disk
streamlit cache clear
# Show installed version
streamlit version
# List all available commands
streamlit help
# Open documentation in browser
streamlit docs
# Create starter files for a new project
streamlit init
# Launch the Streamlit demo application
streamlit hello
Configuration can be set in multiple places. Order of precedence (highest to lowest):
--server.port=8080)STREAMLIT_SERVER_PORT=8080).streamlit/config.toml in project directory)~/.streamlit/config.toml)