diff --git a/episodes/01-Introduction.md b/episodes/01-Introduction.md index be2bfcd47131298a2a0db8128fa019da3e97bec0..320b318beb988b4df0f1fb916d85bf4d537e7fb0 100755 --- a/episodes/01-Introduction.md +++ b/episodes/01-Introduction.md @@ -47,7 +47,7 @@ To better understand how NOVA works with NDIP, consider this simplified architec ![](fig/Nova_Architecture.png) -In essence, you will build your **User Application** using the **NOVA Libraries**, which in turn will interact with the **NDIP Platform** to perform neutron data analysis tasks. NOVA applications do not require a GUI to leverage NDIP. We'll demonstrate this in Episode 3, where we\'ll use 'nova-galaxy' to create a simple python script which connects to NDIP and launches a tool. In episode 4, we\'ll extend that python script to include a simple GUI with the support of 'nova-trame' and 'nova-mvvm'. +In essence, you will build your **User Application** using the **NOVA Libraries**, which in turn will interact with the **NDIP Platform** to perform neutron data analysis tasks. NOVA applications do not require a GUI to leverage NDIP. We'll demonstrate this in Episode 3, where we\'ll use 'nova-galaxy' to create a simple python script which connects to NDIP and launches a tool. In episode 4, we\'ll extend that python script to include a simple GUI with the support of 'nova-trame' and 'nova-mvvm'. ## What Will You Learn? @@ -56,7 +56,7 @@ In this tutorial, you will learn how to use these three core NOVA libraries to b * Connect to NDIP. * Reference job definitions from tool XML files. * Set parameters for those tools. -* Run the tools using the supplied paramters. +* Run the tools using the supplied parameters. * Monitor the progress of the running tools. * Obtain output from the tool when it completes. * Create user interfaces to enable access to NDIP tools @@ -104,6 +104,6 @@ This structure ensures that each code example is isolated and runnable, making i :::::::::::::::::::::::::::::::::::::::: keypoints - NDIP is a workflow management system used for analsyis and interpretation of neutron scattering data. -- NDIP has a range of services and tools to enable the creation of complex workdlows for data analysis. +- NDIP has a range of services and tools to enable the creation of complex workflows for data analysis. - NOVA is a set of libraries that provide a framework to simplify the development of interactive applications for NDIP -:::::::::::::::::::::::::::::::::::::::::::::::::: \ No newline at end of file +:::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/episodes/02-Copy-Template.md b/episodes/02-Copy-Template.md index 548fe125543a33856ab030e64d3bdc7a4957bbc4..44a812e2139d248a9099531ec61f035c1409fe10 100755 --- a/episodes/02-Copy-Template.md +++ b/episodes/02-Copy-Template.md @@ -36,37 +36,37 @@ The setup section detailed the prerequisites required for the tutorial. One of t To clone the template application, run the following command: ```bash -copier copy https://code.ornl.gov/ndip/project-templates/python.git nova_tutorial +copier copy https://code.ornl.gov/ndip/project-templates/nova-application-template.git nova_tutorial ``` This command will download the template to a directory called `nova_tutorial`. Copier will prompt you with a series of questions. Please answer the questions as follows: -* **What is the name of your project?** +* **What is your project name?** > Enter `Nova Tutorial` -* **What is your python package name?** +* **What is your Python package name (use Python naming conventions)?** > Press enter to accept the default. * **Do you want to install Mantid for your project?** - + > Enter `no` * ** Are you developing a GUI application using MVVM pattern?** - + > Enter `yes` * ** Which library will you use?** - + > Select `Trame` * **Do you want a template with multiple tabs? - + > Enter `yes` -* **Publish to pypi?** - +* **Publish to PyPI?** + > Enter `no` * **Publish documentation to readthedocs.io?** @@ -104,7 +104,7 @@ The template creates a basic project structure to help get you started quickly. * `nova_tutorial/`: The root directory of your project * `nova_tutorial/src/`: Contains your application code -* `nova_tutorial/src/nova_tutorial/`: The name of your python package +* `nova_tutorial/src/nova_tutorial/`: The name of your Python package * `nova_tutorial/tests/`: Contains your application\'s unit tests. * `nova_tutorial/README.md`: A readme file. @@ -114,7 +114,7 @@ In the following sections, we will start adding code to this structure to build ::::::::::::::::::::::::::::::::::::::: challenge -## **Run the Initial Tests** +## **Run the Initial Tests** The template comes with a basic test suite using `pytest`. Navigate to the `nova_tutorial` directory in your terminal and run the tests using the command `pytest`. Examine the output. Where are the tests located? What does a successful test look like? Modify the test to intentionally fail. Observe the error message. Remember to revert the changes so that the tests pass again.. @@ -182,4 +182,4 @@ The template includes a basic GitLab CI configuration file (`.gitlab-ci.yml`). - Use the copier tool to set clone the template application. - Poetry is a project management tool used to install dependencies and manage virtual environments. - The template application includes everything you need to get started such as basic CI, dockerfile, and tests. -:::::::::::::::::::::::::::::::::::::::::::::::::: \ No newline at end of file +:::::::::::::::::::::::::::::::::::::::::::::::::: diff --git a/episodes/03-Nova-Galaxy.md b/episodes/03-Nova-Galaxy.md index e741a5e61a279e48c12d26651d3cedbbbaea022b..fa47da7d31164566c7f54f6f86aa09b98b2a645e 100755 --- a/episodes/03-Nova-Galaxy.md +++ b/episodes/03-Nova-Galaxy.md @@ -128,11 +128,6 @@ poetry run app You should see `Fractal tool finished successfully.` printed to the console. -::::::::::::::::::::::::::::::::::::::::: callout -By default, trame will open a new tab in the browser and bring it to focus. If this is undesired behavior, it can be prevented by using ```poetry run app --server```. - -:::::::::::::::::::::::::::::::::::::::::::::::::: - ## Asynchronous tool execution At times, it may be desirable to execute a tool or workflow without waiting on the result. The class Tool method run has an optional `wait` parameter. The default is true so that the tool is run in a blocking manner. However, by setting the parameter to false, the tool will be run asynchronously in a non-blocking manner. diff --git a/episodes/04-MVVM-Design-Pattern.md b/episodes/04-MVVM-Design-Pattern.md index ba2cbde7e033e9655324d04385274d3e6d842b22..fda3b2368f83411eb71b5ae96576293c061181c5 100755 --- a/episodes/04-MVVM-Design-Pattern.md +++ b/episodes/04-MVVM-Design-Pattern.md @@ -103,7 +103,7 @@ Benefits of Pydantic: ## Data Binding with NOVA -The **`nova-mvvm`** library greatly simplifies the data synchronization between the componentes of an MVVM applicationm and provides support for user interfaces utilizing the Trame, PyQt, and Panel graphical frameworks. The library provides several predefined classes including TrameBinding, PyQtBinding, and PanelBinding to connect UI components to model variables. Here, we'll focus on the TrameBinding class, but all three function similarly. +The **`nova-mvvm`** library greatly simplifies the data synchronization between the components of an MVVM application and provides support for user interfaces utilizing the Trame, PyQt, and Panel graphical frameworks. The library provides several predefined classes including TrameBinding, PyQtBinding, and PanelBinding to connect UI components to model variables. Here, we'll focus on the TrameBinding class, but all three function similarly. ### How to use TrameBinding @@ -154,6 +154,7 @@ Let\'s see how to implement the MVVM pattern using `nova-mvvm` and incorporate P def run_fractal(self) -> None: self.model.fractal.run_fractal_tool() self.update_view() +``` **2. Updating our Fractal Class for pydantaic and MVVM (`src/nova_tutorial/app/models/fractal.py** @@ -168,7 +169,7 @@ from pydantic import BaseModel, Field from nova.galaxy import Connection, Parameters, Tool ``` -* **Update class variables:** Now we'll update fractal_type and other class variables to support pydantic. We'll also add an image variable to store the image. Modify the variable declarations to the following: +* **Update class variables:** Now we'll update fractal_type and other class variables to support pydantic. We'll also add an image variable to store the image. Modify the variable declarations to the following: ```python class Fractal(BaseModel): @@ -197,7 +198,7 @@ class Fractal(BaseModel): from .fractal import Fractal # Import Fractal ``` -* **Add the Fractal Model to the MainModel**: Modify the end of the MainModel class so that it matches the code below. +* **Add the Fractal Model to the MainModel**: Modify the end of the MainModel class so that it matches the code below. ```python password: str = Field(default="test_password", title="User Password") @@ -261,7 +262,8 @@ from .fractal_tab import FractalTab # Import the FractalTab We are now going to modify the existing `main.py` file. Change the main method to match the code below. -* **Instantiate and Run**: In the `main()` function, we create an instance of `Fractal` and call the `run_fractal_tool()` method, wrapped in a `try...except` block for basic error handling: +* **Instantiate and Run**: In the `main()` function, we no longer need to setup the Fractal tool as it's managed via our MVVM application now. + ```python import sys from .models.fractal import Fractal @@ -291,6 +293,11 @@ poetry run app The application should launch a tab in your web browser. The GUI will have a `FRACTAL` tab and a few sample tabs which were created by the template application. The run button on the `Fractal` tab can be used to launch the `Fractal` NDIP tool. The tool will take a few minutes to complete but when it does, the resulting `Fractal` image will be displayed. +::::::::::::::::::::::::::::::::::::::::: callout +If you don't want Trame to launch a tab by default, you can instead run ```poetry run app --server```. + +:::::::::::::::::::::::::::::::::::::::::::::::::: + ::::::::::::::::::::::::::::::::::::::: challenge **Trigger Pydantic Validation Error (Programmatic)** * In `Fractal` in `src/nova_tutorial/app/models/fractal.py`, modify the `set_fractal_type` function from the previous exercise to use an *invalid* fractal type: diff --git a/episodes/08-Next-Steps.md b/episodes/08-Next-Steps.md index 60ee3aa8f6e93298546e79e9bfa61325d068e0c1..c2d189e90502fbf757ef3dcf3d35c43d63e41f2d 100755 --- a/episodes/08-Next-Steps.md +++ b/episodes/08-Next-Steps.md @@ -3,7 +3,7 @@ title: "Development Cycle and Next Steps" teaching: 10 exercises: 0 --- -# Next Steps +# 8. Development Cycle and Next Steps In this section, we will look at other resources you may want to integrate with your application and outline the process for taking an application like the one we\'ve created in this tutorial and deploying it to the NOVA/NDIP platform. While we won\'t actually perform the deployment in this tutorial, we will cover the key steps and resources involved.