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

Doc/#1209 - #1250 - Add documentation page for each application and page template #1263

Open
wants to merge 18 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
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
103 changes: 103 additions & 0 deletions docs/templates/applications/default_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
Taipy's default application template is a simple, minimal template that lets you create a
custom Taipy application with a few questions.

# Create a Taipy application from the default template

As its name suggests, the default template is used if no template name is provided. Run
`taipy create` (or `taipy create --application default`) from the CLI to scaffold an
application from the default template. Then answer a few questions to customize your
application.

```console
$ taipy create --application default
[1/9] Application root folder [taipy_application]:
[2/9] Application main Python file [main.py]:
[3/9] Application title [Taipy Application]:
[4/9] With multi-pages?
Enter the page names separated by a space ():
[5/9] With Authentication? (No):
[6/9] With scenario management? (No):
[7/9] With a Rest API? (No):
[8/9] With a new Git repository? (No):
[9/9] Select With Docker deployment
1 - No
2 - For development
3 - For production
Choose from [1/2/3] (1):
New Taipy application has been created at ./taipy_application

To start the application, change directory to the newly created folder:
cd ./taipy_application

You can then run the application as follows:
taipy run main.py
```

!!! info

In the CLI, the default value for each question is displayed in the square brackets.
You can provide an answer or press Enter to use the default value.

!!! note "Available in Taipy Enterprise edition"

