Skip to content

add extension functionality (see #111)#124

Open
ilia-kats wants to merge 1 commit intoscverse:mainfrom
ilia-kats:extensions
Open

add extension functionality (see #111)#124
ilia-kats wants to merge 1 commit intoscverse:mainfrom
ilia-kats:extensions

Conversation

@ilia-kats
Copy link
Collaborator

This is basically a copy of AnnData's implementation, lightly adapted.

@ilia-kats ilia-kats requested review from gtca and ilan-gold March 3, 2026 11:13
@codecov
Copy link

codecov bot commented Mar 3, 2026

Codecov Report

❌ Patch coverage is 69.86301% with 44 lines in your changes missing coverage. Please review.
✅ Project coverage is 69.44%. Comparing base (9d7c3fb) to head (3249d52).

Files with missing lines Patch % Lines
src/mudata/_core/mudata.py 49.39% 42 Missing ⚠️
src/mudata/_core/extensions.py 96.77% 2 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #124      +/-   ##
==========================================
+ Coverage   68.48%   69.44%   +0.96%     
==========================================
  Files          11       12       +1     
  Lines        1888     1954      +66     
==========================================
+ Hits         1293     1357      +64     
- Misses        595      597       +2     
Files with missing lines Coverage Δ
src/mudata/__init__.py 100.00% <100.00%> (ø)
src/mudata/_core/extensions.py 96.77% <96.77%> (ø)
src/mudata/_core/mudata.py 72.84% <49.39%> (+0.07%) ⬆️
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

This is basically a copy of AnnData's implementation, lightly adapted.
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.

@Zethson Any thoughts on how and/or if this should be deduplicated? Other than that, this seems reasonable. @ilia-kats any changes specifically you'd like to draw my attention to?

@ilia-kats
Copy link
Collaborator Author

I think the only functional difference to the AnnData version is that the AnnData version has an AnnData._accessors attribute, which is used in _create_namespace to check if an accessor with that name already exists and raise a warning, whereas I'm using hasattr. The former only warns on attributes that were created with exactly this functionality, whereas my version would warn if any already existing attribute is overridden.

Regarding deduplication, given that my version does not require any modification to the class that gains custom namespace functionality, we might consider splitting this into a separate utility package, I suppose.

@ilan-gold
Copy link
Contributor

Regarding deduplication, given that my version does not require any modification to the class that gains custom namespace functionality, we might consider splitting this into a separate utility package, I suppose.

Yeah, I think this is the fundamental question. I defer to @Zethson but maybe @LucaMarconato has an opinion

@ilan-gold
Copy link
Contributor

ilan-gold commented Mar 6, 2026

whereas my version would warn if any already existing attribute is overridden.

Mmm that is quite nice. @colganwi is inheriting from an AnnData in TreeData so it's possible someone (he with tree namespaces) could conflict with that. It might be worth moving to this version

@Zethson
Copy link
Member

Zethson commented Mar 6, 2026

(I'm in vac mode and will leave this up to you - sorry)

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.

3 participants