Hot-keys on this page
r m x p toggle line displays
j k next/prev highlighted chunk
0 (zero) top of page
1 (one) first highlighted chunk
1import importlib
2from typing import List, Tuple
3from ase.utils import search_current_git_hash
6def format_dependency(modname: str) -> Tuple[str, str]:
7 """Return (name, path) for given module."""
8 try:
9 module = importlib.import_module(modname)
10 except ImportError:
11 return modname, 'not installed'
13 version = getattr(module, '__version__', '?')
14 name = f'{modname}-{version}'
15 if modname == 'ase':
16 githash = search_current_git_hash(module)
17 if githash:
18 name += '-{:.10}'.format(githash)
20 # (only packages have __path__, but we are importing packages.)
21 return name, str(module.__path__[0]) # type: ignore
24def all_dependencies() -> List[Tuple[str, str]]:
25 names = ['ase', 'numpy', 'scipy', 'matplotlib', 'spglib',
26 'ase_ext', 'flask', 'psycopg2', 'pyamg']
27 return [format_dependency(name) for name in names]