single-cell-data / SOMA

A flexible and extensible API for annotated 2D matrix data stored in multiple underlying formats.
MIT License
69 stars 9 forks source link

Pull "ephemeral" collections into their own module #109

Closed thetorpedodog closed 1 year ago

thetorpedodog commented 1 year ago

The meaning and usage of the various SimpleWhatever collections was unclear with them colocated with the abstract implementation. Moving them to their own ephemeral module and not having them in the main somacore namespace will make them less attractive. They still have value in being the most basic possible implementation of a collection, and are useful in tests for this package.

In the process of removing the SimpleCollection export from the package root, also changes the __init__.py to just import module members rather than the module itself. Since this is at the top level and is exclusively for re-export, this does not have the same potential circular dependency problems as doing so within internal modules, while reducing repetition and the possibility of errors.

thetorpedodog commented 1 year ago

Another little note as I do some follow-up work:

Another thing I have found the ephemeral types useful for is to validate the type hierarchy and make sure generics work as I expect. I also think in the future they could be more useful in testing if we had in-memory dataframes/ndarrays that wrapped pandas dataframes / numpy ndarrays and provided appropriate methods; experimentquery could be tested entirely in isolation (but that is a future thing, if ever).