Skip to content

Commit 85e2a03

Browse files
pre-commit-ci[bot]tschaumegithub-actions
authored
[pre-commit.ci] pre-commit autoupdate (#483)
* [pre-commit.ci] pre-commit autoupdate updates: - [github.com/astral-sh/ruff-pre-commit: v0.5.0 → v0.13.3](astral-sh/ruff-pre-commit@v0.5.0...v0.13.3) - [github.com/pre-commit/pre-commit-hooks: v4.6.0 → v6.0.0](pre-commit/pre-commit-hooks@v4.6.0...v6.0.0) - [github.com/codespell-project/codespell: v2.3.0 → v2.4.1](codespell-project/codespell@v2.3.0...v2.4.1) - [github.com/kynan/nbstripout: 0.7.1 → 0.8.1](kynan/nbstripout@0.7.1...0.8.1) * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * fix/rm broken links * pre-commit fixes and linting * add kaleido dep * auto dependency upgrades * new image export Plotly API * auto dependency upgrades * try to avoid circular import for version * [pre-commit.ci] auto fixes from pre-commit.com hooks for more information, see https://pre-commit.ci * dynamic module import * fix dynamic import --------- Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com> Co-authored-by: Patrick Huck <[email protected]> Co-authored-by: github-actions <[email protected]>
1 parent 07002fe commit 85e2a03

33 files changed

+360
-370
lines changed

.pre-commit-config.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ exclude: ^(docs/.+|.*lock.*|jupyterlab-extension/.+|.*\.(svg|js|css))|_version.p
1111

1212
repos:
1313
- repo: https://github.com/astral-sh/ruff-pre-commit
14-
rev: v0.5.0
14+
rev: v0.13.3
1515
hooks:
1616
- id: ruff
1717
args: [--fix, --ignore, D]
@@ -23,7 +23,7 @@ repos:
2323
# - id: mypy
2424

2525
- repo: https://github.com/pre-commit/pre-commit-hooks
26-
rev: v4.6.0
26+
rev: v6.0.0
2727
hooks:
2828
- id: check-case-conflict
2929
- id: check-symlinks
@@ -33,14 +33,14 @@ repos:
3333
- id: trailing-whitespace
3434

3535
- repo: https://github.com/codespell-project/codespell
36-
rev: v2.3.0
36+
rev: v2.4.1
3737
hooks:
3838
- id: codespell
3939
stages: [pre-commit, commit-msg]
4040
args: [--ignore-words-list, "nd,te,ois,dscribe", --check-filenames]
4141

4242
- repo: https://github.com/kynan/nbstripout
43-
rev: 0.7.1
43+
rev: 0.8.1
4444
hooks:
4545
- id: nbstripout
4646
args: [--drop-empty-cells, --keep-output]

README.md

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@ If you would like a new-contributor issue assigned, get in touch with project ma
2626

2727
[![Tests](https://github.com/materialsproject/crystaltoolkit/actions/workflows/pytest-docs.yml/badge.svg)](https://github.com/materialsproject/crystaltoolkit/actions/workflows/pytest-docs.yml)
2828
[![Visual Regression Test Status](https://percy.io/static/images/percy-badge.svg)](https://percy.io/6f28436a/crystaltoolkit)
29-
[![Docker Build Status](https://img.shields.io/docker/cloud/build/materialsproject/crystaltoolkit)](https://hub.docker.com/repository/docker/materialsproject/crystaltoolkit/general)
3029
[![Release](https://github.com/materialsproject/crystaltoolkit/actions/workflows/release.yml/badge.svg)](https://github.com/materialsproject/crystaltoolkit/actions/workflows/release.yml)
3130
[![pre-commit.ci status](https://results.pre-commit.ci/badge/github/materialsproject/crystaltoolkit/main.svg)](https://results.pre-commit.ci/latest/github/materialsproject/crystaltoolkit/main)
3231
[![arXiv link](https://img.shields.io/badge/arXiv-2302.06147-blue)](https://arxiv.org/abs/2302.06147)
@@ -81,7 +80,7 @@ The [Crystal Toolkit Development Team](https://github.com/materialsproject/cryst
8180
* [Janosh Riebesell](https://github.com/janosh) contributed Phonon band structure component, [3 example apps](https://github.com/materialsproject/crystaltoolkit/blob/main/crystal_toolkit/apps/examples/matbench_dielectric_structure_on_hover.py), tests
8281
* [Stephen Weitzner](https://github.com/sweitzner) contributed POV-Ray integration (in progress)
8382
* [Richard Tran](https://github.com/CifLord) for contributing plotly-powered Wulff shapes to pymatgen, which Crystal Toolkit uses
84-
* [Guy Moore](https://github.com/guymoore13) for contributing magnetic moment visualization
83+
* Guy Moore for contributing magnetic moment visualization
8584
* [Steve Zeltmann](https://github.com/sezelt) for contributing electron diffraction
8685
* [Patrick Huck](https://github.com/tschaume), releases, operations, bugfixes and POC for MP / MPContribs
8786

@@ -101,7 +100,7 @@ Thank you to all the authors and maintainers of the libraries Crystal Toolkit
101100
depends upon, and in particular [pymatgen](http://pymatgen.org) for crystallographic
102101
analysis and [Dash from Plotly](https://plot.ly/products/dash/) for their web app framework.
103102

104-
Thank you to the [NERSC Spin](https://nersc.gov/systems/spin) service for
103+
Thank you to the [NERSC Spin](https://docs.nersc.gov/services/spin/) service for
105104
hosting the app and for their technical support.
106105

107106
## Contact

crystal_toolkit/apps/examples/mpcontribs/catalysis.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -436,15 +436,15 @@ def get_search_layout(self, payload=None):
436436
"Surface Formula": unicodeify(contribution["formula"]),
437437
"Surface Material ID": dcc.Link(
438438
contribution["data"]["mpid"],
439-
href=f'/materials/{contribution["data"]["mpid"]}',
439+
href=f"/materials/{contribution['data']['mpid']}",
440440
),
441441
"Adsorbate SMILES": adsorbate_smiles,
442442
"Adsorbate IUPAC Formula": contribution["data"]["adsorbateIUPACFormula"],
443443
"Adsorption Energy": contribution["data"]["adsorptionEnergy"]["value"],
444444
"Miller Index": unicodeify_spacegroup(
445-
f'({int(contribution["data"]["h"]["value"])} '
446-
f'{int(contribution["data"]["k"]["value"])} '
447-
f'{int(contribution["data"]["l"]["value"])})'
445+
f"({int(contribution['data']['h']['value'])} "
446+
f"{int(contribution['data']['k']['value'])} "
447+
f"{int(contribution['data']['l']['value'])})"
448448
),
449449
"Surface Shift": contribution["data"]["surfaceShift"]["value"],
450450
}

crystal_toolkit/apps/examples/tests/test_fermi_surface.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,13 @@
22

33
from typing import TYPE_CHECKING
44

5+
from crystal_toolkit.apps.examples.fermi_surface import app
6+
57
if TYPE_CHECKING:
68
from crystal_toolkit.apps.examples.tests.typing import DashDuo
79

810

911
def test_diffraction(dash_duo: DashDuo) -> None:
10-
from crystal_toolkit.apps.examples.fermi_surface import app
11-
1212
dash_duo.start_server(app)
1313
dash_duo.clear_storage()
1414

crystal_toolkit/apps/examples/utils.py

Lines changed: 22 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,16 @@
11
from __future__ import annotations
22

33
import os
4-
from typing import TYPE_CHECKING
54

5+
import pandas as pd
66
from dash import dcc
77
from pymatgen.symmetry.analyzer import SpacegroupAnalyzer
88
from tqdm import tqdm
99

10-
if TYPE_CHECKING:
11-
import pandas as pd
10+
try:
11+
from matminer.datasets import load_dataset
12+
except ImportError:
13+
load_dataset = None
1214

1315

1416
def load_and_store_matbench_dataset(dataset_name: str) -> pd.DataFrame:
@@ -18,34 +20,30 @@ def load_and_store_matbench_dataset(dataset_name: str) -> pd.DataFrame:
1820
data_path = os.path.join(os.path.dirname(__file__), f"{dataset_name}.json.gz")
1921

2022
if os.path.isfile(data_path):
21-
import pandas as pd
22-
2323
df = pd.read_json(data_path)
2424
else:
25-
try:
26-
from matminer.datasets import load_dataset
25+
if not load_dataset:
26+
raise ImportError(
27+
"matminer is not installed but needed to download a dataset. Run "
28+
"`pip install matminer`"
29+
)
2730

28-
df = load_dataset(dataset_name)
31+
df = load_dataset(dataset_name)
2932

30-
if "structure" in df:
31-
df[["spg_symbol", "spg_num"]] = [
32-
struct.get_space_group_info()
33-
for struct in tqdm(df.structure, desc="Getting space groups")
34-
]
33+
if "structure" in df:
34+
df[["spg_symbol", "spg_num"]] = [
35+
struct.get_space_group_info()
36+
for struct in tqdm(df.structure, desc="Getting space groups")
37+
]
3538

36-
df["crystal_sys"] = [
37-
SpacegroupAnalyzer(x).get_crystal_system() for x in df.structure
38-
]
39+
df["crystal_sys"] = [
40+
SpacegroupAnalyzer(x).get_crystal_system() for x in df.structure
41+
]
3942

40-
df["volume"] = [x.volume for x in df.structure]
41-
df["formula"] = [x.formula for x in df.structure]
43+
df["volume"] = [x.volume for x in df.structure]
44+
df["formula"] = [x.formula for x in df.structure]
4245

43-
df.to_json(data_path, default_handler=lambda x: x.as_dict())
44-
except ImportError:
45-
print(
46-
"matminer is not installed but needed to download a dataset. Run "
47-
"`pip install matminer`"
48-
)
46+
df.to_json(data_path, default_handler=lambda x: x.as_dict())
4947

5048
return df
5149

crystal_toolkit/apps/examples/write_structure_screenshot_to_file.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,8 +32,6 @@
3232

3333

3434
def get_structure_for_mpid(mpid):
35-
from pymatgen.ext.matproj import MPRester
36-
3735
with MPRester() as mpr:
3836
structure = mpr.get_structure_by_material_id(mpid)
3937

crystal_toolkit/apps/main.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -461,7 +461,7 @@ def perform_search_on_page_load(
461461
"""
462462
# TODO: could be a client side callback
463463
if n_submit is None:
464-
return 1, int(round(time() * 1000))
464+
return 1, round(time() * 1000)
465465
raise PreventUpdate
466466

467467

crystal_toolkit/apps/tests/test_main.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,13 @@
33
import time
44
from typing import TYPE_CHECKING
55

6+
from crystal_toolkit.apps.main import app
7+
68
if TYPE_CHECKING:
79
from crystal_toolkit.apps.examples.tests.typing import DashDuo
810

911

1012
def test_main_app_startup(dash_duo: DashDuo):
11-
from crystal_toolkit.apps.main import app
12-
1313
dash_duo.start_server(app)
1414
# dash_duo.clear_storage()
1515

crystal_toolkit/apps/tests/test_pourbaix.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22

33
from playwright.sync_api import Page
44

5+
from crystal_toolkit.apps.examples.pourbaix import app
56

6-
def test_pourbaix(page: Page):
7-
from crystal_toolkit.apps.examples.pourbaix import app
87

8+
def test_pourbaix(page: Page):
99
thread = threading.Thread(target=app.run)
1010
thread.start()
1111

crystal_toolkit/apps/tests/test_structure.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@
33

44
from playwright.sync_api import Page, expect
55

6+
from crystal_toolkit.apps.examples.structure import app
67

7-
def test_structure(page: Page):
8-
from crystal_toolkit.apps.examples.structure import app
98

9+
def test_structure(page: Page):
1010
thread = threading.Thread(target=app.run)
1111
thread.start()
1212

0 commit comments

Comments
 (0)