Questions 5 and 9 are only relevant to the [Taipy Enterprise Edition](https://taipy.io/enterprise)

[Contact us](https://taipy.io/book-a-call){: .tp-btn .tp-btn--accent target='blank' }

Each question in the CLI corresponds to a specific aspect of the application:

1. "Application root folder":
- Specifies the root folder of the application.
- The default value is "new_application".
2. "Application main Python file"
- Sets the name of the main Python file (entry point) of the application.
- The default value is "main.py".
3. "Application title":
- Specifies the title displayed in the web application.
- The default value is "Taipy Application".
4. "With multi-pages"
- Specifies whether the application is a single-page or multi-page.
- For a multi-page application, enter the page names separated by spaces. If left blank, the
application will default to single page.
- The names must be valid Python identifiers.
5. "With Authentication"
- Indicates whether the application includes authentication.
- If yes, a login page and a basic setup for for configuring authentication will be included
in the application.
- The default value is "No".
6. "With scenario management"
- Specifies whether the application uses scenario management.
- If yes, the `Orchestrator^` service will be included to handle job orchestration and version management.
- The default value is "No".
7. "With a Rest API":
- Specifies whether the application uses Taipy Rest.
- If yes, the Taipy Rest API service will be included in the application.
- The default value is "No".
8. "With a new Git repository":
- Specifies whether the application will be initialized as a new Git repository.
- The default value is "No".
9. "With Docker deployment"
- Specifies Docker support for the application.
- Options:
- "No": No Docker support.
- "For development": Add a minimal version of `Dockerfile` and `docker-compose.yml` for development.
- "For production": Add a production-ready `Dockerfile` and `docker-compose.yml`.
- The default value is "No".

## Run the application

To run the application, change to the newly created folder and run the application using `taipy run main.py`.

```console
$ cd ./taipy_application
$ taipy run main.py
```

If the newly created application supports Docker, you can also run the application using `docker-compose`.

```console
$ cd ./taipy_application
$ docker-compose up --build -d
```

You can now access the application in your browser at `http://localhost:5000`.
85 changes: 85 additions & 0 deletions docs/templates/applications/sdm_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,85 @@
Taipy's scenario management application template lets you scaffold a custom Taipy
application using scenario management capabilities. It uses
[a scenario selector](./../../../refmans/gui/viselements/corelements/scenario_selector.md)
to allow end users to create, manage, and run scenarios directly from the GUI page.

# Create a Taipy application from the scenario management template

To create an application from the Taipy scenario management application template, run
`taipy create --application sdm` from the CLI, then answer a few questions to customize your application.

```console
$ taipy create --application sdm
[1/6] Application root folder [taipy_application]:
[2/6] Application main Python file [main.py]:
[3/6] Application title [Taipy Application]:
[4/6] With TOML Config? (No):
[5/6] With a new Git repository? (No):
[6/6] Select With Docker deployment
1 - No
2 - For development
3 - For production
Choose from [1/2/3] (1):
New Taipy application has been created at ./taipy_application

To start the application, change directory to the newly created folder:
cd ./taipy_application

You can then run the application as follows:
taipy run main.py
```

!!! info

In the CLI, the default value for each question is displayed in the square brackets.
You can provide an answer or press Enter to use the default value.

!!! note "Available in Taipy Enterprise edition"

Questions 6 is only relevant to the [Taipy Enterprise Edition](https://taipy.io/enterprise)

[Contact us](https://taipy.io/book-a-call){: .tp-btn .tp-btn--accent target='blank' }

Each question in the CLI corresponds to a specific aspect of the application:

1. "Application root folder":
- Specifies the root folder of the application.
- The default value is "new_application".
2. "Application main Python file"
- Sets the name of the main Python file (entry point) of the application.
- The default value is "main.py".
3. "Application title":
- Specifies the title displayed in the web application.
- The default value is "Taipy Application".
4. "With TOML Config":
- Specifies whether the application will use TOML configuration files, otherwise the configuration
will be in a Python file.
- The default value is "No".
5. "With a new Git repository":
- Specifies whether the application will be initialized as a new Git repository.
- The default value is "No".
6. "With Docker deployment"
- Specifies Docker support for the application.
- Options:
- "No": No Docker support.
- "For development": Add a minimal version of `Dockerfile` and `docker-compose.yml` for development.
- "For production": Add a production-ready `Dockerfile` and `docker-compose.yml`.
- The default value is "No".

## Run the application

To run the application, change to the newly created folder and run the application using `taipy run main.py`.

```console
$ cd ./taipy_application
$ taipy run main.py
```

If the newly created application supports Docker, you can also run the application using `docker-compose`.

```console
$ cd ./taipy_application
$ docker-compose up --build -d
```

You can now access the application in your browser at `http://localhost:5000`.
10 changes: 10 additions & 0 deletions docs/templates/index.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
Taipy provides a comfortable environment for getting started with Taipy via the create command,
and is the best way to start building a new application with Taipy.

With Taipy templates, you can easily initiate a new Taipy application as a starting point for your project.

Available application templates:

[:material-arrow-right: Default application template](applications/default_app.md),

[:material-arrow-right: Scenario management application template](applications/sdm_app.md),
25 changes: 18 additions & 7 deletions docs/tutorials/articles/complete_application/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,30 @@ $ pip install statsmodels
can guide you through the process.


Once Taipy is installed, you can use the CLI to scaffold an application folder. Run the create
Once Taipy is installed, you can use the Taipy CLI to scaffold an application folder. Run the create
command line with default application template and answer basic questions as follows:

``` console
> taipy create --application default
Application root folder name [taipy_application]:
Application main Python file [main.py]:
Application title [Taipy Application]:
Page names in multi-page application? []: data_viz scenario performance
Does the application use scenario management or version management? [No]: yes
Does the application use Rest API? [No]: no
[1/9] Application root folder [taipy_application]:
[2/9] Application main Python file [main.py]:
[3/9] Application title [Taipy Application]:
[4/9] With multi-pages?
Enter the page names separated by a space ():
[5/9] With Authentication? (No):
[6/9] With scenario management? (No):
[7/9] With a Rest API? (No):
[8/9] With a new Git repository? (No):
[9/9] Select With Docker deployment
1 - No
2 - For development
3 - For production
Choose from [1/2/3] (1):
```

For detail description of the available application templates, please refer to the
[Templates section](../../../templates/index.md).

So, without further delay, let's begin to code!

## Steps
Expand Down
72 changes: 16 additions & 56 deletions docs/userman/ecosystem/cli/create.md
Original file line number Diff line number Diff line change
@@ -1,81 +1,41 @@
# Create a Taipy application
# Create a Taipy application from a template

Taipy provides a comfortable environment for getting started with Taipy via the create command,
and is the best way to start building a new application with Taipy.

## From the default application template

To create a simple Taipy application, you can run `taipy create`, then answer a few questions to
customize your application.
To create a simple Taipy application, you can run `taipy create` from the CLI, then answer a few
questions to customize your application.
```console
$ taipy create
Application root folder name [taipy_application]: new_application
Application main Python file [main.py]: app.py
Application title [Default title]: App Title
Page names in multi-page application? []: slide_1 slide_2 slide_3
Does the application use scenario management or version management? [No]: y
Does the application use Rest API? [No]:
$ cd ./new_application
$ taipy run app.py
```
In this example, we scaffold a new Taipy application using the default Taipy application template, which
lets us create a simple, minimal Taipy application.


!!! info

In the prompt, we can see the question and the default value in the square brackets.
We can provide an answer or press enter to use the default value.


- The first question defines the application root folder as "new_application"
- In the second and third questions, we set the main Python file of the application as "app.py"
and the web page's title as "App Title".
- In the 4th question, we clarify that we want a Taipy multi-page GUI application with three
pages, and the page names are "slide_1", "slide_2", and "slide_3". If there is no answer to
this question, the application will be a single page application. Please note that the names
must be valid Python identifiers.
- In the 5th question, we clarify that we want to use scenario management, so the application
should include the Orchestrator service.
- In the 6th question, we chose the default answer is No, meaning we don't want to use Rest API,
so the application should not include the Taipy Rest API service.

Finally, we changed the directory (`cd`) to our newly created folder and started the application
by running `taipy run app.py`.

## From a specific application template
By default, the `taipy create` command helps scaffolding a new Taipy application using the
default Taipy application template.

You can specify creating a new application from another application template using the
*--application* option.

```console
$ taipy create --application scenario-management
Application root folder name [taipy_application]: new_application
Application main Python file [main.py]: app.py
Application title [Default title]: App Title
Does the application use TOML Config? [No]:
$ cd ./new_application
$ taipy run app.py
$ taipy create --application sdm
```

In this example, we scaffold a new Taipy application using the "scenario-management" template,
which utilizes [a scenario selector](./../../../refmans/gui/viselements/corelements/scenario_selector.md) to allow
creating, managing, and running scenarios directly from the GUI page.
Taipy currently supports the following application templates:

- [Default application template](../templates/applications/default_app.md)
- [Scenario management application template](../templates/applications/sdm_app.md)

Please refer to the next section for a list of application templates.

## List of application templates
# List the application templates

You can see the list of supported application templates by running `taipy help create` command.
Alternatively, you can use the *--help* or *-h* options by running `taipy create --help` or
`taipy create -h`.
From the CLI, you can list the available application templates by running `taipy help create`
command. Alternatively, you can use the *--help* or *-h* options by running `taipy create --help`
or `taipy create -h`.

```console
$ taipy help create
usage: taipy create [-h] [--application {default,scenario-management,...}]
usage: taipy create [-h] [--application {default,sdm,...}]

options:
-h, --help show this help message and exit
--application {default,scenario-management,...}
--application {default,sdm,...}
The application template name to create a new Taipy application.
```
6 changes: 6 additions & 0 deletions mkdocs.yml_template
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,12 @@ nav:
- "Large data models vs. Computer memory": tutorials/articles/large_data_models/index.md
- "Charts for Large Data": tutorials/articles/decimator/index.md

- "Taipy Templates":
- "Taipy Templates": templates/index.md
- "Application templates":
- "Default application template": templates/applications/default_app.md
- "Scenario management template": templates/applications/sdm_app.md

- "User Manual":
- "About Taipy's User manual": userman/index.md

Expand Down
3 changes: 2 additions & 1 deletion tools/postprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,8 @@ def create_button(label: str, path: str, class_name: str, group: str = "") -> st
<div style="margin-bottom: 1rem;">
"""
for desc in [
("Tutorials", "tutorials/getting_started/", "tp-content-card--primary"),
("Tutorials", "tutorials/getting_started/", "tp-content-card--primary", "start-group"),
("Templates", "templates/", "tp-content-card--gamma", "end-group"),
("User Manual", "userman/", "tp-content-card--accent"),
(
"Visual Elements",
Expand Down