abinit / abipy

Open-source library for analyzing the results produced by ABINIT

Home Page:http://abinit.github.io/abipy

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

πŸ› `NameError`: name 'TYPE_CHECKING' is not defined

mbercx opened this issue Β· comments

Ran into another test failure when trying with the latest abipy develop branch, see:

https://github.com/aiidateam/aiida-common-workflows/actions/runs/5925589563/job/16065306425?pr=314

The error is the following:

/root/.aiida_venvs/w2k/lib/python3.8/site-packages/abipy/tools/typing.py:12: in <module>
    if TYPE_CHECKING:  # needed to avoid circular imports
E   NameError: name 'TYPE_CHECKING' is not defined

The relevant lines are:

from pymatgen.util.typing import *
if TYPE_CHECKING: # needed to avoid circular imports
from matplotlib.pyplot import Axes
from matplotlib.figure import Figure
from abipy.core.kpoints import Kpoint
else:
Axes = Any
Figure = Any
Kpoint = Any

I'm assuming a direct import or TYPE_CHECKING from the standard library module should do the trick, will give it a try and open a PR.