diff --git a/.readthedocs.yml b/.readthedocs.yml
index 0a01bb60e..1d335c1ab 100644
--- a/.readthedocs.yml
+++ b/.readthedocs.yml
@@ -1,25 +1,26 @@
---
-# .readthedocs.yaml
-# Read the Docs configuration file
+# Read the Docs configuration file for Sphinx projects
# See https://docs.readthedocs.io/en/stable/config-file/v2.html for details
# Required
version: 2
-# Set the version of Python and other tools you might need
+# Set the OS, Python version and other tools you might need
build:
- os: ubuntu-20.04
+ os: ubuntu-22.04
tools:
python: '3.10'
-# Build documentation in the docs/ directory with Sphinx
+# Build documentation in the "docs/" directory with Sphinx
sphinx:
configuration: docs/source/conf.py
+ builder: html
+ # Let the build fail if there are any warnings
+ fail_on_warning: true
-# If using Sphinx, optionally build your docs in additional formats such as PDF
-# formats:
-# - pdf
-
+# Optional but recommended, declare the Python requirements required
+# to build your documentation
+# See https://docs.readthedocs.io/en/stable/guides/reproducible-builds.html
python:
install:
- method: pip
diff --git a/aiidalab_widgets_base/bug_report.py b/aiidalab_widgets_base/bug_report.py
index a37eb681c..5a4944814 100644
--- a/aiidalab_widgets_base/bug_report.py
+++ b/aiidalab_widgets_base/bug_report.py
@@ -147,16 +147,18 @@ def install_create_github_issue_exception_handler(output, url, labels=None):
Example:
--------
- ```python
- output = ipw.Output()
- install_create_github_issue_exception_handler(
- output,
- url='https://github.com/aiidalab/aiidalab-qe/issues/new',
- labels=('bug', 'automated-report'))
-
- with output:
- display(welcome_message, app_with_work_chain_selector, footer)
- ```
+ .. highlight:: python
+ .. code-block:: python
+
+ output = ipw.Output()
+ install_create_github_issue_exception_handler(
+ output,
+ url='https://github.com/aiidalab/aiidalab-qe/issues/new',
+ labels=('bug', 'automated-report'))
+
+ with output:
+ display(welcome_message, app_with_work_chain_selector, footer)
+
"""
global _ORIGINAL_EXCEPTION_HANDLER
diff --git a/aiidalab_widgets_base/computational_resources.py b/aiidalab_widgets_base/computational_resources.py
index f390b6750..15bc45abd 100644
--- a/aiidalab_widgets_base/computational_resources.py
+++ b/aiidalab_widgets_base/computational_resources.py
@@ -796,7 +796,7 @@ def observe_memory_per_machine(change):
self.setup_button.on_click(self.on_setup_computer)
test_button = ipw.Button(description="Test computer")
test_button.on_click(self.test)
- self._test_out = ipw.Output(layout=LAYOUT)
+ self._test_out = ipw.HTML(layout=LAYOUT)
# Organize the widgets
children = [
@@ -881,14 +881,18 @@ def _configure_computer_local(self, computer: orm.Computer, user: orm.User):
def _run_callbacks_if_computer_exists(self, label):
"""Run things on an existing computer"""
- try:
- orm.Computer.objects.get(label=label)
+ if self._computer_exists(label):
for function in self._on_setup_computer_success:
function()
+ return True
+ return False
+
+ def _computer_exists(self, label):
+ try:
+ orm.load_computer(label=label)
except common.NotExistent:
return False
- else:
- return True
+ return True
def _validate_computer_settings(self):
if self.label.value == "": # check computer label
@@ -960,13 +964,31 @@ def on_setup_computer_success(self, function):
self._on_setup_computer_success.append(function)
def test(self, _=None):
- with self._test_out:
- clear_output()
- print(
- subprocess.check_output(
- ["verdi", "computer", "test", "--print-traceback", self.label.value]
- ).decode("utf-8")
+ if self.label.value == "":
+ self._test_out.value = "Please specify the computer name (for AiiDA)."
+ return False
+ elif not self._computer_exists(self.label.value):
+ self._test_out.value = (
+ f"A computer called {self.label.value} does not exist."
)
+ return False
+
+ self._test_out.value = ''
+ process_result = subprocess.run(
+ ["verdi", "computer", "test", "--print-traceback", self.label.value],
+ capture_output=True,
+ )
+
+ if process_result.returncode == 0:
+ self._test_out.value = process_result.stdout.decode("utf-8").replace(
+ "\n", "
"
+ )
+ return True
+ else:
+ self._test_out.value = process_result.stderr.decode("utf-8").replace(
+ "\n", "
"
+ )
+ return False
def _reset(self):
self.label.value = ""
@@ -1197,12 +1219,8 @@ class ComputerDropdownWidget(ipw.VBox):
"""Widget to select a configured computer.
Attributes:
- value(computer UUID): Trait that points to the selected Computer instance.
- It can be set to an AiiDA Computer UUID. It is linked to the
- 'value' trait of `self._dropdown` widget.
- computers(Dict): Trait that contains a dictionary (label => Computer UUID) for all
- computers found in the AiiDA database. It is linked to the 'options' trait of
- `self._dropdown` widget.
+ value(computer UUID): Trait that points to the selected Computer instance. It can be set to an AiiDA Computer UUID. It is linked to the 'value' trait of `self._dropdown` widget.
+ computers(Dict): Trait that contains a dictionary (label => Computer UUID) for all computers found in the AiiDA database. It is linked to the 'options' trait of `self._dropdown` widget.
allow_select_disabled(Bool): Trait that defines whether to show disabled computers.
"""
diff --git a/aiidalab_widgets_base/process.py b/aiidalab_widgets_base/process.py
index 4501b7884..ffb6c9efa 100644
--- a/aiidalab_widgets_base/process.py
+++ b/aiidalab_widgets_base/process.py
@@ -261,7 +261,7 @@ def __init__(
self,
process=None,
followers=None,
- update_interval=0.1,
+ update_interval=1.0,
path_to_root="../",
**kwargs,
):
@@ -302,7 +302,6 @@ def follow(self, detach=False):
if self._monitor is None:
self._monitor = ProcessMonitor(
- process=self.process,
callbacks=[self.update],
on_sealed=self._run_after_completed,
timeout=self.update_interval,
diff --git a/docs/Makefile b/docs/Makefile
index 218b9cf4c..e8de94c3b 100644
--- a/docs/Makefile
+++ b/docs/Makefile
@@ -1,41 +1,23 @@
-# Makefile for Sphinx documentation
+# Minimal makefile for Sphinx documentation
#
-# You can set these variables from the command line.
-SPHINXOPTS =
-SPHINXBUILD = sphinx-build
-PAPER =
+# You can set these variables from the command line, and also
+# from the environment for the first two.
+SPHINXOPTS ?=
+SPHINXBUILD ?= sphinx-build
+SOURCEDIR = source
BUILDDIR = build
-# User-friendly check for sphinx-build
-ifeq ($(shell which $(SPHINXBUILD) >/dev/null 2>&1; echo $$?), 1)
-$(error The '$(SPHINXBUILD)' command was not found. Make sure you have Sphinx installed, then set the SPHINXBUILD environment variable to point to the full path of the '$(SPHINXBUILD)' executable. Alternatively you can add the directory with the executable to your PATH. If you don't have Sphinx installed, grab it from http://sphinx-doc.org/)
-endif
+# Put it first so that "make" without argument is like "make help".
+help:
+ @$(SPHINXBUILD) -M help "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-# Internal variables.
-PAPEROPT_a4 = -D latex_paper_size=a4
-PAPEROPT_letter = -D latex_paper_size=letter
-ALLSPHINXOPTS = -n -d $(BUILDDIR)/doctrees $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
-# the i18n builder cannot share the environment and doctrees with the others
-I18NSPHINXOPTS = $(PAPEROPT_$(PAPER)) $(SPHINXOPTS) source
+.PHONY: help Makefile
-.PHONY: all help clean html dirhtml singlehtml pickle json htmlhelp qthelp devhelp epub latex latexpdf text man changes linkcheck doctest coverage gettext customdefault
+# Catch-all target: route all unknown targets to Sphinx using the new
+# "make mode" option. $(O) is meant as a shortcut for $(SPHINXOPTS).
+%: Makefile
+ @$(SPHINXBUILD) -M $@ "$(SOURCEDIR)" "$(BUILDDIR)" $(SPHINXOPTS) $(O)
-## Runs with nitty-pick and converting warnings into errors to
-## make sure the documentation is properly written
-customdefault:
- $(SPHINXBUILD) -b html -nW $(ALLSPHINXOPTS) $(BUILDDIR)/html
-
-all: html
-
-clean:
- rm -r $(BUILDDIR)
-
-html:
- $(SPHINXBUILD) -b html $(ALLSPHINXOPTS) $(BUILDDIR)/html
- @echo
- @echo "Build finished. The HTML pages are in $(BUILDDIR)/html."
-
-
-view:
- xdg-open $(BUILDDIR)/html/index.html
+rebuild:
+ @ make -s clean html
diff --git a/docs/source/_static/aiidalab_logo.png b/docs/source/_static/aiidalab_logo.png
new file mode 100644
index 000000000..7900ed508
Binary files /dev/null and b/docs/source/_static/aiidalab_logo.png differ
diff --git a/docs/source/conf.py b/docs/source/conf.py
index 03b7a4601..66cf0928d 100644
--- a/docs/source/conf.py
+++ b/docs/source/conf.py
@@ -24,15 +24,10 @@
"sphinx.ext.mathjax",
"sphinx.ext.intersphinx",
"sphinx.ext.viewcode",
- "sphinxcontrib.contentui",
"myst_nb",
]
-jupyter_execute_notebooks = "off"
-
-intersphinx_mapping = {
- "python": ("https://docs.python.org/3.9", None),
-}
+nb_execution_mode = "off"
# Add any paths that contain templates here, relative to this directory.
templates_path = ["_templates"]
@@ -92,6 +87,13 @@
html_theme = "pydata_sphinx_theme"
+# The pydata-sphinx-theme already loads the bootstrap css.
+panels_add_bootstrap_css = False
+
+# The name of an image file (relative to this directory) to place at the top
+# of the sidebar.
+html_logo = "_static/aiidalab_logo.png"
+
# -- Modifications for Readthedocs ----------------------------------------
diff --git a/docs/source/widget-list/index.rst b/docs/source/widget-list/index.rst
index 6c4f0d43c..71ca43782 100644
--- a/docs/source/widget-list/index.rst
+++ b/docs/source/widget-list/index.rst
@@ -12,9 +12,7 @@ See also the `corresponding git repository =2021.09.2
scikit-learn~=1.0.0
+docs =
+ sphinx
+ sphinx-design
+ pydata-sphinx-theme
+ myst-nb
+
[flake8]
ignore =