diff --git a/docs/conf.py b/docs/conf.py index b5f30a0..8a3c94a 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -1,42 +1,28 @@ import sys from datetime import datetime from pathlib import Path -from unittest.mock import MagicMock -HERE = Path(__file__).parent - - -# Can’t use autodoc_mock_imports as we import anndata2ri -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'] -sexp.Sexp = type('Sexp', (MagicMock,), dict(__module__='rpy2.rinterface')) -sexp.SexpVector = sexp.SexpEnvironment = sexp.StrSexpVector = MagicMock -sexp.SexpVector.from_iterable = MagicMock() +try: + from importlib.metadata import metadata +except ImportError: + from importlib_metadata import metadata -import rpy2.rinterface +HERE = Path(__file__).parent -rpy2.rinterface._MissingArgType = object -rpy2.rinterface.initr_simple = lambda *_, **__: None - -# now we can import it! sys.path[:0] = [str(HERE.parent), str(HERE / 'ext')] -import anndata2ri.scipy2ri # noqa # -- General configuration ------------------------------------------------ -needs_sphinx = '1.7' # autosummary bugfix - # General information project = 'anndata2ri' -author = anndata2ri.__author__ +meta = metadata(project) +author = meta['author-email'].split('"')[1] copyright = f'{datetime.now():%Y}, {author}.' -version = anndata2ri.__version__.replace('.dirty', '') +version = meta['version'] release = version # default settings diff --git a/pyproject.toml b/pyproject.toml index 71bd126..fed6335 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -39,6 +39,7 @@ doc = [ 'scanpydoc', 'sphinx-rtd-theme>=0.5', # Already a dep but 0.5 is prettier 'lxml', # For scraping the R link info + 'importlib_metadata; python_version < "3.8"', ] [tool.hatch.version]