Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Print full environment fron conf.py #2709

Merged
merged 1 commit into from
Jan 25, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
47 changes: 26 additions & 21 deletions doc/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,10 @@
# serve to show the default.
from __future__ import absolute_import, division, print_function

from contextlib import suppress
import datetime
import importlib
import os
import subprocess
import sys

import xarray
Expand All @@ -24,29 +25,33 @@

print("python exec:", sys.executable)
print("sys.path:", sys.path)
for name in ('numpy scipy pandas matplotlib dask IPython seaborn '
'cartopy netCDF4 rasterio zarr iris flake8 '
'sphinx_gallery cftime').split():
try:
module = importlib.import_module(name)
if name == 'matplotlib':
module.use('Agg')
fname = module.__file__.rstrip('__init__.py')
print("%s: %s, %s" % (name, module.__version__, fname))
except ImportError:
print("no %s" % name)
# neither rasterio nor cartopy should be hard requirements for
# the doc build.
if name == 'rasterio':
allowed_failures.update(['gallery/plot_rasterio_rgb.py',
'gallery/plot_rasterio.py'])
elif name == 'cartopy':
allowed_failures.update(['gallery/plot_cartopy_facetgrid.py',
'gallery/plot_rasterio_rgb.py',
'gallery/plot_rasterio.py'])

if 'conda' in sys.executable:
print('conda environment:')
subprocess.run(['conda', 'list'])
else:
print('pip environment:')
subprocess.run(['pip', 'list'])

print("xarray: %s, %s" % (xarray.__version__, xarray.__file__))

with suppress(ImportError):
import matplotlib
matplotlib.use('Agg')

try:
import rasterio
except ImportError:
allowed_failures.update(['gallery/plot_rasterio_rgb.py',
'gallery/plot_rasterio.py'])

try:
import cartopy
except ImportError:
allowed_failures.update(['gallery/plot_cartopy_facetgrid.py',
'gallery/plot_rasterio_rgb.py',
'gallery/plot_rasterio.py'])

# -- General configuration ------------------------------------------------

# If your documentation needs a minimal Sphinx version, state it here.
Expand Down