scverse / mudata

Multimodal Data (.h5mu) implementation for Python
https://mudata.rtfd.io
BSD 3-Clause "New" or "Revised" License
72 stars 16 forks source link

Mudata cannot be imported when anndata dev version is installed #36

Closed grst closed 1 year ago

grst commented 1 year ago

Describe the bug The dev version of AnnData does not provide compat.Literal anymore, therefore import of mudata fails.

To Reproduce

!pip install git+https://github.com/scverse/anndata.git
!pip install git+https://github.com/scverse/mudata.git
import mudata as md
---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
Input In [2], in <cell line: 9>()
      7 from anndata import AnnData
      8 from airr import RearrangementSchema
----> 9 import mudata as md

File ~/anaconda3/envs/scirpy_dev/lib/python3.9/site-packages/mudata/__init__.py:3, in <module>
      1 """Multimodal omics analysis framework"""
----> 3 from ._core.mudata import MuData
      4 from ._core import utils
      5 from ._core.io import *

File ~/anaconda3/envs/scirpy_dev/lib/python3.9/site-packages/mudata/_core/mudata.py:30, in <module>
     21 from anndata._core.aligned_mapping import (
     22     AxisArrays,
     23     AlignedViewMixin,
   (...)
     26     PairwiseArraysView,
     27 )
     28 from anndata._core.views import DataFrameView
---> 30 from .file_backing import MuDataFileManager
     31 from .utils import _make_index_unique, _restore_index
     33 from .repr import *

File ~/anaconda3/envs/scirpy_dev/lib/python3.9/site-packages/mudata/_core/file_backing.py:13, in <module>
      9 from anndata._core.file_backing import AnnDataFileManager
     10 import h5py
---> 13 class MuDataFileManager(AnnDataFileManager):
     14     def __init__(
     15         self,
     16         filename: Optional[PathLike] = None,
     17         filemode: Optional[ad.compat.Literal["r", "r+"]] = None,
     18     ):
     19         self._counter = 0

File ~/anaconda3/envs/scirpy_dev/lib/python3.9/site-packages/mudata/_core/file_backing.py:17, in MuDataFileManager()
     13 class MuDataFileManager(AnnDataFileManager):
     14     def __init__(
     15         self,
     16         filename: Optional[PathLike] = None,
---> 17         filemode: Optional[ad.compat.Literal["r", "r+"]] = None,
     18     ):
     19         self._counter = 0
     20         self._children = WeakSet()

AttributeError: module 'anndata.compat' has no attribute 'Literal'

Versions

anndata dev mudata dev

grst commented 1 year ago

AnnData requires python>=3.8 now, so mudata should probably do the same.

grst commented 1 year ago

This highlights that we should probably start testing development versions of core packages against each other.

gtca commented 1 year ago

Thanks, @grst! Should be covered by 98518a4.

f48fe97 with improved testing against the latest anndata/scanpy is green. It would be great to do that systematically indeed.