-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathtemplate_tools.py
48 lines (38 loc) · 1.2 KB
/
template_tools.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
"""
Some useful tools for writing relevant validation notebooks.
"""
from importlib import import_module
def print_dep_versions(extras=None, ignore=None):
"""
Prints versions of all important "active" modules.
This includes modules that are not explicitly imported, as they *may* be used as
deps of used packages. It will skip any module that isn't installed at all (since
obviously this is not being used).
:param extras: Any extra modules that may be useful for this particular notebook.
"""
MODULES = [
"pyuvdata",
"hera_stats",
"hera_sim",
"hera_qm",
"hera_pspec",
"linsolve",
"uvtools",
"numpy",
"healvis",
"healpy",
"h5py"
]
ignore = ignore or []
if extras is not None:
MODULES += extras
for module in MODULES:
if module in ignore:
continue
try:
_mdl = import_module(module)
except ModuleNotFoundError:
pass
if hasattr(_mdl, 'version'):
gh = getattr(_mdl.version, 'git_hash', None)
print("Module {:<11}....\tVersion {:<7}.......\tGit {}".format(module, _mdl.__version__, gh))