Skip to content

Commit 0beef48

Browse files
authored
Expand Documentation For Startup and Deployment (#24)
1 parent 605c5a0 commit 0beef48

File tree

16 files changed

+587
-212
lines changed

16 files changed

+587
-212
lines changed

README.md

Lines changed: 20 additions & 56 deletions
Original file line numberDiff line numberDiff line change
@@ -13,69 +13,33 @@
1313
[![Docs status](https://github.com/stfc/alc-ux/actions/workflows/ci-docs.yml/badge.svg?branch=main)](https://stfc.github.io/alc-ux/)
1414
[![DOI](badge)](https://zenodo.org/)
1515

16+
Welcome to the ALC-UX resource repository.
17+
This repository contains all the information required to develop AiiDA/AiiDAlab applications
18+
for use with ALC software projects. It includes details on how to create and run the required
19+
docker images to package additional components on top of the core AiiDAlab application, as
20+
well as how to deploy these to users either locally or via a cloud host such as ADA. Additionally
21+
included are example scripts and an example setup for a basic AiiDAlab plugin application.
1622

17-
This is an AiiDAlab application plugin for scientific workflows maintained by the [Ada Lovelace Center](https://adalovelacecentre.ac.uk/) (ALC).
18-
The app is still in early development stage and any input/contributions are welcome.
23+
## Documentation
1924

20-
21-
## For Developers
22-
23-
### Style Checking
24-
25-
This package uses pre-commit hooks to check for style consistency, to use these the ``pre-commit`` tool is required.
26-
This can be installed alongside the base package by running,
27-
28-
``` sh
29-
pip install .[dev]
30-
```
31-
32-
or separately via,
33-
34-
``` sh
35-
pip install pre-commit
36-
```
37-
38-
Once installed run,
39-
40-
``` sh
41-
pre-commit install
42-
```
43-
44-
in the base repository to enable the pre-commit hooks.
45-
This will now run style and formatting checks on every commit.
46-
47-
### Testing
48-
49-
This package uses [pytest](https://docs.pytest.org/en/stable/)
50-
to run all unit tests which is included in the ```[dev]``` optional
51-
package dependencies. Once installed it can be run from the project root directory.
52-
The CI workflows are configured to ensure all tests pass
53-
before a pull request can be accepted into the main repository.
54-
It is important that any new additions to the code base are accompanied
55-
by appropriate testing, maintaining a high code coverage. The coverage
56-
can be checked via,
57-
58-
``` sh
59-
pytest --cov=aiidalab_alc
60-
```
61-
62-
63-
### Documentation
25+
Access the full [documentation](https://stfc.github.io/alc-ux/).
6426

6527
The documentation, including a User Guide, Developer Guide and an API reference,
6628
is built using [sphinx](https://www.sphinx-doc.org/). The source
6729
for which is contained in the ```docs/``` directory. At present
68-
only the html generator has been fully tested. All required packages can
69-
be installed alongside the core package via,
30+
only the html generator has been fully tested.
31+
32+
## Issues and Discussion
33+
34+
This repository should provide a basic starting point for developing AiiDA/AiiDAlab plugins,
35+
if there are any issues/questions please utilise the [issues](https://github.com/stfc/alc-ux/issues) and
36+
[discussions](https://github.com/stfc/alc-ux/discussions) pages via the GitHub web interface.
7037

71-
``` sh
72-
pip install .[docs]
73-
```
38+
## Existing AiiDAlab Projects
7439

75-
and then the documentation can be built using sphinx-build,
40+
- [AiiDAlab ChemShell](https://github.com/stfc/aiidalab-chemshell)
7641

77-
``` sh
78-
sphinx-build -b html docs/source/ docs/build/html
79-
```
42+
## Existing AiiDA Projects
8043

81-
from the root directory.
44+
- [aiida-mlip](https://github.com/stfc/aiida-mlip)
45+
- [aiida-chemshell](https://github.com/stfc/aiida-chemshell)
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
#!/bin/bash
2+
3+
echo "INSTALLING AiiDAlab ALC app"
4+
cd "${HOME}"/apps
5+
wget https://github.com/stfc/alc-ux/archive/refs/heads/main.zip
6+
unzip main.zip
7+
rm -f main.zip
8+
cd "${HOME}"/apps/alc-ux-main
9+
pip install -q .
10+
11+
12+
cd "${HOME}"
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
# Use this for the latest official aiidalab image (Python 3.9)
2+
# FROM aiidalab/full-stack:latest
3+
# Use this for a ported version of the above running on Python 3.10
4+
FROM ghcr.io/stfc/alc-ux/base:py310
5+
6+
USER root
7+
8+
# Install some extra required dendencies to speed up start up
9+
RUN pip install aiidalab_widgets_base --no-cache-dir --no-user
10+
11+
# Install alc aiida plugins
12+
RUN pip install aiida-chemshell aiida-mlip --no-cache-dir --no-user
13+
14+
# This will install alc-ux on container start up
15+
COPY 61_prepare-aiidalab_alc.sh /usr/local/bin/before-notebook.d/
16+
17+
USER ${NB_UID}
18+
WORKDIR ${HOME}
19+

docs/source/conf.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
# -- Project information -----------------------------------------------------
1111
# https://www.sphinx-doc.org/en/master/usage/configuration.html#project-information
1212

13-
project = 'AiiDAlab ALC App'
13+
project = 'ALC AiiDAlab Guides'
1414
copyright = '2025, Ada Lovelace Center'
1515
author = 'Dr. Benjamin T. Speake'
1616

docs/source/dev_docs/aiidalab_app_design.rst

Lines changed: 81 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,15 +8,90 @@ the start banner for the plugin. From here each page defined within the applicat
88
described by a jupyter notebook (\*.ipynb) file which may call components from the
99
core python package.
1010

11-
Model-View-Controller Paradigm
11+
12+
Core Requirements
13+
-----------------
14+
15+
Project Meta-Data
16+
~~~~~~~~~~~~~~~~~
17+
18+
AiiDAlab uses the python style ``setup.cfg`` configuration file to define project meta-data which
19+
it parses and associates with the plugin inside the AiiDAlab interface. This file must be
20+
present within the plugins root directory or within a special ``.aiidalab`` directory under the
21+
project root. Within it all the required meta-data can be specified such as project name, description,
22+
version number etc. More detail on the available and required meta-data inputs can be found
23+
`here <https://aiidalab.readthedocs.io/en/latest/app_development/publish.html>`_ .
24+
25+
Start Banner
26+
~~~~~~~~~~~~
27+
28+
To be displayed in the core AiiDAlab home interface a plugin must contain a start banner, which can
29+
either be defined in a python file (``start.py``) or a markdown file (``start.md``). This is the main
30+
interface from the AiiDAlab home page to your developed plugin so should contain any relevant logos
31+
and navigation buttons for the plugin. The example presented alongside this documentation in the
32+
`github repo <https://github.com/stfc/alc-ux>`_ defines a python based approach with an embedded
33+
HTML element which provides the application logo as a navigation button alongside a selection
34+
of navigation buttons below the logo which all navigate to different components of the underlying
35+
AiiDAlab plugin.
36+
37+
38+
Main Application
39+
~~~~~~~~~~~~~~~~
40+
41+
The main AiiDAlab plugin application will be written in jupyter notebook files ``.ipynb`` which
42+
can either be self contained or for more complex UI project will reference an underlying python
43+
library associated with the plugin. For the `example plugin <https://github.com/stfc/alc-ux>`_
44+
provided the main application page is defined in ``main.ipynb`` and refers to the ``aiidalab_alc``
45+
python library which contains all the required UI elements and how they interact with each other
46+
and the user. This library is defined in ``src/aiidalab-alc/`` and has various components that
47+
each contribute to different aspects of the AiiDAlab plugins UI.
48+
49+
50+
Making Your App Discoverable
51+
----------------------------
52+
53+
When installing new plugins via the AiiDAlab plugin manager interface, plugins will be installed
54+
and configured into the correct directories to be picked up by the AiiDAlab home page. However,
55+
when developing plugins it is often required to manually manipulate these directories to make
56+
sure your in-development application can be found and displayed by AiiDAlab. By default AiiDAlab
57+
will create an ``apps`` directory within the home space of the container running the jupyter server
58+
instance. This is where all AiiDAlab plugin apps reside and where the home app looks to determine
59+
which plugins are available. The process for AiiDAlab to install an application typically follows
60+
as first checkout a specific release version of the plugin's code from its online host e.g. GitHub
61+
into the ``apps`` folder. Following this it will run a pip install within the root source directory
62+
of the plugin if required to install the required backend python UI package.
63+
64+
65+
General Plugin Design Concepts
1266
------------------------------
1367

68+
Model-View-Controller Paradigm
69+
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
70+
1471
It is recommended that an AiiDAlab plugin follows the widely recognised Model-View-Controller
1572
design paradigm for UI development.
1673
The core UI package will use ``IPywidgets`` (or aiidalab's own pre-configured widgets) to display
17-
the various UI components that a user will interact with. This defines the *view* for the application.
18-
The data that is being handled should exist seperate to any visual components that are part
19-
of the applications *view* layer. They are handled by the ``traitlets`` python packages and can
20-
be dynamically linked to user inputs through the *view* layer but should exist indendantly, thus
74+
the various UI components that a user will interact with (described later). This defines the
75+
*view* for the application. The data that is being handled should exist seperate to any visual
76+
components that are part of the applications *view* layer. They are handled by the ``traitlets``
77+
python packages and can be dynamically linked to user inputs through the *view* layer but should exist indendantly, thus
2178
defining the *model* layer. The controller layer is an optional additional layer that defines user
22-
controll over that application that doesn't directly interact with any of the stored data.
79+
controll over that application that doesn't directly interact with any of the stored data.
80+
81+
82+
Widgets
83+
~~~~~~~
84+
85+
Jupyter notebook based GUI's rely on components called widgets, often (but not exclusively) provided
86+
by a library called `IPywidgets <https://ipywidgets.readthedocs.io/en/stable/>`_\. These form the core
87+
UI elements that can be used as building blocks to create your application. They provide widgets for
88+
formatting such as vertical/horizontal layout boxes, as well as different forms of input/output or
89+
interaction interfaces, such as text display/input boxes, drop down lists or buttons. These can be
90+
combined to build a complex GUI application.
91+
92+
In addition to the core widgets provided by IPywidgets, AiiDAlab provides several of its own widgets
93+
specifically tailored for interacting with AiiDA components such as data structures and the database
94+
itself. These are provided in the *aiidalab-widgets-base* python package and are documented
95+
`here <https://aiidalab-widgets-base.readthedocs.io/en/latest/>`_\.
96+
97+

docs/source/dev_docs/containers.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
.. _developing_containers:
2+
13
Developing With Docker Containers
24
=================================
35

docs/source/dev_docs/index.rst

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,38 @@
11
Developer Guide
22
===============
33

4-
Welcome to the ALC AiiDAlab app's developer guide.
4+
Welcome to the developer's guide to AiiDAlab applications for the ALC.
5+
6+
This document contains all the information required to develop AiiDA/AiiDAlab applications
7+
for use with ALC software projects. It includes details on how to create and run the required
8+
docker images to package additional components on top of the core AiiDAlab application, as
9+
well as how to deploy these to users either locally or via a cloud host such as ADA.
10+
11+
Introduction
12+
============
13+
14+
AiiDAlab is a web based graphical user interface (GUI) for the popular scientific workflow
15+
management software package AiiDA. It presents a step-by-step approach to defining complex
16+
workflows utilising the relevant AiiDA plugins for the core computation. It is based on
17+
the ``appmode`` plugin for jupyter notebooks, enabling complex UI elements to be hosted
18+
within a web hosted jupyter notebook environment. This abstracts away many of the more
19+
challenging concepts of the AiiDA workflow itself whilst providing user friendly UI
20+
controls to interact with the provided plugins.
21+
22+
This guide aims to help developers get started with AiiDAlab plugin design and
23+
deployment across the wide variety of software applications developed within
24+
the ALC and STFC.
25+
26+
Any questions can be directed to the `discussions <https://github.com/stfc/alc-ux/discussions>`_
27+
page on GitHub or to benjamin.speake@stfc.ac.uk.
28+
29+
30+
Contents
31+
========
532

633
.. toctree::
734
:maxdepth: 2
835

9-
intro
36+
aiidalab_app_design
1037
containers
11-
aiidalab_app_design
38+
startup_and_deployment

0 commit comments

Comments
 (0)