From eaacfa2e29db8f32b7fe44f7c6901d1991be7988 Mon Sep 17 00:00:00 2001 From: Jimmy Shen <14003693+jmmshn@users.noreply.github.com> Date: Wed, 10 Jan 2024 17:19:07 -0800 Subject: [PATCH] Patch Numba Dep (#167) * allow linelabels, bulk_stability * cover * docs * njit * njit --- pymatgen/analysis/defects/recombination.py | 10 +++++++++- pyproject.toml | 2 +- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/pymatgen/analysis/defects/recombination.py b/pymatgen/analysis/defects/recombination.py index b4789645..4fd2b746 100644 --- a/pymatgen/analysis/defects/recombination.py +++ b/pymatgen/analysis/defects/recombination.py @@ -9,11 +9,19 @@ from typing import TYPE_CHECKING import numpy as np -from numba import njit from scipy.interpolate import PchipInterpolator from .constants import AMU2KG, ANGS2M, EV2J, HBAR_EV, HBAR_J, KB, LOOKUP_TABLE +try: + from numba import njit +except ImportError: + + def njit(*args, **kwargs): + """Dummy decorator for njit.""" + return lambda func: func + + if TYPE_CHECKING: from numpy import typing as npt diff --git a/pyproject.toml b/pyproject.toml index 6f146219..f512d8b2 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -34,7 +34,7 @@ dev = ["pre-commit>=2.12.1"] docs = [ "jupyter-book>=0.13.1", ] -pydefect = ["pydefect>=0.6.2"] +optional = ["pydefect>=0.6.2", "dscribe>=2.0.0", "numba"] strict = [ "pymatgen==2023.10.11",