Coverage for eminus/version.py: 86.96%
23 statements
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 11:47 +0000
« prev ^ index » next coverage.py v7.6.4, created at 2024-11-01 11:47 +0000
1# SPDX-FileCopyrightText: 2021 The eminus developers
2# SPDX-License-Identifier: Apache-2.0
3"""Package version number and version info function."""
5import importlib
6import platform
7import sys
9__version__ = "3.0.0"
10#: eminus ASCII logo.
11LOGO = (" ___ _____ _ ___ _ _ ___ \n"
12 "| -_| | | | | |_ -|\n"
13 "|___|_|_|_|_|_|_|___|___|\n") # fmt: skip
16def info():
17 """Print version numbers and availability of packages."""
18 dependencies = ("numpy", "scipy")
19 extras = ("torch", "pyscf", "dftd3", "h5py", "plotly", "nglview")
20 dev = ("matplotlib", "notebook", "pylibxc", "pytest", "sphinx", "furo")
22 sys.stdout.write(LOGO)
23 sys.stdout.write(
24 "\nhttps://arxiv.org/abs/2410.19438\n"
25 "\n--- Platform infos ---"
26 f"\nPlatform : {platform.system()} {platform.machine()}"
27 f"\nRelease : {platform.release()} {platform.version()}"
28 "\n\n--- Version infos ---"
29 f"\npython : {sys.version.split()[0]}"
30 f"\neminus : {__version__}\n"
31 )
32 for pkg in dependencies + extras + dev:
33 try:
34 module = importlib.import_module(pkg)
35 try:
36 sys.stdout.write(f"{pkg:<11}: {module.__version__}\n")
37 except AttributeError:
38 # pylibxc does not use the standard version identifier
39 sys.stdout.write(f"{pkg:<11}: {module.version.__version__}\n")
40 except ModuleNotFoundError: # noqa: PERF203
41 if pkg in dependencies:
42 sys.stdout.write(f"{pkg:<11}: Dependency not installed\n")
43 elif pkg in extras:
44 sys.stdout.write(f"{pkg:<11}: Extra not installed\n")