Skip to content

Commit 885537f

Browse files
committed
Merge branch 'main' into feature/aiida-control-page
2 parents 15a9d10 + eddcf10 commit 885537f

File tree

15 files changed

+87
-54
lines changed

15 files changed

+87
-54
lines changed

.github/dependabot.yml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
---
2+
version: 2
3+
updates:
4+
# Maintain dependencies for GitHub Actions
5+
- package-ecosystem: github-actions
6+
directory: /
7+
schedule:
8+
interval: monthly
9+
groups:
10+
gha-dependencies:
11+
patterns:
12+
- '*'

.github/workflows/ci.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ jobs:
1313
runs-on: ubuntu-latest
1414

1515
steps:
16-
- uses: actions/checkout@v2
16+
- uses: actions/checkout@v4
1717

1818
- name: Setup Python
19-
uses: actions/setup-python@v2
19+
uses: actions/setup-python@v5
2020
with:
21-
python-version: 3.8
21+
python-version: 3.11
2222

2323
- name: Install dependencies
2424
run: |

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ jobs:
99
runs-on: ubuntu-latest
1010

1111
steps:
12-
- uses: softprops/action-gh-release@v0.1.14
12+
- uses: softprops/action-gh-release@v2.0.5
1313
name: Create release.
1414
with:
1515
generate_release_notes: true

.pre-commit-config.yaml

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -5,50 +5,38 @@ ci:
55
repos:
66

77
- repo: https://github.com/pre-commit/pre-commit-hooks
8-
rev: v4.4.0
8+
rev: v4.5.0
99
hooks:
1010
- id: check-json
1111
- id: check-yaml
1212
- id: end-of-file-fixer
1313
- id: trailing-whitespace
1414
exclude: miscellaneous/structures/SiO2.xyz
1515

16+
- repo: https://github.com/astral-sh/ruff-pre-commit
17+
rev: v0.3.5
18+
hooks:
19+
- id: ruff-format
20+
exclude: ^docs/.*
21+
- id: ruff
22+
args: [--fix, --exit-non-zero-on-fix, --show-fixes]
23+
1624
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
1725
rev: 0.2.3
1826
hooks:
1927
- id: yamlfmt
2028

21-
- repo: https://github.com/psf/black
22-
rev: 23.3.0
23-
hooks:
24-
- id: black
25-
language_version: python3 # Should be a command that runs python3.6+
26-
27-
- repo: https://github.com/PyCQA/flake8
28-
rev: 6.0.0
29-
hooks:
30-
- id: flake8
31-
args: [--count, --show-source, --statistics]
32-
additional_dependencies:
33-
- flake8-bugbear
34-
35-
- repo: https://github.com/pycqa/isort
36-
rev: 5.12.0
37-
hooks:
38-
- id: isort
39-
args: [--profile, black, --filter-files]
40-
4129
- repo: https://github.com/asottile/setup-cfg-fmt
42-
rev: v2.4.0
30+
rev: v2.5.0
4331
hooks:
4432
- id: setup-cfg-fmt
4533

4634
- repo: https://github.com/sirosen/check-jsonschema
47-
rev: 0.23.2
35+
rev: 0.28.1
4836
hooks:
4937
- id: check-github-workflows
5038

5139
- repo: https://github.com/kynan/nbstripout
52-
rev: 0.6.1
40+
rev: 0.7.1
5341
hooks:
5442
- id: nbstripout

appstore.ipynb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,9 @@
1919
"%%javascript\n",
2020
"IPython.OutputArea.prototype._should_scroll = function(lines) {\n",
2121
" return false;\n",
22+
"}\n",
23+
"if (document.getElementById('appmode-busy')) {\n",
24+
" window.onbeforeunload = function() {return}\n",
2225
"}"
2326
]
2427
},

home/app_manager.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# -*- coding: utf-8 -*-
21
"""Module that contains widgets for managing AiiDAlab applications."""
2+
33
from subprocess import CalledProcessError
44

55
import ipywidgets as ipw
@@ -69,9 +69,9 @@ def __init__(self, *args, **kwargs):
6969
)
7070

7171
super().__init__(
72+
*args,
7273
children=[self.installed_version, self.version_to_install, self.info],
7374
layout={"min_width": "300px"},
74-
*args,
7575
**kwargs,
7676
)
7777

@@ -207,7 +207,7 @@ def __init__(self, app, minimalistic=False):
207207
self.app.observe(
208208
self._refresh_prereleases, names=["has_prereleases", "installed_version"]
209209
)
210-
self._refresh_prereleases(change=dict(owner=self.app)) # initialize
210+
self._refresh_prereleases(change={"owner": self.app}) # initialize
211211

