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

[python] Avoid two warnings on ingest #2282

Closed
wants to merge 3 commits into from
Closed

Conversation

johnkerl
Copy link
Member

@johnkerl johnkerl commented Mar 15, 2024

Drive-by finding on ingest.

Repro at the AnnData level:

>>> import anndata as ad

>>> adata = ad.read_h5ad('/var/s/a/white-matter-astrocytes.h5ad', 'r')

>>> adata.X.format
'csr'

>>> adata.X.format_str
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/site-packages/anndata/_core/sparse_dataset.py:311: FutureWarning: The attribute .format_str is deprecated and will be removed in the anndata 0.11.0. Please use .format instead.
  warnings.warn(
'csr'

As noted below there is another warning:

/usr/lib/python3.10/abc.py:119: FutureWarning: SparseDataset is deprecated and will be removed in late 2024. It has been replaced by the public classes CSRDataset and CSCDataset.

but we can't get rid of this in Python 3.8 which we still support (#2141)

@johnkerl johnkerl requested a review from ryan-williams March 15, 2024 15:49
@johnkerl johnkerl force-pushed the kerl/format-str-begone branch from bf9996b to 1f6d20c Compare March 15, 2024 16:01
@johnkerl
Copy link
Member Author

Garg; from anndata._core.sparse_dataset import CSCDataset is not supported in Python 3.8 apparently ...

@johnkerl
Copy link
Member Author

Confirmed:

# ================================================================
ubuntu@anzo[prod][][~]$ alias dreb
alias dreb='docker run --rm -it --entrypoint=/bin/bash'

# ================================================================
ubuntu@anzo[prod][][~]$ dreb python:3.11

root@43acc809a778:/# pip install -q anndata

root@43acc809a778:/# python
Python 3.11.8 (main, Mar 12 2024, 11:41:52) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from anndata._core.sparse_dataset import CSCDataset

# ================================================================
ubuntu@anzo[prod][][~]$ dreb python:3.10

root@de3e2090a4f5:/# pip install -q anndata

root@de3e2090a4f5:/# python
Python 3.10.13 (main, Mar 12 2024, 12:16:25) [GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from anndata._core.sparse_dataset import CSCDataset

# ================================================================
ubuntu@anzo[prod][][~]$ dreb python:3.9

root@05008e9a6e51:/# pip install -q anndata

root@05008e9a6e51:/# python
Python 3.9.18 (main, Mar 12 2024, 12:36:48)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from anndata._core.sparse_dataset import CSCDataset

# ================================================================
ubuntu@anzo[prod][][~]$ dreb python:3.8

root@6684c0f109fe:/# pip install -q anndata

root@6684c0f109fe:/# python
Python 3.8.18 (default, Mar 12 2024, 12:46:23)
[GCC 12.2.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> from anndata._core.sparse_dataset import CSCDataset
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'CSCDataset' from 'anndata._core.sparse_dataset' (/usr/local/lib/python3.8/site-packages/anndata/_core/sparse_dataset.py)

@johnkerl johnkerl marked this pull request as draft March 15, 2024 16:25
@johnkerl
Copy link
Member Author

Garg. We can't fix either one on Python 3.8 :(

FAILED apis/python/tests/test_basic_anndata_io.py::test_named_X_layers[None] - AttributeError: 'SparseDataset' object has no attribute 'format'

@johnkerl johnkerl closed this Mar 15, 2024
@johnkerl johnkerl changed the title [python] Avoid a warning on ingest [python] Avoid two warnings on ingest Mar 15, 2024
@johnkerl johnkerl deleted the kerl/format-str-begone branch November 18, 2024 16:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant