用于快速构建 基于python的web应用

Fred Lefévère-Laoide cd8ff7ae29 ignore windows + python 3.8 1 rok pred
.github cd8ff7ae29 ignore windows + python 3.8 1 rok pred
doc f72870948e hopefully fix PytestUnknownMarkWarning 1 rok pred
frontend 50ff164131 build frontend bundles before tests 1 rok pred
readme_img e1243292c6 Last change from comment 1 rok pred
taipy dde5e7ccd2 Remove taipy/config/tests/folder that have already been moved in taipy/tests/config 1 rok pred
tests 4ac800e5d9 fix: remove unnecessary sample.json file 1 rok pred
tools b4702ac688 using subprocess on all platform 1 rok pred
.editorconfig 41469f5724 feat(ScenarioSelector): adjust and improve styles (#138) 2 rokov pred
.flake8 2c82477fe2 fix typing for taipy.run (#85) 2 rokov pred
.gitattributes 7f0b872e89 Add taipy-rest package (#13) 3 rokov pred
.gitignore 9e8e2510b2 Datanode viewer: Refresh data and history tabs if needed (#353) 1 rok pred
.license-header 571c632d7a chore: update licence year 2 rokov pred
.pre-commit-config.yaml 70238d6ac8 feat: add linter workflow 2 rokov pred
CODE_OF_CONDUCT.md 571c461f13 add CONTRIBUTING.md and CODE_OF_CONDUCT.md 3 rokov pred
CONTRIBUTING.md f86b207630 propagate changes on shared file. 2 rokov pred
LICENSE 571c632d7a chore: update licence year 2 rokov pred
MANIFEST.in 5b5a7fd4ce test global packaging and prepare individual packaging 1 rok pred
Pipfile dbde75526f compile dependencies 1 rok pred
README.md c1abc684eb fix deadlink on README 1 rok pred
contributors.txt e984b7f7a7 Update contributors.txt 1 rok pred
mypy.ini 2c82477fe2 fix typing for taipy.run (#85) 2 rokov pred
pyproject.toml 2c82477fe2 fix typing for taipy.run (#85) 2 rokov pred
pytest.ini f72870948e hopefully fix PytestUnknownMarkWarning 1 rok pred
setup.py c2932d0de6 pycodestyle 1 rok pred
tox.ini 5787554dca install tox dependencies for tests env 1 rok pred

README.md



Taipy Logo


Taipy -Your Web Application Builder. Pure Python.

<a href="https://pypi.python.org/pypi/taipy/" alt="Taipy version">
    <img alt="PyPI" src="https://img.shields.io/pypi/v/taipy.svg?label=pip&logo=PyPI&color=ff462b&labelColor=283282"></a>
<a href="https://pypi.org/project/taipy" alt="Python version">
    <img alt="PyPI" src="https://img.shields.io/pypi/pyversions/taipy?color=ff462b&labelColor=283282"></a>
<a href="https://www.youtube.com/@taipy8009" alt="YouTube">
    <img src="https://img.shields.io/badge/youtube-click_to_watch_videos-red.svg?color=ff462b&labelColor=283282&logo=youtube" /></a>
 <a href="https://twitter.com/Taipy_io" alt="Twitter">
    <img src="https://img.shields.io/badge/twitter-click_for_tweets-red.svg?color=ff462b&labelColor=283282&logo=twitter" /></a>


Taipy is an open-source Python library for building your web application front-end & back-end.

Turns data and AI algorithms into production-ready web applications in no time.


📊 We make both ends meet ⚙️


User Interface Generation Scenario and Data Management
Interface Animation Back-End Animation



Installation

Open a terminal and run:

$ pip install taipy

You're all set! All aboard the Taipy journey 🚂


Community

Join our Discord to give us feedback, share your creations or just to have a chat with us.


Ready, Set, GUI

Tiny User Interface Demo

from taipy import Gui

excitement_page = """
# Welcome to Taipy
### How excited are you to try Taipy?

<|{excitement}|slider|min=1|max=100|>

My excitement level: <|{excitement}|>
"""
excitement = 100

Gui(page=excitement_page).run()

*RUN*🏃🏽‍♀️

🎊 TA-DA! 🎊

Tiny Demo


Check out our Getting Started and Documentation



Scenario and Data Management ⚙️

Let's create a Scenario in Taipy to filter movie data based on the genre you choose. This scenario models a simple pipeline. It is submitted (for execution) each time the genre selection changes and outputs the seven most popular movies of that genre.


⚠️ Here, the back-end involves the execution of a very simple pipeline (made of a single task). Note that Taipy is designed to build much more complex pipelines 🚀 (with many tasks!)


Here is our filter function: a standard Python function that is used by the unique task in the scenario

def filter_genre(initial_dataset: pd.DataFrame, selected_genre):
    filtered_dataset = initial_dataset[initial_dataset['genres'].str.contains(selected_genre)]
    filtered_data = filtered_dataset.nlargest(7, 'Popularity %')
    return filtered_data

This is the execution graph of the scenario we are implementing

Demo Execution Graph

Taipy Studio - The easy peasy way

You can use the Taipy Studio extension in Visual Studio Code to configure your scenario with no code

Demo Studio Gif

Your configuration is automatically saved as a TOML file


Check out our Documentation



Taipy Scenario & Data Management - a walk on the code side

For more advanced use cases or if you prefer coding your configurations instead of using Taipy Studio, Taipy has your back!

Check out the movie genre demo scenario creation with this Demo


Check out our Getting Started and Documentation



User Interface Generation ➕ Scenario & Data Management

Now, let's load this configuration and add a user interface on top for a 🎉FULL APPLICATION🎉

import taipy as tp
import pandas as pd
from taipy import Config, Scope, Gui

# Taipy Scenario & Data Management

# Filtering function - task
def filter_genre(initial_dataset: pd.DataFrame, selected_genre):
    filtered_dataset = initial_dataset[initial_dataset["genres"].str.contains(selected_genre)]
    filtered_data = filtered_dataset.nlargest(7, "Popularity %")
    return filtered_data

# Load the configuration made with Taipy Studio
Config.load("config.toml")
scenario_cfg = Config.scenarios["scenario"]

# Start Taipy Core service
tp.Core().run()

# Create a scenario
scenario = tp.create_scenario(scenario_cfg)


# Taipy User Interface
# Let's add a GUI to our Scenario Management for a full application

# Callback definition - submits scenario with genre selection
def on_genre_selected(state):
    scenario.selected_genre_node.write(state.selected_genre)
    tp.submit(scenario)
    state.df = scenario.filtered_data.read()

# Get list of genres
genres = [
    "Action", "Adventure", "Animation", "Children", "Comedy", "Fantasy", "IMAX"
    "Romance","Sci-FI", "Western", "Crime", "Mystery", "Drama", "Horror", "Thriller", "Film-Noir","War", "Musical", "Documentary"
    ]

# Initialization of variables
df = pd.DataFrame(columns=["Title", "Popularity %"])
selected_genre = "Action"

## Set initial value to Action
def on_init(state):
    on_genre_selected(state)

# User interface definition
my_page = """
# Film recommendation

## Choose your favorite genre
<|{selected_genre}|selector|lov={genres}|on_change=on_genre_selected|dropdown|>

## Here are the top seven picks by popularity
<|{df}|chart|x=Title|y=Popularity %|type=bar|title=Film Popularity|>
"""

Gui(page=my_page).run()

*RUN*🏃🏽‍♀️


🎊TA-DA!🎊

Image of a Taipy demonstration application



☁️Taipy Cloud☁️

With Taipy Cloud, you can deploy your Taipy applications in a few clicks and for free!

Demonstration of Taipy Cloud



Click here to get started for free



Contributing ⚒⚒

Want to help build Taipy? Check out our CONTRIBUTING.md file.

Code of conduct

Want to be part of the Taipy community? Check out our CODE_OF_CONDUCT.md file.

License

Copyright 2023 Avaiga Private Limited

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.