-
Notifications
You must be signed in to change notification settings - Fork 157
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Log much more information about FiPy environment (#990)
Remove obsolete vitals module (svn, really???)
- Loading branch information
Showing
6 changed files
with
163 additions
and
205 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,60 +0,0 @@ | ||
import sys | ||
|
||
def package_info(): | ||
"""Return dictionary of versions for FiPy dependencies.""" | ||
|
||
packages = {} | ||
|
||
packages['python'] = sys.version.replace('\n', '| ') | ||
|
||
for pkg in ['fipy', 'numpy', 'pysparse', 'scipy', 'matplotlib', 'mpi4py', 'petsc4py', 'pyamgx']: | ||
try: | ||
mod = __import__(pkg) | ||
|
||
packages[pkg] = mod.__version__ | ||
except ImportError as e: | ||
packages[pkg] = 'not installed' | ||
|
||
except Exception as e: | ||
packages[pkg] = 'version check failed: {}'.format(e) | ||
|
||
## PyTrilinos | ||
try: | ||
import PyTrilinos | ||
packages['PyTrilinos'] = PyTrilinos.version() | ||
except ImportError as e: | ||
packages['PyTrilinos'] = 'not installed' | ||
except Exception as e: | ||
packages['PyTrilinos'] = 'version check failed: {}'.format(e) | ||
|
||
## Mayavi uses a non-standard approach for storing its version number. | ||
try: | ||
from mayavi.__version__ import __version__ as mayaviversion | ||
packages['mayavi'] = mayaviversion | ||
except ImportError as e: | ||
try: | ||
from enthought.mayavi.__version__ import __version__ as mayaviversion | ||
packages['mayavi'] = mayaviversion | ||
except ImportError as e: | ||
packages['mayavi'] = 'not installed' | ||
except Exception as e: | ||
packages['mayavi'] = 'version check failed: {}'.format(e) | ||
|
||
## Gmsh version | ||
try: | ||
from fipy.meshes.gmshMesh import gmshVersion | ||
gmshversion = gmshVersion() | ||
if gmshversion is None: | ||
packages['gmsh'] = 'not installed' | ||
else: | ||
packages['gmsh'] = gmshversion | ||
except Exception as e: | ||
packages['gmsh'] = 'version check failed: {}'.format(e) | ||
|
||
try: | ||
from fipy.solvers import solver_suite | ||
packages['solver'] = solver_suite | ||
except Exception as e: | ||
packages['solver'] = str(e) | ||
|
||
return packages | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,139 @@ | ||
import json | ||
import platform | ||
import subprocess | ||
import sys | ||
|
||
__all__ = ["conda_info", "pip_info", "package_info", "platform_info"] | ||
|
||
def conda_info(conda="conda"): | ||
"""Collect information about conda environment. | ||
Parameters | ||
---------- | ||
conda : str | ||
Name of conda executable (default: "conda"). | ||
Returns | ||
------- | ||
dict | ||
Result of `conda info` and `conda env export` for active conda | ||
environment. | ||
""" | ||
info = {} | ||
p = subprocess.Popen([conda, "info", "--json"], stdout=subprocess.PIPE) | ||
stdout, _ = p.communicate() | ||
stdout = stdout.decode('ascii') | ||
|
||
info["conda_info"] = json.loads(stdout) | ||
p = subprocess.Popen([conda, "env", "export", | ||
"--name", info["conda_info"]["active_prefix_name"], | ||
"--json"], | ||
stdout=subprocess.PIPE) | ||
stdout, _ = p.communicate() | ||
stdout = stdout.decode('ascii') | ||
info["conda_env"] = json.loads(stdout) | ||
|
||
return info | ||
|
||
def pip_info(python="python"): | ||
"""Collect information about pip environment. | ||
Parameters | ||
---------- | ||
python : str | ||
Name of Python executable (default: "python"). | ||
Returns | ||
------- | ||
list of dict | ||
Result of `pip list --format json`. | ||
""" | ||
info = {} | ||
p = subprocess.Popen([python, "-m", "pip", "list", "--format", "json"], stdout=subprocess.PIPE) | ||
stdout, _ = p.communicate() | ||
stdout = stdout.decode('ascii') | ||
|
||
return json.loads(stdout) | ||
|
||
def package_info(): | ||
"""Collect information about installed packages FiPy uses. | ||
Returns | ||
------- | ||
dict | ||
Versions of important Python packages. | ||
""" | ||
packages = {} | ||
|
||
packages['python'] = sys.version #.replace('\n', '| ') | ||
|
||
for pkg in ['fipy', 'numpy', 'pysparse', 'scipy', 'matplotlib', 'mpi4py', 'petsc4py', 'pyamgx']: | ||
try: | ||
mod = __import__(pkg) | ||
|
||
packages[pkg] = mod.__version__ | ||
except ImportError as e: | ||
packages[pkg] = 'not installed' | ||
|
||
except Exception as e: | ||
packages[pkg] = 'version check failed: {}'.format(e) | ||
|
||
## PyTrilinos | ||
try: | ||
import PyTrilinos | ||
packages['PyTrilinos'] = PyTrilinos.version() | ||
except ImportError as e: | ||
packages['PyTrilinos'] = 'not installed' | ||
except Exception as e: | ||
packages['PyTrilinos'] = 'version check failed: {}'.format(e) | ||
|
||
## Mayavi uses a non-standard approach for storing its version number. | ||
try: | ||
from mayavi.__version__ import __version__ as mayaviversion | ||
packages['mayavi'] = mayaviversion | ||
except ImportError as e: | ||
try: | ||
from enthought.mayavi.__version__ import __version__ as mayaviversion | ||
packages['mayavi'] = mayaviversion | ||
except ImportError as e: | ||
packages['mayavi'] = 'not installed' | ||
except Exception as e: | ||
packages['mayavi'] = 'version check failed: {}'.format(e) | ||
|
||
## Gmsh version | ||
try: | ||
from fipy.meshes.gmshMesh import gmshVersion | ||
gmshversion = gmshVersion() | ||
if gmshversion is None: | ||
packages['gmsh'] = 'not installed' | ||
else: | ||
packages['gmsh'] = gmshversion | ||
except Exception as e: | ||
packages['gmsh'] = 'version check failed: {}'.format(e) | ||
|
||
try: | ||
from fipy.solvers import solver_suite | ||
packages['solver'] = solver_suite | ||
except Exception as e: | ||
packages['solver'] = str(e) | ||
|
||
return packages | ||
|
||
def platform_info(): | ||
"""Collect information about platform Python is running in. | ||
Returns | ||
------- | ||
dict | ||
Data extracted from `platform` package. | ||
""" | ||
return { | ||
"architecture": platform.architecture(), | ||
"machine": platform.machine(), | ||
"node": platform.node(), | ||
"platform": platform.platform(), | ||
"processor": platform.processor(), | ||
"release": platform.release(), | ||
"system": platform.system(), | ||
"version": platform.version() | ||
} |
This file was deleted.
Oops, something went wrong.