-
Notifications
You must be signed in to change notification settings - Fork 160
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): export read_elem
and write_elem
from the main package
#1598
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1598 +/- ##
==========================================
- Coverage 86.81% 84.35% -2.46%
==========================================
Files 37 37
Lines 6005 6016 +11
==========================================
- Hits 5213 5075 -138
- Misses 792 941 +149
|
269f198
to
99e0216
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above: define public API of CS{R,C}DataSet
@flying-sheep I have been thinking about this a bit. Is it bad practice to keep the |
You’re right, that’s not a problem. We could also e.g. export |
src/anndata/__init__.py
Outdated
|
||
|
||
class CustomExperimental(types.ModuleType): | ||
def __getattribute__(self, key: str) -> Any: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not just define def __getattr__(key: str) -> Any: ...
in the experimental module directly?
https://peps.python.org/pep-0562/ exists since 3.7
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has the advantage of never having to thinking about this again. As we move things out of experimental into the public API, we'll never have to update this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe you could do __getattr__
without a circular import? I guess I can try but I just kind of assumed not
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Although now that I think about it, maybe a blanket warning isn't such a good idea...would want to be explicit about deprecations
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can just import inside of __getattr__
, no?
experimental/__init__.py
:
[…]
def __getattr__(key: str) -> Any:
import anndata
if key in anndata.__all__: ...
…:scverse/anndata into ig/{read,write}_elem_out_of_experimental
Co-authored-by: Philipp A. <flying-sheep@web.de>
…:scverse/anndata into ig/{read,write}_elem_out_of_experimental
…:scverse/anndata into ig/{read,write}_elem_out_of_experimental
To do this properly, needed to export
RWAble
and the sparse backed classesread_elem
,write_elem
from experimental into main API #1158