Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

first draft for new GS #557

Merged
merged 9 commits into from
Sep 17, 2023
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
127 changes: 0 additions & 127 deletions docs/getting_started-new/hello-world.md

This file was deleted.

61 changes: 61 additions & 0 deletions docs/getting_started-new/hello_world.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
import taipy as tp
from taipy import Config, Core, Gui


################################################################
# Configure your application #
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
################################################################


def build_message(name):
return f"Hello {name}!"


# A first data node configuration represents a name
name_data_node_cfg = Config.configure_data_node(id="input_name")
# A second data node configuration represents the message to print
message_data_node_cfg = Config.configure_data_node(id="message")
# The task represents the build_message function
build_msg_task_cfg = Config.configure_task("build_msg", build_message, name_data_node_cfg, message_data_node_cfg)
# The scenario represent the whole execution graph
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
scenario_cfg = Config.configure_scenario("scenario", task_configs=[build_msg_task_cfg])

################################################################
# Design your interface #
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
################################################################

hello_scenario = None
input_name = "Taipy"
message = None


def submit_scenario(state):
state.hello_scenario.input_name.write(state.input_name)
state.hello_scenario.submit(wait=True)
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
state.message = hello_scenario.message.read()

page = """
Name: <|{input_name}|input|>

<|submit|button|on_action=submit_scenario|>

Message: <|{message}|text|>
"""

if __name__ == "__main__":
################################################################
# Instantiate the Core service and run it #
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
################################################################
Core().run()

################################################################
# Manage your scenarios and data nodes #
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
################################################################
hello_scenario = tp.create_scenario(scenario_cfg)

################################################################
# Instantiate the Gui service and run it #
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
################################################################

Gui(page).run()

1 change: 1 addition & 0 deletions docs/getting_started-new/hello_world.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
36 changes: 36 additions & 0 deletions docs/getting_started-new/hello_world_scenario.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
import taipy as tp
jrobinAV marked this conversation as resolved.
Show resolved Hide resolved
from taipy import Config, Core

################################################################
# Configure your application #
################################################################


def build_message(name):
return f"Hello {name}!"


# A first data node configuration represents a name
name_data_node_cfg = Config.configure_data_node(id="input_name")
# A second data node configuration represents the message to print
message_data_node_cfg = Config.configure_data_node(id="message")
# The task represents the build_message function
build_msg_task_cfg = Config.configure_task("build_msg", build_message, name_data_node_cfg, message_data_node_cfg)
# The scenario represent the whole execution graph
scenario_cfg = Config.configure_scenario("scenario", task_configs=[build_msg_task_cfg])

if __name__ == "__main__":
################################################################
# Instantiate the Core service and run it #
################################################################
Core().run()

################################################################
# Manage your scenarios and data nodes #
################################################################
hello_scenario = tp.create_scenario(scenario_cfg)

hello_scenario.input_name.write("Taipy")
hello_scenario.submit()
print(hello_scenario.message.read())

Loading
Loading