From ed05f9862622b00f40f7b9b99ccdb0ab3766ff0f Mon Sep 17 00:00:00 2001 From: keewis Date: Tue, 3 Dec 2019 19:59:40 +0100 Subject: [PATCH] Resolve the version issues on RTD (#3589) * add the project root to PYTHONPATH and sys.path * don't install the package * update the requirements for the documentation environment so we definitely trigger the version collision. * comment on the reasons for the sys.path and os.environ modifications --- ci/requirements/doc.yml | 7 ++----- doc/conf.py | 6 ++++++ readthedocs.yml | 2 +- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/ci/requirements/doc.yml b/ci/requirements/doc.yml index f2c09ed6fef..97488e7f581 100644 --- a/ci/requirements/doc.yml +++ b/ci/requirements/doc.yml @@ -6,7 +6,7 @@ dependencies: - python=3.7 - bottleneck - cartopy - - eccodes + - cfgrib - h5netcdf - ipykernel - ipython @@ -21,8 +21,5 @@ dependencies: - seaborn - sphinx - sphinx_rtd_theme + - xarray - zarr - - pip - - pip: - - cfgrib - diff --git a/doc/conf.py b/doc/conf.py index 65635353e93..11abda6bb63 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -15,10 +15,16 @@ import datetime import os +import pathlib import subprocess import sys from contextlib import suppress +# make sure the source version is preferred (#3567) +root = pathlib.Path(__file__).absolute().parent.parent +os.environ["PYTHONPATH"] = str(root) +sys.path.insert(0, str(root)) + import xarray allowed_failures = set() diff --git a/readthedocs.yml b/readthedocs.yml index 6429780e7d7..c64fa1b7b02 100644 --- a/readthedocs.yml +++ b/readthedocs.yml @@ -4,5 +4,5 @@ conda: file: ci/requirements/doc.yml python: version: 3.7 - setup_py_install: true + setup_py_install: false formats: []