-
Notifications
You must be signed in to change notification settings - Fork 10
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
Pull "ephemeral" collections into their own module #109
Conversation
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.
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). |
|
||
@property | ||
def uri(self) -> str: | ||
return f"somacore:simple-collection:{id(self):x}" |
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.
ephemeral-collection
for consistency?
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.
Also fixed.
|
||
|
||
class SimpleCollectionTest(unittest.TestCase): | ||
class EphemeralCollectionTest(unittest.TestCase): | ||
def test_basic(self): | ||
# Since the SimpleCollection implementation is straightforward this is |
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.
might want to s/\bSimple(.+)\b/Ephemeral$1/
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.
Whoops! Thank you.
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.
LGTM. The separation helps!
Just a couple spots where "simple" still exists; suggest a full search & replace. Approving optimistically.
The meaning and usage of the various
SimpleWhatever
collections was unclear with them colocated with the abstract implementation. Moving them to their ownephemeral
module and not having them in the mainsomacore
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.