212212
children = [
213213
ipw.HBox([self.header_warning]),

home/app_store.py

Lines changed: 4 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
# -*- coding: utf-8 -*-
21
"""AiiDAlab app store."""
2+
33
import logging
44

55
import ipywidgets as ipw
@@ -21,7 +21,7 @@ def __init__(self):
2121
self.index = load_app_registry_index()
2222
except RuntimeError as error:
2323
logger.warning(error)
24-
self.index = dict(apps=[], categories=[])
24+
self.index = {"apps": [], "categories": []}
2525
self.output = ipw.Output()
2626

2727
# Apps per page.
@@ -120,12 +120,8 @@ def change_vis_list(self, _=None):
120120

121121
if self.category_filter.value:
122122
all_apps = self.apps_to_display
123-
self.apps_to_display = (
124-
[]
125-
) # clear the array that contains all the apps to be displayed
126-
self.app_corresponding_categories = (
127-
[]
128-
) # create a parallel array that contains corresponding category names
123+
self.apps_to_display = [] # clear the array that contains all the apps to be displayed
124+
self.app_corresponding_categories = [] # create a parallel array that contains corresponding category names
129125
# iterate over all categories
130126
for category in self.category_filter.value:
131127
category_key = self.category_title_key_mapping[category]

home/start_page.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
"""Module to generate AiiDAlab home page."""
2+
23
import json
34
from functools import wraps
45
from glob import glob
@@ -60,7 +61,7 @@ class AiidaLabHome:
6061
def __init__(self):
6162
self.config_fn = ".launcher.json"
6263
self.output = ipw.Output()
63-
self._app_widgets = dict()
64+
self._app_widgets = {}
6465

6566
def _create_app_widget(self, name):
6667
"""Create the widget representing the app on the home screen."""
@@ -92,7 +93,7 @@ def write_config(self, config):
9293

9394
def read_config(self):
9495
if path.exists(self.config_fn):
95-
return json.load(open(self.config_fn, "r"))
96+
return json.load(open(self.config_fn))
9697
return {"order": [], "hidden": []} # default config
9798

9899
def render(self):
@@ -124,7 +125,7 @@ def load_apps(self):
124125
apps.sort(key=lambda x: order.index(x) if x in order else -1)
125126
config["order"] = apps
126127
self.write_config(config)
127-
return ["home"] + apps
128+
return ["home", *apps]
128129

129130
def move_updown(self, name, delta):
130131
"""Move the app up/down on the start page."""

home/utils.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,15 +33,15 @@ def load_start_py(name):
3333
except TypeError:
3434
return mod.get_start_widget(appbase=appbase, jupbase=jupbase)
3535
except Exception: # pylint: disable=broad-except
36-
return ipw.HTML("<pre>{}</pre>".format(sys.exc_info()))
36+
return ipw.HTML(f"<pre>{sys.exc_info()}</pre>")
3737

3838

3939
def load_start_md(name):
4040
"""Load app appearance from a Markdown file."""
4141
fname = path.join(AIIDALAB_APPS, name, "start.md")
4242
try:
4343
md_src = open(fname).read()
44-
md_src = md_src.replace("](./", "](../{}/".format(name))
44+
md_src = md_src.replace("](./", f"](../{name}/")
4545
html = markdown(md_src)
4646

4747
# open links in new window/tab
@@ -52,7 +52,7 @@ def load_start_md(name):
5252
return ipw.HTML(html)
5353

5454
except Exception as exc: # pylint: disable=broad-except
55-
return ipw.HTML("Could not load start.md: {}".format(str(exc)))
55+
return ipw.HTML(f"Could not load start.md: {exc!s}")
5656

5757

5858
def load_logo(app):

home/widgets.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
# -*- coding: utf-8 -*-
21
"""AiiDAlab basic widgets."""
32

43
from threading import Timer
@@ -104,7 +103,7 @@ class AppStatusInfoWidget(ipw.HTML):
104103
"and avoid compatibility isssues."
105104
)
106105

107-
MESSAGES_UPDATES = {
106+
MESSAGES_UPDATES = { # noqa: RUF012
108107
AppStatus.CANNOT_REACH_REGISTRY: f'<div title="Unable to reach the registry server ({AIIDALAB_REGISTRY}).">'
109108
f'<font color="{Theme.COLORS.GRAY}">{Theme.ICONS.APP_UPDATE_AVAILABLE_UNKNOWN} '
110109
"Cannot reach server.</font></div>",

0 commit comments

Comments
 (0)