LinuxCommandLibrary

streamlit

Run Streamlit applications

TLDR

Check for the Streamlit installation

$ streamlit hello
copy

Run your Streamlit application
$ streamlit run [project_name]
copy

Display help
$ streamlit --help
copy

Display version
$ streamlit --version
copy

SYNOPSIS

streamlit command [options] [arguments]

The most common usage is:
streamlit run your_script.py [script_arguments] [options]

PARAMETERS

--server.port
    Sets the port on which the Streamlit app will run (default: 8501).

--server.headless
    Controls whether to automatically open the browser when the app starts (default: false).

--server.enableCORS
    Enables or disables Cross-Origin Resource Sharing (CORS) for the server (default: true).

--global.logLevel
    Sets the logging level (e.g., info, warning, error, debug).

--browser.gatherUsageStats
    Allows or disallows Streamlit to send usage statistics to improve the product (default: true).

--browser.serverAddress


    Sets the address the browser should connect to if different from the server address.

--script-args
    Arguments to be passed directly to the Python script. These must follow the script path and any Streamlit options.

--help
    Shows help message and exits for the command or subcommand.

DESCRIPTION

Streamlit is an open-source Python library that transforms data scripts into interactive web applications. Designed for machine learning engineers and data scientists, it enables rapid prototyping and deployment of data-driven dashboards, ML tools, and data visualizations without requiring front-end development expertise. Users write pure Python scripts, and Streamlit automatically renders widgets and displays outputs in a responsive web interface. The streamlit command-line tool serves as the primary interface for running these applications, managing configurations, and accessing documentation. It simplifies the process of creating and sharing interactive data products, bridging the gap between data analysis and deployable applications.

CAVEATS

Streamlit applications require Python and the streamlit library to be installed in the environment. While powerful for rapid development, it is opinionated and optimized for data-centric applications, which might not suit general-purpose web development or highly custom UI designs. Performance of the application heavily depends on the efficiency of the underlying Python script. Sharing applications beyond local development often requires deployment solutions like Streamlit Cloud, Docker, or other web servers.

SUBCOMMANDS

Beyond run, the streamlit command supports several other subcommands:
hello: Runs a demo Streamlit app to showcase its capabilities.
config show: Displays the current Streamlit configuration.
cache clear: Clears the Streamlit cache directory.
docs: Opens the Streamlit documentation in a web browser.
community: Opens the Streamlit community forum in a web browser.
healthz: Performs a health check on the Streamlit server.

CONFIGURATION FILES

Streamlit's behavior can be customized via configuration files, typically located at ~/.streamlit/config.toml. These files allow setting default values for server, browser, and global options, providing a persistent way to manage application settings without always using command-line flags.

DEPLOYMENT

For sharing Streamlit apps with a wider audience, various deployment strategies are available. Streamlit Cloud offers a managed service for deploying and sharing apps directly from GitHub repositories. Alternatively, apps can be deployed using Docker, Kubernetes, or served via traditional web servers like Nginx/Apache in conjunction with a WSGI server, allowing for flexible hosting solutions.

HISTORY

Streamlit was founded by Adrien Gaidon, Thiago Teixeira, and Amanda Kelly, officially launching in October 2019. Its creation stemmed from the desire to simplify the process for machine learning engineers and data scientists to build and share interactive applications without extensive web development knowledge. The project quickly gained traction within the data community due to its ease of use and Python-centric approach. In March 2022, Streamlit was acquired by Snowflake, a cloud data warehousing company, further cementing its role in the data ecosystem and signaling a commitment to integrating powerful data application capabilities with cloud data platforms.

SEE ALSO

python(1), pip(1), dash(1), jupyter(1)

Copied to clipboard