Skip to content

Commit

Permalink
amended debug-info with pip+conda install command
Browse files Browse the repository at this point in the history
Signed-off-by: Nick Papior <[email protected]>
  • Loading branch information
zerothi committed Aug 6, 2024
1 parent 62af04e commit f9362b8
Showing 1 changed file with 29 additions and 15 deletions.
44 changes: 29 additions & 15 deletions tools/_debug_info.py.conf
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,18 @@ def print_debug_info():
print(fmt.format("path", str((path / "..").resolve())))

def print_attr(module, attr: str = ""):
attr_val = None
try:
mod = importlib.import_module(module)
if attr:
print(fmt.format(module, getattr(mod, attr)))
attr_val = getattr(mod, attr)
print(fmt.format(module, attr_val))
except BaseException as e:
print(fmt.format(module, "not found"))
print(fmt.format("", str(e)))

return attr_val

# regardless of whether it is on, or not, we try to import fortran extension
print_attr("sisl.io.siesta._siesta")

Expand All @@ -81,18 +85,28 @@ def print_debug_info():
print(fmt.format(d, v))

print("[runtime modules]")
for mod in (
"numpy",
"scipy",
"xarray",
"netCDF4",
"pandas",
"matplotlib",
"dill",
"pathos",
"skimage",
"plotly",
"ase",
"pymatgen",

pip_install = []
conda_install = []
for pip, conda, mod in (
("numpy", "numpy", "numpy"),
("scipy", "scipy", "scipy"),
("xarray", "xarray", "xarray"),
("netCDF4", "netCDF4", "netCDF4"),
("pandas", "pandas", "pandas"),
("matplotlib", "matplotlib", "matplotlib"),
("dill", "dill", "dill"),
("pathos", "pathos", "pathos"),
("scikit-image", "scikit-image", "skimage"),
("plotly", "plotly", "plotly"),
("ase", "ase", "ase"),
("pymatgen", "pymatgen", "pymatgen"),
):
print_attr(mod, "__version__")
attr = print_attr(mod, "__version__")
if attr is not None:
pip_install.append(f"{pip}=={attr}")
conda_install.append(f"{conda}=={attr}")

print("[env]")
print(fmt.format("pip", " ".join(pip_install)))
print(fmt.format("conda", " ".join(conda_install)))

0 comments on commit f9362b8

Please sign in to comment.