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

Release 22.08.0 #105

Merged
merged 20 commits into from
Aug 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
f4b4a0c
[pre-commit.ci] pre-commit autoupdate (#78)
pre-commit-ci[bot] Feb 21, 2022
ebd08e2
CI: Update pre-commit config. (#79)
csadorf Feb 21, 2022
8de75a8
[pre-commit.ci] pre-commit autoupdate (#80)
pre-commit-ci[bot] Feb 22, 2022
90131b4
[pre-commit.ci] pre-commit autoupdate (#81)
pre-commit-ci[bot] Mar 1, 2022
269a11a
[pre-commit.ci] pre-commit autoupdate (#83)
pre-commit-ci[bot] Apr 5, 2022
102abd2
[pre-commit.ci] pre-commit autoupdate (#84)
pre-commit-ci[bot] Apr 12, 2022
fe03aae
[pre-commit.ci] pre-commit autoupdate (#85)
pre-commit-ci[bot] Apr 19, 2022
5a9a479
[pre-commit.ci] pre-commit autoupdate (#86)
pre-commit-ci[bot] May 17, 2022
20e4a77
Update min version of aiidalab dependency. (#87)
yakutovicha May 19, 2022
55d7e7d
[pre-commit.ci] pre-commit autoupdate (#88)
pre-commit-ci[bot] May 31, 2022
c2f0c8d
[pre-commit.ci] pre-commit autoupdate (#89)
pre-commit-ci[bot] Jun 7, 2022
c012f81
[pre-commit.ci] pre-commit autoupdate (#91)
pre-commit-ci[bot] Jun 14, 2022
1f86493
[pre-commit.ci] pre-commit autoupdate (#92)
pre-commit-ci[bot] Jun 28, 2022
be9c9fe
[pre-commit.ci] pre-commit autoupdate (#93)
pre-commit-ci[bot] Jul 5, 2022
193cce2
[pre-commit.ci] pre-commit autoupdate (#97)
pre-commit-ci[bot] Jul 12, 2022
e3b659a
[pre-commit.ci] pre-commit autoupdate (#98)
pre-commit-ci[bot] Jul 20, 2022
63236dc
Implement open_app tool. (#96)
csadorf Jul 21, 2022
5b7d68e
Suppress compatibility warnings during app installation (#101)
csadorf Jul 27, 2022
571d6eb
[pre-commit.ci] pre-commit autoupdate (#99)
pre-commit-ci[bot] Jul 27, 2022
175fccd
Aiida 2.0 (#102)
csadorf Jul 28, 2022
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
27 changes: 14 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
# Run basic tests for this app on the latest aiidalab-docker image.

name: continuous-integration
Expand All @@ -6,22 +7,22 @@ on: [push, pull_request]

jobs:

pre-commit:
pre-commit:
# Adapted from: https://github.com/CasperWA/voila-optimade-client

runs-on: ubuntu-latest
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2
steps:
- uses: actions/checkout@v2

- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8
- name: Setup Python
uses: actions/setup-python@v2
with:
python-version: 3.8

- name: Install dependencies
run: |
pip install .[pre_commit]
- name: Install dependencies
run: |
pip install .[pre_commit]

- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
58 changes: 43 additions & 15 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,46 @@
---
repos:
- repo: https://github.com/psf/black
rev: 20.8b1
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+

- repo: https://gitlab.com/pycqa/flake8
rev: '3.8.4'
hooks:
- id: flake8
args: [--count, --show-source, --statistics]
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v4.3.0
hooks:
- id: check-json
- id: check-yaml
- id: end-of-file-fixer
- id: trailing-whitespace
exclude: miscellaneous/structures/SiO2.xyz

- repo: https://github.com/pycqa/isort
rev: 5.6.4
hooks:
- id: isort
args: ["--profile", "black", "--filter-files"]
- repo: https://github.com/jumanjihouse/pre-commit-hook-yamlfmt
rev: 0.2.2
hooks:
- id: yamlfmt

- repo: https://github.com/psf/black
rev: 22.6.0
hooks:
- id: black
language_version: python3 # Should be a command that runs python3.6+

- repo: https://github.com/PyCQA/flake8
rev: 4.0.1
hooks:
- id: flake8
args: [--count, --show-source, --statistics]
additional_dependencies:
- flake8-bugbear==21.3.1

- repo: https://github.com/pycqa/isort
rev: 5.10.1
hooks:
- id: isort
args: [--profile, black, --filter-files]

- repo: https://github.com/asottile/setup-cfg-fmt
rev: v1.20.2
hooks:
- id: setup-cfg-fmt

- repo: https://github.com/sirosen/check-jsonschema
rev: 0.17.1
hooks:
- id: check-github-workflows
2 changes: 1 addition & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
SOFTWARE.
13 changes: 11 additions & 2 deletions home/app_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,11 @@ def _refresh_widget_state(self, _=None):
# Check app compatibility and show banner if not compatible.
self.compatibility_warning.layout.visibility = (
"visible"
if (self.app.is_installed() and self.app.compatible is False)
if (
not busy
and self.app.is_installed()
and self.app.compatible is False
)
else "hidden"
)

Expand Down Expand Up @@ -374,6 +378,8 @@ def _refresh_widget_state(self, _=None):
self.issue_indicator.value = f'<i class="fa fa-{warn_or_ban_icon}"></i> Unable to reach the registry server.'
elif not registered:
self.issue_indicator.value = f'<i class="fa fa-{warn_or_ban_icon}"></i> The app is not registered.'
elif busy:
self.issue_indicator.value = ""
elif detached:
self.issue_indicator.value = (
f'<i class="fa fa-{warn_or_ban_icon}"></i> The app has local modifications or was checked out '
Expand All @@ -388,7 +394,8 @@ def _refresh_widget_state(self, _=None):
)

if (
any(self.app.compatibility_info.values())
not busy
and any(self.app.compatibility_info.values())
and self.app.compatible is False
):
self.compatibility_info.value = self.COMPATIBILITY_INFO.render(
Expand Down Expand Up @@ -429,6 +436,7 @@ def _install_version(self, _=None):
self._show_msg_success(
f"Installed app ({self._formatted_version(version)})."
)
self.dependencies_log.value = ""

def _update_app(self, _):
"""Attempt to update the app."""
Expand All @@ -439,6 +447,7 @@ def _update_app(self, _):
self._show_msg_failure(str(error))
else:
self._show_msg_success("Updated app.")
self.dependencies_log.value = ""

def _uninstall_app(self, _):
"""Attempt to uninstall the app."""
Expand Down
132 changes: 132 additions & 0 deletions open_app.ipynb
Original file line number Diff line number Diff line change
@@ -0,0 +1,132 @@
{
"cells": [
{
"cell_type": "code",
"execution_count": null,
"id": "1e6a8c8c",
"metadata": {},
"outputs": [],
"source": [
"import urllib.parse as urlparse\n",
"import ipywidgets as ipw"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "7e7e205e",
"metadata": {},
"outputs": [],
"source": [
"import sys\n",
"from aiidalab.__main__ import _find_version_to_install, _parse_requirement\n",
"from aiidalab.utils import PEP508CompliantUrl\n",
"\n",
"\n",
"def identify_app_and_version(app_query, prereleases, force): \n",
" try:\n",
" requirement = _parse_requirement(app_query)\n",
" except Exception as error:\n",
" raise RuntimeError(str(error)) from error\n",
" \n",
" try:\n",
" return _find_version_to_install(\n",
" requirement,\n",
" dependencies=\"install\",\n",
" force=force,\n",
" python_bin=sys.executable,\n",
" prereleases=prereleases)\n",
" except Exception as error:\n",
" raise RuntimeError(str(error)) from error"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "b3e749de",
"metadata": {},
"outputs": [],
"source": [
"url = urlparse.urlsplit(jupyter_notebook_url)\n",
"\n",
"query = urlparse.parse_qs(url.query)"
]
},
{
"cell_type": "code",
"execution_count": null,
"id": "c25a71a5",
"metadata": {},
"outputs": [],
"source": [
"from home.widgets import LogOutputWidget, Spinner, StatusHTML\n",
"from IPython.display import Javascript\n",
"\n",
"header = ipw.HTML()\n",
"logs = LogOutputWidget(layout=ipw.Layout(min_height=\"250px\", max_height=\"100px\"))\n",
"spinner = Spinner()\n",
"\n",
"display(ipw.VBox([ipw.HBox([header, spinner]), logs]))\n",
"\n",
"try:\n",
" try:\n",
" app_query = query[\"app\"][0]\n",
" except KeyError:\n",
" raise RuntimeError(\"No app to install specified.\")\n",
" \n",
" force = query.get(\"force\", [False])[0]\n",
" prereleases = query.get(\"prereleases\", [False])[0]\n",
" \n",
" app, version = identify_app_and_version(query[\"app\"][0], force=force, prereleases=prereleases)\n",
"except Exception as error:\n",
" header.value = f\"Error: {error}\"\n",
"\n",
"try:\n",
" if version is None:\n",
" header.value = \"App already installed.\"\n",
" else:\n",
" header.value = f\"Installing app '{app.name}': {version}...\"\n",
"\n",
" spinner.enabled = True\n",
" app.install(\n",
" version=version,\n",
" install_dependencies=True,\n",
" python_bin=sys.executable,\n",
" stdout=logs,\n",
" )\n",
"except Exception as error:\n",
" header.value = f\"Error while trying to install the app: {error}\"\n",
"else:\n",
" redirect = query.get(\"redirect\", None)\n",
" if redirect:\n",
" redirect_url = urlparse.urlunsplit(url._replace(path=redirect[0], query=None, fragment=None))\n",
" header.value = f'Redirecting now to <a href=\"{redirect_url}\">{redirect_url}</a>...'\n",
" js = Javascript(f\"window.location = '{redirect_url}'\")\n",
" display(js)\n",
"finally:\n",
" spinner.enabled = False"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3 (ipykernel)",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.9"
}
},
"nbformat": 4,
"nbformat_minor": 5
}
28 changes: 16 additions & 12 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -1,38 +1,42 @@
[metadata]
name = aiidalab-home
name = aiidalab_home
version = attr: home.__version__
author = The AiiDAlab Team
author_email = aiidalab@materialscloud.org
description = Package for the AiiDAlab Home app.
long_description = file: README.md
long_description_content_type = text/markdown
url = https://github.com/aiidalab/aiidalab-home
project_urls =
Bug Tracker = https://github.com/aiidalab/aiidalab-home/issues
author = The AiiDAlab Team
author_email = aiidalab@materialscloud.org
license = MIT
license_file = LICENSE.txt
classifiers =
Development Status :: 4 - Beta
Framework :: AiiDA
License :: OSI Approved :: MIT License
Programming Language :: Python :: 3.7
Programming Language :: Python :: 3
Programming Language :: Python :: 3 :: Only
Programming Language :: Python :: 3.8
Programming Language :: Python :: 3.9
Programming Language :: Python :: 3.10
project_urls =
Bug Tracker = https://github.com/aiidalab/aiidalab-home/issues

[options]
packages = find:
python_requires = >=3.7
install_requires =
aiidalab>=v21.06.0
ipython~=7.25
Jinja2>=2.11.3,<4
Markdown>=3.4
aiidalab>=v21.10.2
ipython~=7.0
ipywidgets~=7.6
jinja2~=2.11
traitlets~=4.3
traitlets~=5.0
python_requires = >=3.8

[options.extras_require]
pre_commit =
pre-commit==2.15.0

[flake8]
# Adapted from: https://github.com/CasperWA/voila-optimade-client
ignore =
E501 # Line length handled by black.
W503 # Line break before binary operator, preferred formatting for black.
Expand Down