Preface
Taipy is an open source Python library that allows users to build data applications and bring them to production environments. As an application builder, it offers a simple API to create dashboards, machine learning applications, chatbots, and many other types of applications.
What sets Taipy apart from other libraries is all the abstractions it brings to make your apps production-ready. For instance, the state management creates new user sessions, by default, for each new app connection, making it suitable for collaboration by design. It also brings abstractions to control the behavior of the page and its elements (you can activate and deactivate parts or the whole page, based on specific events), or to handle long-running callbacks without needing to manually handle async Python or threads.
On top of these abstractions, Taipy also brings Scenario Management capabilities that allow AB testing and scenario comparison, two common tasks in enterprise and BI environments. This book covers this concept extensively.
Finally, as Taipy is a Flask-based application builder, you can deploy it as any other Flask application in production environments.
This book has three distinct parts. First, we present the basic components of Taipy, from the main visual elements to how to set up complete Scenario Management pipelines and scenario comparison; this part also covers how to deploy your applications. In the next four chapters, we create more realistic applications of different types, such as time series analysis, optimization, and geographical or chatbot apps; the goal of this part is to give you use case ideas while helping you master the basic concepts and introducing advanced ones. The third and last part of the book focuses on advanced concepts and use cases to make the applications more efficient, or to use Taipy with edge cases, such as IoT components, or to handle large volumes of data.
Who this book is for
This book is for data analysts, data scientists, and BI experts who need to build complete data applications using Python. If your scripts and models aren't being used, Taipy helps you integrate them into applications for end users quickly and easily.
Whether you are creating prototypes, proofs of concept, or robust, scalable systems, Taipy can help you. This book will also be valuable for developers and engineers who want to streamline their data workflows without relying on a stack other than Python.
What this book covers
Chapter 1, Discovering Taipy, gives a broad overview of Taipy and its main components. This chapter guides you through installing Taipy and creating your first minimal applications.
Chapter 2, Creating User Interfaces with Taipy, shows you how to create a GUI with Taipy. You'll be able to create basic applications with Taipy thanks to this chapter alone!
Chapter 3, Connecting to Data Sources with Data Nodes, shows you how to use Data Nodes. Data Nodes provide an abstraction to connect with your data (inputs, outputs, and intermediate steps). They are important components of Scenario Management pipelines, but you can also use them alone.
Chapter 4, Orchestrating Taipy Applications, shows you how to create and orchestrate Scenario Management pipelines with Taipy. You'll learn how to configure and link Data Nodes and tasks together to create scenarios.
Chapter 5, Managing Scenarios with Taipy, explains how to use the scenarios and compare them to each other using a classic machine learning example.
Chapter 6, Deploying Your Taipy Applications, explains how to deploy Taipy applications in a variety of contexts, such as Linux-based servers, a cloud service (Google Cloud), and Docker containers.
Chapter 7, Taipy for Finance: Sales Forecasting and BI Reports, guides you through the steps to create a complete forecasting application. This example invites you to consider factors beyond Taipy's API that will contribute to your app's success (such as data modeling or how to choose your data sources). This example will also show you how to put time series models and comparison tools in the hands of final users.
Chapter 8, Taipy for Logistics: Creating Supply Chain Management Apps, illustrates the use of Taipy with optimization models. This guided tutorial shows how to use Taipy to set parameters and constraints to create optimal scenarios and compare the outcomes based on the assumptions.
Chapter 9, Taipy for Urban Planning: Creating a Satellite Image App, shows how to use Taipy with external compute servers (in this case, the European Space Agency) and how to compare scenarios based on satellite image data.
Chapter 10, Building an LLM Chatbot with Taipy, explains how to use Taipy to create a chatbot. You'll discover the chat visual element and ways to interact with LLMs from different UI components.
Chapter 11, Improving the Performance of Taipy Applications, shows methods and components you can use to make your applications run faster. We also cover components to use to run long-running callbacks to make your apps run smoothly.
Chapter 12, Handling Large Data in Taipy Applications, discusses how to use tools to handle large amounts of data with Taipy, including Spark or Dask. This chapter also shows you some options from Taipy charts that help you visualize large amounts of data effectively.
Chapter 13, Creating Real-Time Apps with Taipy, shows how to set up long-running callbacks to poll data, or even to stream it. This chapter shows how Taipy can adapt to different data acquisition and data update techniques, from batch updates for reporting to near-real-time and real-time applications for IoT or any real-time monitoring needs.
Chapter 14, Embedding Iframes in Taipy Applications, explains how to embed iframes in your Taipy applications. The use of iframes allows simple integrations (such as PDF documents or YouTube videos), but it also allows you to integrate Python libraries that output HTML components (such as Folium), and even to create your own custom JavaScript-based components.
Chapter 15, Exploring Taipy Designer (Enterprise Version), discusses Taipy Enterprise, the business subscription offer from Taipy. This chapter shows how to use Taipy Designer, a no-code component of Taipy Enterprise that allows users to create drag-and-drop UIs.
Chapter 16, Who Uses Taipy?, introduces you to three Taipy users. You'll discover projects that made it into production, and you'll see what users value the most when using Taipy.
To get the most out of this book
Taipy is a Python library designed for teams that manipulate data using Python to take their models, algorithms, and visual representations, and turn them into web applications that run in production environments for multiple users. Therefore, the only strong prerequisite is to know how to use Python.
Having some general knowledge of web development can certainly help, since Taipy apps can be styled using CSS (although this isn't strictly necessary). Chapter 6 assumes some knowledge of Linux systems, the cloud, and Docker, since it discusses deployment strategies. Some chapters use specialized libraries to create more realistic examples, but the book and the GitHub repo provide examples and comments to understand them.
Download the example code files
The code bundle for the book is hosted on GitHub at https://github.com/PacktPublishing/Getting-Started-with-Taipy.
We also have other code bundles from our rich catalog of books and videos available at https://github.com/PacktPublishing. Check them out!
Conventions used
There are a number of text conventions used throughout this book.
CodeInText: Indicates code words in text, database table names, folder names, filenames, file extensions, pathnames, dummy URLs, user input, and X/Twitter handles. For example: "A Gui object with a run method and some key settings."
A block of code is set as follows:
with tgb.Page() as hello_earth_python: tgb.text("# Hello Earth!", mode="md")
When we wish to draw your attention to a particular part of a code block, the relevant lines or items are set in bold:
import taipy as tp
from taipy...