Skip to content

Commit

Permalink
Fix imports
Browse files Browse the repository at this point in the history
  • Loading branch information
danielhollas committed Aug 13, 2024
1 parent 04bf74d commit 9f4e503
Show file tree
Hide file tree
Showing 7 changed files with 16 additions and 14 deletions.
16 changes: 9 additions & 7 deletions src/aiidalab_qe/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,6 @@

import click

from aiida import load_profile
from aiidalab_qe.setup.setup_codes import codes_are_setup
from aiidalab_qe.setup.setup_codes import install as install_qe_codes

# The default profile name of AiiDAlab container.
_DEFAULT_PROFILE = "default"

Expand All @@ -22,9 +18,12 @@ def cli():
@click.option("-f", "--force", is_flag=True)
@click.option("-p", "--profile", default=_DEFAULT_PROFILE)
def install_qe(force, profile):
from aiida import load_profile
from aiidalab_qe.setup.setup_codes import codes_are_setup, install

load_profile(profile)
try:
for msg in install_qe_codes(force=force):
for msg in install(force=force):
click.echo(msg)
assert codes_are_setup()
click.secho("Codes are setup!", fg="green")
Expand All @@ -45,7 +44,8 @@ def install_pseudos(profile, source):
"""Install pseudopotentials from a local folder if source is specified,
otherwise download from remote repositories.
"""
from aiidalab_qe.common.setup_pseudos import install
from aiida import load_profile
from aiidalab_qe.setup.setup_pseudos import install

load_profile(profile)

Expand Down Expand Up @@ -90,9 +90,11 @@ def download_pseudos(dest):
)
@click.option("-p", "--profile", default=_DEFAULT_PROFILE)
def test_plugin(plugin_name, profile):
load_profile(profile)
from aiida import load_profile
from aiidalab_qe.app.utils import test_plugin_functionality

load_profile(profile)

try:
success, message = test_plugin_functionality(plugin_name)
if success:
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/app/configuration/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
from aiida_quantumespresso.workflows.pw.base import PwBaseWorkChain
from aiidalab_qe.app.parameters import DEFAULT_PARAMETERS
from aiidalab_qe.common.panel import Panel
from aiidalab_qe.common.setup_pseudos import PseudoFamily
from aiidalab_qe.common.widgets import HubbardWidget
from aiidalab_qe.setup.setup_pseudos import PseudoFamily

from .pseudos import PseudoFamilySelector, PseudoSetter

Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/app/configuration/pseudos.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
from aiida.plugins import DataFactory, GroupFactory
from aiida_quantumespresso.workflows.pw.base import PwBaseWorkChain
from aiidalab_qe.app.parameters import DEFAULT_PARAMETERS
from aiidalab_qe.common.setup_pseudos import (
from aiidalab_qe.setup.setup_pseudos import (
PSEUDODOJO_VERSION,
SSSP_VERSION,
PseudoFamily,
Expand Down
2 changes: 1 addition & 1 deletion tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import tempfile

import pytest
from aiidalab_qe.common.setup_pseudos import SSSP_VERSION
from aiidalab_qe.setup.setup_pseudos import SSSP_VERSION

from aiida import orm

Expand Down
4 changes: 2 additions & 2 deletions tests/test_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ def test_download_and_install_pseudos(tmp_path, aiida_profile, monkeypatch):
Note: this test is slow, it takes about ~30 seconds to run.
"""
from aiidalab_qe.common.setup_pseudos import (
from aiidalab_qe.setup.setup_pseudos import (
PSEUDODOJO_VERSION,
SSSP_VERSION,
pseudos_to_install,
Expand All @@ -39,7 +39,7 @@ def test_download_and_install_pseudos(tmp_path, aiida_profile, monkeypatch):
}
# mock the EXPECTED_PSEUDOS
monkeypatch.setattr(
"aiidalab_qe.common.setup_pseudos.EXPECTED_PSEUDOS",
"aiidalab_qe.setup.setup_pseudos.EXPECTED_PSEUDOS",
MOCK_EXPECTED_PSEUDOS,
)

Expand Down
2 changes: 1 addition & 1 deletion tests/test_configure.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
from aiidalab_qe.common.setup_pseudos import PSEUDODOJO_VERSION, SSSP_VERSION
from aiidalab_qe.setup.setup_pseudos import PSEUDODOJO_VERSION, SSSP_VERSION


def test_protocol():
Expand Down
2 changes: 1 addition & 1 deletion tests/test_pseudo.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import pytest
from aiidalab_qe.common.setup_pseudos import (
from aiidalab_qe.setup.setup_pseudos import (
PSEUDODOJO_VERSION,
SSSP_VERSION,
_construct_cmd,
Expand Down

0 comments on commit 9f4e503

Please sign in to comment.