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 17 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 6 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
137 changes: 137 additions & 0 deletions docs/templates/applications/default_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
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.

Each question in the CLI corresponds to a specific aspect of the application. The following
sections describe each question in detail.

!!! 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' }

## 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 page names must be valid Python identifiers.
- Once the application is created, all pages will be created in the `pages` folder as empty
pages. You can add content to the pages as needed.
- The default value is an empty string, which creates a single-page application.

## 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.
- A login page will be created at `pages/login.py`, which uses the
[Taipy login control](../../refmans/gui/viselements/generic/login.md).
- A basic authentication configuration will be added to the `configuration/auth_config.py` file.
By default, the authentication will use the
[Taipy protocol](../../userman/advanced_features/auth/authentication.md#taipy-protocol).
You can customize the authentication method as needed.
- The default value is "No".

## 6. With scenario management

- Specifies whether the application uses scenario management.
- If yes:
- The Taipy `Orchestrator^` service will be included to handle job orchestration and version
management.
- A scaffold configuration file will be created at `configuration/config.py`. You can put your
application's configuration here and it will be imported to the main application file.
- A scaffold `algorithms/algorithms.py` file will be created, which is designed to contain the
various Python functions used to configure tasks. You can add your tasks' functions here and
they will be imported to the main application file.
- The default value is "No".

## 7. With a Rest API

- Specifies whether the application uses Taipy Rest.
- If yes, the Taipy `Rest^` 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`.
100 changes: 100 additions & 0 deletions docs/templates/applications/sdm_app.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,100 @@
Taipy's scenario management application template leverages the scenario and data
management visual elements to speed up bootstrapping a standard application. The
resulting application exposes a user interface for scenario creation and management,
data visualization, data analysis, simulation, what-if analysis, and/or job
orchestration monitoring.

# How to create the application

To create the application from the template, change to the folder in which you want to
create the application and run the command `taipy create --application sdm`. Then answer
the 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 "Default answers"

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

Each question in the CLI corresponds to a specific aspect of the application. The following
sections describe each question in detail.

!!! 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' }

## 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".

# How to 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),
28 changes: 20 additions & 8 deletions docs/tutorials/articles/complete_application/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,31 @@ $ 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
command line with default application template and answer basic questions as follows:
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 more details on the available application templates, please refer to the
[Templates](../../../templates/index.md) documentation.

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.
```
Loading