Skip to content

Conversation

ilia-kats
Copy link
Contributor

@ilia-kats ilia-kats commented Apr 11, 2025

  • Closes #
  • Tests added
  • Release note added (or unnecessary)

As discussed. This PR also moves the Dataset2D class from experimental into core. IMHO this makes more sense, since it as already used all over core and is now used even more.

Note that this is not a full-featured replacement for DataFrames: Pandas Extension Arrays are lost durint concatenation, since they are not supported by Dask Arrays. This affects categoricals and nullables. I would thus still like to have Dask DataFrame support.

it's being used in many places in _core already
Copy link

codecov bot commented Apr 14, 2025

Codecov Report

❌ Patch coverage is 90.33457% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 85.09%. Comparing base (daa8f24) to head (6c081c7).
⚠️ Report is 39 commits behind head on main.

Files with missing lines Patch % Lines
src/anndata/compat/__init__.py 31.57% 13 Missing ⚠️
src/anndata/_core/merge.py 88.37% 10 Missing ⚠️
src/anndata/_core/xarray.py 97.61% 2 Missing ⚠️
src/anndata/_core/storage.py 75.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1966      +/-   ##
==========================================
+ Coverage   83.34%   85.09%   +1.75%     
==========================================
  Files          47       47              
  Lines        6856     6959     +103     
==========================================
+ Hits         5714     5922     +208     
+ Misses       1142     1037     -105     
Files with missing lines Coverage Δ
src/anndata/_core/aligned_df.py 96.49% <100.00%> (+0.57%) ⬆️
src/anndata/_core/aligned_mapping.py 95.18% <100.00%> (+0.07%) ⬆️
src/anndata/_core/anndata.py 82.89% <100.00%> (-0.20%) ⬇️
src/anndata/_core/file_backing.py 89.07% <100.00%> (+0.37%) ⬆️
src/anndata/_core/index.py 92.85% <100.00%> (+2.51%) ⬆️
src/anndata/_core/views.py 85.65% <100.00%> (-5.34%) ⬇️
src/anndata/_io/specs/lazy_methods.py 96.05% <100.00%> (+27.38%) ⬆️
src/anndata/_io/specs/registry.py 93.68% <ø> (+1.05%) ⬆️
src/anndata/experimental/backed/_compat.py 90.90% <100.00%> (+24.24%) ⬆️
src/anndata/experimental/backed/_io.py 90.90% <100.00%> (+52.72%) ⬆️
... and 7 more

... and 6 files with indirect coverage changes

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@ilia-kats
Copy link
Contributor Author

I'm not sure what to do about the documentation warnings. I think the problem is that it's building the documentation for Dataset2D, which has type hints from compat, but it's not building any docs for compat. One could either remove Dataset2D from api.md or change the type hints to xarray.DataArray, which would mean that one needs to have xarray installed for type checking and building the docs.

ilia-kats added a commit to bioFAM/mofaflex that referenced this pull request Apr 14, 2025
@ilan-gold ilan-gold added this to the 0.12.0 milestone May 7, 2025
@ilan-gold
Copy link
Contributor

@ilia-kats Is there anything else we are missing here? I will give this a final look tomorrow. I'm hoping to bundle this, the upcoming zarr release as a minimum bound, and the upcoming xarray release as another minimum bound, into one new release candidate.

@ilia-kats
Copy link
Contributor Author

If your xarray PR is merged before the next release I would remove the workaround, and I would appreciate some advice on what to do about the docs (see this comment). That's it, I think.

@ilan-gold
Copy link
Contributor

I would appreciate some advice on what to do about the docs (see #1966 (comment) comment)

Opened a PR on this

Copy link
Contributor

@ilan-gold ilan-gold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two small things and then we should be good

Copy link
Contributor

@ilan-gold ilan-gold left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a small question, if you give a quick comment in the code on it (or here, and it's sufficiently obvious that I was just having a brain fart) I'll merge

@ilan-gold ilan-gold enabled auto-merge (squash) May 12, 2025 11:43
@ilan-gold ilan-gold merged commit 95974bc into scverse:main May 12, 2025
14 checks passed
experimental.backed._lazy_arrays.MaskedArray
experimental.backed._lazy_arrays.CategoricalArray
experimental.backed._xarray.Dataset2D
_core.xarray.Dataset2D
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No public exports should start with an underscore, this should be exported somewhere else.

We talked about

  • anndata.types for types that are not ABCs but intended to be used in isinstance checks
  • anndata.typing for types that are only for annotations

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I already had this comment as a pending review but never submitted it :(

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, apologies you are 100% right.

min_version = Version(spec.version)

return Requirement(f"{req_name}=={min_version}.*")
return Requirement(f"{req_name}~={min_version}.0")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The == was intentional. If a patch version has issues, the minimum version should be bumped to a version that makes the tests pass.

Not everything uses semver, especially not Python land.

We can discuss this of course, if there’s a good reason to make this change we can make it, I’m just saying that this needs to be motivated.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants