Skip to content

Conversation

flying-sheep
Copy link
Member

@flying-sheep flying-sheep commented Sep 25, 2025

TODO:

  • save storage in data as well?
  • make this numpy 1.x compatible so we can release it in 1.12.x?
  • move following plan into issue(s) and add the second point to the 0.13 milestone
  1. in this PR, make sure we support pd.options.future.infer_string=True/pandas>=3 by adding tests for everything that might break with future.infer_string=True together with (implicitly or explicitly) allow_write_nullable_strings set, and augmenting the error message that’s shown if the latter is False
  2. in anndata 0.13’s release note, we add a fat warning that this setting will flip in 0.14, and if pandas’ version >=3, change allow_write_nullable_strings=False to mean “try writing them as non-nullable and fail only if we can’t”
  3. in anndata 0.14 we flip allow_write_nullable_strings’ default to True

This activates the following settings as described in https://pandas.pydata.org/docs/whatsnew/v2.3.0.html

future.infer_string = True

This one causes many test failures we need to fix.

Mostly because ArrowStringArrayNumpySemantics isn’t a pd.arrays.StringArray

>>> from pandas.core.arrays.string_arrow import ArrowStringArrayNumpySemantics
>>> ArrowStringArrayNumpySemantics.mro()
[pandas.core.arrays.string_arrow.ArrowStringArrayNumpySemantics,
 pandas.core.arrays.string_arrow.ArrowStringArray,
 pandas.core.strings.object_array.ObjectStringArrayMixin,
 pandas.core.arrays.arrow.array.ArrowExtensionArray,
 pandas.core.arraylike.OpsMixin,
 pandas.core.arrays.base.ExtensionArraySupportsAnyAll,
 pandas.core.arrays.string_.BaseStringArray,
 pandas.core.arrays.base.ExtensionArray,
 pandas.core.arrays._arrow_string_mixins.ArrowStringArrayMixin,
 pandas.core.strings.base.BaseStringArrayMethods,
 abc.ABC,
 object]

mode.copy_on_write = True

Weirdly, this doesn’t cause any test failures! According to the docs it implies mode.chained_assignment = "raise", but the warning we suppressed in #545 doesn’t get elevated to an exception. And tests like test_base.py::test_slicing_* still pass. Maybe everything is fine?

We could also do pd.options.mode.copy_on_write = "warn" as the docs say …

@flying-sheep flying-sheep changed the title Activate pandas’ 3.0 preview setting feat: Support pandas 3.0 upcoming changes Sep 25, 2025
Copy link

codecov bot commented Sep 25, 2025

Codecov Report

❌ Patch coverage is 52.50000% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 79.72%. Comparing base (9da064f) to head (52212bb).

Files with missing lines Patch % Lines
src/anndata/experimental/backed/_lazy_arrays.py 27.27% 8 Missing ⚠️
src/anndata/_io/specs/methods.py 76.19% 5 Missing ⚠️
src/anndata/_core/merge.py 0.00% 4 Missing ⚠️
src/anndata/_io/specs/lazy_methods.py 0.00% 1 Missing ⚠️
src/anndata/compat/__init__.py 66.66% 1 Missing ⚠️

❌ Your project check has failed because the head coverage (79.72%) is below the target coverage (80.00%). You can increase the head coverage or adjust the target coverage.

❗ There is a different number of reports uploaded between BASE (9da064f) and HEAD (52212bb). Click for more details.

HEAD has 1 upload less than BASE
Flag BASE (9da064f) HEAD (52212bb)
3 2
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2133      +/-   ##
==========================================
- Coverage   85.42%   79.72%   -5.70%     
==========================================
  Files          46       46              
  Lines        7081     7098      +17     
==========================================
- Hits         6049     5659     -390     
- Misses       1032     1439     +407     
Files with missing lines Coverage Δ
src/anndata/_core/anndata.py 83.18% <ø> (-0.13%) ⬇️
src/anndata/_core/views.py 85.40% <ø> (-0.43%) ⬇️
src/anndata/_settings.py 94.33% <ø> (ø)
src/anndata/utils.py 86.22% <ø> (ø)
src/anndata/_io/specs/lazy_methods.py 73.71% <0.00%> (-22.44%) ⬇️
src/anndata/compat/__init__.py 77.98% <66.66%> (-3.04%) ⬇️
src/anndata/_core/merge.py 74.05% <0.00%> (-11.06%) ⬇️
src/anndata/_io/specs/methods.py 83.18% <76.19%> (-6.69%) ⬇️
src/anndata/experimental/backed/_lazy_arrays.py 38.01% <27.27%> (-53.59%) ⬇️

... and 11 files with indirect coverage changes

@flying-sheep flying-sheep added this to the 0.12.2 milestone Sep 26, 2025
@flying-sheep flying-sheep changed the title feat: Support pandas 3.0 upcoming changes fix: Support pandas 3.0 upcoming changes Sep 26, 2025
@flying-sheep flying-sheep modified the milestones: 0.12.2, 0.13.0 Sep 26, 2025
@flying-sheep flying-sheep changed the title fix: Support pandas 3.0 upcoming changes feat: Support pandas 3.0 upcoming changes Sep 26, 2025
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