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

Fix/remove deprecations #519

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
7 changes: 1 addition & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ concurrency:
jobs:

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

runs-on: ubuntu-latest

Expand All @@ -32,11 +31,7 @@ jobs:
**/pyproject.toml
**/requirements*.txt

- name: Install dependencies
run: python -m pip install pre-commit~=2.20

- name: Run pre-commit
run: pre-commit run --all-files || ( git status --short ; git diff ; exit 1 )
- uses: pre-commit/[email protected]


test-package:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ jobs:

steps:

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

- name: Set up Python 3.10
uses: actions/setup-python@v2
Expand Down
39 changes: 39 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,3 +4,42 @@ requires = [
"wheel"
]
build-backend = "setuptools.build_meta"

[tool.pytest.ini_options]
filterwarnings = [
'error',
'ignore:Creating AiiDA configuration:UserWarning:aiida',
# For some reason we get this error, perhaps because we do
# not unload the AiiDA profile? Let's ignore this for now.
# E pytest.PytestUnraisableExceptionWarning: Exception ignored in: <function Popen.__del__>
# E Traceback (most recent call last):
# E File "/opt/conda/lib/python3.9/subprocess.py", line 1052, in __del__
# E _warn("subprocess %s is still running" % self.pid,
# E ResourceWarning: subprocess 382685 is still running
'ignore:Exception ignored in:pytest.PytestUnraisableExceptionWarning:_pytest',
# TODO: This comes from a transitive dependency of optimade_client
# Remove this when this issue is addressed:
# https://github.com/CasperWA/ipywidgets-extended/issues/85
'ignore::DeprecationWarning:ipywidgets_extended',
# TODO: StructureManagerWidget pass arguments by kwargs to StructureDataViewer and will be deprecated.
# E DeprecationWarning: Passing unrecognized arguments to super(StructureManagerWidget).__init__(configuration_tabs=['Cell', 'Selection', 'Appearance', 'Download']).
# E object.__init__() takes exactly one argument (the instance to initialize)
# E This is deprecated in traitlets 4.2.This error will be raised in a future release of traitlets.
'ignore::DeprecationWarning:ipywidgets',
'ignore::DeprecationWarning:ase.atoms',
# TODO: bandsplot_widget has an issue in schema validation
# > result._update_view()
#
# tests/test_plugins_bands.py:12:
# _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
# src/aiidalab_qe/plugins/bands/result.py:40: in _update_view
# _bands_plot_view = BandsPlotWidget(
# ../../.local/lib/python3.9/site-packages/widget_bandsplot/bandsplot.py:112: in __init__
# validate(instance=i, schema=BANDS_SCHEMA)
# /opt/conda/lib/python3.9/site-packages/jsonschema/validators.py:928: in validate
# cls = validator_for(schema)
'ignore::DeprecationWarning:jsonschema',
# TODO: use uuid instead of node object in WorkChainViewer.
# Otherwise, the `Instance '<DbNode at 0x7f2f1bd885b0>' is not persistent within this Session` exception is raised.
'ignore::pytest.PytestUnhandledThreadExceptionWarning:_pytest',
]
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ install_requires =
aiida-core~=2.2,<3
Jinja2~=3.0
aiida-quantumespresso~=4.3.0
aiidalab-widgets-base~=2.0.2
aiidalab-widgets-base==2.1.0a0
filelock~=3.8
importlib-resources~=5.2
widget-bandsplot~=0.5.1
Expand Down
1 change: 1 addition & 0 deletions src/aiidalab_qe/app/configuration/advanced.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@ class AdvancedSettings(Panel):

# protocol interface
protocol = tl.Unicode(allow_none=True)
# TODO: (unckpz) the DbNode persistence issue will be raised if using AiiDA Node as the trait.
input_structure = tl.Instance(orm.StructureData, allow_none=True)
spin_type = tl.Unicode()
electronic_type = tl.Unicode()
Expand Down
2 changes: 1 addition & 1 deletion src/aiidalab_qe/app/result/workchain_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -111,11 +111,11 @@ def toggle_camera():
**kwargs,
)
self._process_monitor = ProcessMonitor(
process=self.node,
callbacks=[
self._update_view,
],
)
self._process_monitor.value = self.node.uuid

def _update_view(self):
with self.hold_trait_notifications():
Expand Down
6 changes: 3 additions & 3 deletions src/aiidalab_qe/common/widgets.py
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ def _observe_value(self, change):
class CalcJobOutputFollower(traitlets.HasTraits):
calcjob_uuid = traitlets.Unicode(allow_none=True)
filename = traitlets.Unicode(allow_none=True)
output = traitlets.List(trait=traitlets.Unicode)
output = traitlets.List(trait=traitlets.Unicode())
lineno = traitlets.Int()

def __init__(self, **kwargs):
Expand Down Expand Up @@ -430,8 +430,8 @@ class AddingTagsEditor(ipw.VBox):
"""Editor for adding tags to atoms."""

structure = traitlets.Instance(ase.Atoms, allow_none=True)
selection = traitlets.List(traitlets.Int, allow_none=True)
input_selection = traitlets.List(traitlets.Int, allow_none=True)
selection = traitlets.List(traitlets.Int(), allow_none=True)
input_selection = traitlets.List(traitlets.Int(), allow_none=True)
structure_node = traitlets.Instance(orm_Data, allow_none=True, read_only=True)

def __init__(self, title=""):
Expand Down
30 changes: 13 additions & 17 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
from __future__ import annotations

import io
import pathlib
import tempfile
Expand Down Expand Up @@ -301,15 +303,10 @@ def app(pw_code, dos_code, projwfc_code):
app.submit_step.pw_code.refresh()
app.submit_step.codes["dos"].refresh()
app.submit_step.codes["projwfc"].refresh()
app.submit_step.pw_code.value = (
app.submit_step.pw_code.code_select_dropdown.options[pw_code.full_label]
)
app.submit_step.codes["dos"].value = app.submit_step.codes[
"dos"
].code_select_dropdown.options[dos_code.full_label]
app.submit_step.codes["projwfc"].value = app.submit_step.codes[
"projwfc"
].code_select_dropdown.options[projwfc_code.full_label]

app.submit_step.pw_code.value = pw_code.uuid
app.submit_step.codes["dos"].value = dos_code.uuid
app.submit_step.codes["projwfc"].value = projwfc_code.uuid

yield app

Expand Down Expand Up @@ -558,12 +555,15 @@ def _generate_bands_workchain(structure):

@pytest.fixture
def generate_qeapp_workchain(
app, generate_workchain, generate_pdos_workchain, generate_bands_workchain
app,
generate_workchain,
generate_pdos_workchain,
generate_bands_workchain,
):
"""Generate an instance of the WorkChain."""

def _generate_qeapp_workchain(
structure=None,
structure: orm.StructureData | None = None,
relax_type="positions_cell",
run_bands=True,
run_pdos=True,
Expand All @@ -580,17 +580,13 @@ def _generate_qeapp_workchain(
s1 = app.structure_step
if structure is None:
from_example = s1.manager.children[0].children[3]
# TODO: (unkpcz) using options to set value in test is cranky, instead, use fixture which will make the test more static and robust.
from_example.children[0].value = from_example.children[0].options[1][1]
else:
structure.store()
aiida_database = s1.manager.children[0].children[2]
aiida_database.search()
key = [
key
for key in aiida_database.results.options
if key.startswith(f"PK: {structure.pk}")
][0]
aiida_database.results.value = aiida_database.results.options[key]
aiida_database.results.value = structure
s1.confirm()
structure = s1.confirmed_structure
# step 2 configure
Expand Down
1 change: 0 additions & 1 deletion tests/test_plugins_bands.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ def test_result(generate_qeapp_workchain):
from aiidalab_qe.plugins.bands.result import Result, export_bands_data

wkchain = generate_qeapp_workchain()
#
data = export_bands_data(wkchain.node.outputs.bands)
assert data is not None
# generate structure for scf calculation
Expand Down
2 changes: 1 addition & 1 deletion tests/test_result.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,5 +76,5 @@ def test_summary_view(generate_qeapp_workchain):
"Initial Magnetic Moments": "",
}
for key, value in parameters.items():
td = parsed.find("td", text=key).find_next_sibling("td")
td = parsed.find("td", string=key).find_next_sibling("td")
assert td.text == value