Overview

1 Introduction to Streamlit

Streamlit lets you turn plain Python scripts into interactive, shareable web apps in minutes, removing the traditional barrier of having to learn HTML, CSS, and JavaScript. The chapter introduces graphical web apps and explains how Streamlit unifies backend logic and frontend UI in Python so ideas become usable tools quickly. It sets the stage for a hands-on, project-based journey—starting with simple utilities and progressing to dashboards and AI-powered apps—while teaching core skills like handling user input, app state, API calls, and maintainable UI design.

Streamlit’s popularity stems from its pure-Python workflow, rapid idea-to-app development, and attractive defaults that eliminate most UI busywork. Its concise, intuitive API keeps you focused on logic, not styling, and it pairs especially well with LLMs through built-in chat elements for conversational interfaces. Designed with data science in mind, it displays charts from popular plotting libraries and provides first-class support for Pandas dataframes. Sharing is straightforward via Streamlit’s free hosting option, and a large, helpful community plus third-party components extend what’s possible without abandoning Python.

The chapter also clarifies what to build—and what not to. Streamlit excels at data apps, AI tools, internal utilities, prototypes, and creative Python-powered experiences, but it’s not ideal for highly customized UIs, massive scale, or native desktop/mobile apps. It contrasts Streamlit with Jupyter (documents vs end-user apps), the raw web stack (Streamlit abstracts it), React (greater flexibility but steeper, non-Python), and backend frameworks like Flask/Django/FastAPI (which still require a separate frontend), as well as desktop GUI libraries such as Tkinter and PyQt. With these trade-offs in mind, the chapter invites you to dive into the basics and start building.

A Google Trends chart showing the popularity of Streamlit over time (note: the periodic dips near the end of each year correspond to the week between Christmas and New Year's Day, when I assume relatively few people are working).
Streamlit unlocks web app development for anyone who knows Python and helps even full-stack developers prototype and build faster.
Tabs in Streamlit, illustrating how Streamlit makes UI choices for you.
Output of a die roll simulator in Streamlit.
A complete AI chatbot in Streamlit.
A histogram in Streamlit created using the popular Matplotlib library
An editable Pandas dataframe as displayed in Streamlit (see chapter_01/data_editor_example.py in the GitHub repo).
Dungeon, a game created with Streamlit (https://dungeon.streamlit.app/) created by Tomasz Hasiów.

Summary

  • Streamlit is a framework for building web apps in pure Python without HTML, CSS, or JavaScript.
  • Streamlit has been gaining popularity due to its simplicity, development velocity, LLM support, powerful visualizations, and integration with data science libraries, among other features.
  • With Streamlit, you can create many types of applications: data apps, internal workplace tools, LLM apps, prototypes for larger apps, and more.
  • You shouldn't use Streamlit for large-scale apps meant for millions of users, or apps that require a high level of UI customization.

FAQ

What is Streamlit and what problem does it solve?Streamlit is a pure Python framework for building interactive web apps. It lets you create the UI and the app logic entirely in Python, removing the need to learn or write HTML, CSS, or JavaScript. In short, it turns Python scripts into clickable, shareable apps in minutes.
What do I need to build a web app, and where does Streamlit fit?A typical web app has a backend (logic, data, APIs) and a frontend (UI elements users interact with). Streamlit lets Python developers build both pieces in one place using Python, so you focus on your logic while Streamlit provides ready-made UI components.
Why is Streamlit so popular?Key reasons include: it’s pure Python; you can go from idea to working app in minutes; apps look good by default; it reduces UI decision fatigue so you can focus on logic; it’s LLM-friendly; it integrates with data/visualization libraries; it’s easy to share via Community Cloud; there’s a friendly community; and you can extend it with third-party components.
Do I need to know HTML, CSS, or JavaScript to use Streamlit?No. Streamlit abstracts away the web stack so you can write apps in Python only. For edge cases requiring fine-grained UI control, you can use Streamlit Components (built with web tech) or switch to a traditional frontend stack.
What kinds of apps can I build with Streamlit?Common categories include: data apps (dashboards, exploration, interactive visuals, ML model UIs); generative AI apps (e.g., chatbots backed by LLM APIs); internal tools (project dashboards, time tracking, scheduling, inventory, file converters); quick prototypes for larger products; and creative/novel apps limited only by what Python can do.
When should I not use Streamlit?It’s not ideal for: very large-scale apps with many concurrent users; apps needing highly customized, pixel-perfect UI/UX; and native desktop or mobile apps. Streamlit reruns your script on interactions, which can affect performance for heavy workloads (caching helps but isn’t universal).
How is Streamlit different from Jupyter notebooks?Notebooks are great for exploratory analysis and sharing interactive documents with code and outputs, mostly for technical audiences. Streamlit is for building polished, user-facing apps that don’t expose code, fit into engineering workflows, and are meant to be used by end users.
How is Streamlit different from Flask, Django, or FastAPI?Flask, Django, and FastAPI are primarily backend frameworks; you still craft the frontend with HTML/CSS/JS (or embed templates). Streamlit lets you build the UI in Python directly, dramatically reducing the amount of frontend code you need to write.
How is Streamlit different from React or from using HTML/CSS/JavaScript directly?React and the core web languages provide maximum flexibility but require frontend expertise and more boilerplate. Streamlit trades some fine-grained control for speed, simplicity, and Python-first development, while still producing attractive, interactive UIs.
Where can I find the chapter’s code and how do I try apps or share them?The book’s code is on GitHub at https://github.com/aneevdavis/streamlit-in-action (chapter_01 contains this chapter’s snippets). You can quickly share public apps using Streamlit Community Cloud by linking your GitHub repo. Installation and running instructions are covered later in the book.

pro $24.99 per month

  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose one free eBook per month to keep
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime

lite $19.99 per month

  • access to all Manning books, including MEAPs!

team

5, 10 or 20 seats+ for your team - learn more


choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build Python Web Apps with Streamlit ebook for free
choose your plan

team

monthly
annual
$49.99
$499.99
only $41.67 per month
  • five seats for your team
  • access to all Manning books, MEAPs, liveVideos, liveProjects, and audiobooks!
  • choose another free product every time you renew
  • choose twelve free products per year
  • exclusive 50% discount on all purchases
  • renews monthly, pause or cancel renewal anytime
  • renews annually, pause or cancel renewal anytime
  • Build Python Web Apps with Streamlit ebook for free