Coverage for eminus/version.py: 94.74%

19 statements  

« prev     ^ index     » next       coverage.py v7.7.0, created at 2025-03-18 09:20 +0000

1# SPDX-FileCopyrightText: 2021 The eminus developers 

2# SPDX-License-Identifier: Apache-2.0 

3"""Package version number and version info function.""" 

4 

5import importlib.metadata 

6import platform 

7import sys 

8 

9__version__ = "3.0.3" 

10#: eminus ASCII logo. 

11LOGO = (" ___ _____ _ ___ _ _ ___ \n" 

12 "| -_| | | | | |_ -|\n" 

13 "|___|_|_|_|_|_|_|___|___|") # fmt: skip 

14 

15 

16def info(): 

17 """Print version numbers and availability of packages.""" 

18 dependencies = ("numpy", "scipy") 

19 extras = ("dftd3", "h5py", "pyscf", "torch", "plotly", "nglview") 

20 dev = ("pylibxc", "mypy", "notebook", "pytest", "ruff", "sphinx") 

21 

22 sys.stdout.write("\n".join([f"{line:>35}" for line in LOGO.split("\n")])) 

23 sys.stdout.write( 

24 "\n\neminus - Pythonic electronic structure theory" 

25 "\n https://doi.org/10.1016/j.softx.2025.102035\n" 

26 "\n--- Platform infos ---" 

27 f"\nPlatform : {platform.system()} {platform.machine()}" 

28 f"\nRelease : {platform.release()} {platform.version()}" 

29 "\n\n--- Version infos ---" 

30 f"\npython : {sys.version.split()[0]}" 

31 f"\neminus : {__version__}\n" 

32 ) 

33 for pkg in dependencies + extras + dev: 

34 try: 

35 sys.stdout.write(f"{pkg:<11}: {importlib.metadata.version(pkg)}\n") 

36 except ModuleNotFoundError: # noqa: PERF203 

37 if pkg in dependencies: 

38 sys.stdout.write(f"{pkg:<11}: Dependency not installed\n") 

39 elif pkg in extras: 

40 sys.stdout.write(f"{pkg:<11}: Extra not installed\n")