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

(chore): convert DeprecationWarnings to FutureWarnings where possible #1874

Open
wants to merge 2 commits into
base: main
Choose a base branch
from

Conversation

ilan-gold
Copy link
Contributor

@ilan-gold ilan-gold commented Feb 25, 2025

I'm not sure about PendingDeprecationWarning (which remain untouched - if you look at the codebase, there are some strange uses of them which I think is a separate issue) but otherwise this PR removes DeprecationWarning. I'm marking as 0.12 so as not to break people's CI. In that case I would probably put concrete timelines on this like "Next minor release i.e., 0.13" we will remove these.

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

@ilan-gold ilan-gold changed the title (chore): convert DeprecationWarnings to FutureWarnings where poss… (chore): convert DeprecationWarnings to FutureWarnings where possible Feb 25, 2025
@ilan-gold ilan-gold added this to the 0.12.0 milestone Feb 25, 2025
Copy link

codecov bot commented Feb 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 83.67%. Comparing base (cea85f6) to head (2e873af).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #1874      +/-   ##
==========================================
- Coverage   86.11%   83.67%   -2.44%     
==========================================
  Files          40       40              
  Lines        6242     6242              
==========================================
- Hits         5375     5223     -152     
- Misses        867     1019     +152     
Files with missing lines Coverage Δ
src/anndata/_core/aligned_mapping.py 93.41% <100.00%> (ø)
src/anndata/_core/anndata.py 82.61% <ø> (ø)
src/anndata/_io/utils.py 76.15% <ø> (ø)
src/anndata/_settings.py 93.52% <100.00%> (ø)
src/anndata/utils.py 83.40% <ø> (-0.90%) ⬇️

... and 7 files with indirect coverage changes

@ilan-gold ilan-gold marked this pull request as ready for review February 25, 2025 12:13
@@ -359,14 +359,14 @@ def warn_once(msg: str, category: type[Warning], stacklevel: int = 1):

def deprecated(
new_name: str,
category: type[Warning] = DeprecationWarning,
category: type[Warning] = FutureWarning,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Maybe we remove this altogether and always force FutureWarning?

Copy link
Member

Choose a reason for hiding this comment

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

works for me!

Copy link
Member

@flying-sheep flying-sheep left a comment

Choose a reason for hiding this comment

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

PendingDeprecationWarnings are even weaker than DeprecationWarnings: They are completely ignored by default. So I say we should upgrade these too.

@ilan-gold
Copy link
Contributor Author

ilan-gold commented Feb 25, 2025

PendingDeprecationWarnings are even weaker than DeprecationWarnings: They are completely ignored by default. So I say we should upgrade these too.

Yes I guess my point is that this is basically misused. One use is a parent class for OldFormatWarning where we will not remove the ability to read old files, so there is no intention to deprecate. The other place is __setitem__ for SparseDataset for which I don't have enough context right now to upgrade IMO. I would need to investigate why we are removing and what the implications are. So I want to deal with this separately.

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.

2 participants