diff --git a/.readthedocs.yml b/.readthedocs.yml index cafcedd..71d5df4 100644 --- a/.readthedocs.yml +++ b/.readthedocs.yml @@ -3,6 +3,8 @@ build: os: ubuntu-22.04 tools: python: "3.11" + apt_packages: + - r-base-core python: install: - method: pip @@ -10,4 +12,5 @@ python: extra_requirements: - doc sphinx: + fail_on_warning: true configuration: docs/conf.py diff --git a/docs/conf.py b/docs/conf.py index 4be7543..db3b00b 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,41 +1,16 @@ """Sphinx configuration.""" import sys -from abc import ABC from datetime import datetime, timezone from importlib.metadata import metadata from pathlib import Path -from unittest.mock import MagicMock, patch - - -def mock_rpy2() -> None: - """Can’t use autodoc_mock_imports as we import anndata2ri.""" - patch('rpy2.situation.get_r_home', lambda: None).start() - sys.modules['rpy2.rinterface_lib'] = MagicMock() - submods = ['embedded', 'conversion', 'memorymanagement', 'sexp', 'bufferprotocol', 'callbacks', '_rinterface_capi'] - sys.modules.update({f'rpy2.rinterface_lib.{sub}': MagicMock() for sub in submods}) - sexp = sys.modules['rpy2.rinterface_lib'].sexp = sys.modules['rpy2.rinterface_lib.sexp'] - sexp.Sexp = type('Sexp', (MagicMock, ABC), dict(__module__='rpy2.rinterface_lib.sexp')) - sexp.SexpEnvironment = type('SexpEnvironment', (sexp.Sexp,), dict(__module__='rpy2.rinterface_lib.sexp')) - sexp.SexpVector = sexp.StrSexpVector = MagicMock - sexp.SexpVector.from_iterable = MagicMock() - - import rpy2.rinterface - import rpy2.rinterface_lib.sexp - - rpy2.rinterface_lib = sys.modules['rpy2.rinterface_lib'] - rpy2.rinterface._MissingArgType = object # noqa: SLF001 - rpy2.rinterface.initr_simple = lambda *_, **__: None - - assert rpy2.rinterface_lib.sexp is sexp HERE = Path(__file__).parent -mock_rpy2() -# now we can anndata2ri and our extensions -sys.path[:0] = [str(HERE.parent), str(HERE / 'ext')] +# allow to import our extensions +sys.path[:0] = [str(HERE / 'ext')] # -- General configuration ------------------------------------------------