Conversation
bioio_base/reader.py
Outdated
| if self.NAME is not None: | ||
| return self.NAME | ||
|
|
||
| module = self.__class__.__module__ |
There was a problem hiding this comment.
nit: module_name might be a better name for this string?
There was a problem hiding this comment.
I think this is great but we need to STRONGLY ENCOURAGE new readers to fill this in. I wonder if we could issue a warning or something. Like if NAME is None, we fall back to module but also warn: please update your reader implementation to have a NAME field.
I also wonder if we could automatically get NAME from some repo-level config thing like the pyproject file.
If we do this we need to adhere to a name definiton for all all readers, at that point is it worth having a fallback?
We can get it from the distribution but that would be a the bioio level not the base level. We could use something like package instead of module at the base level though Im not sure how different it is tbh. |
I guess the fallback is to save you from having to edit/update every known reader in existence? Users may have written their own Reader implementations too. |
|
|
||
| if module.endswith(".reader"): | ||
| module = module[: -len(".reader")] | ||
|
|
There was a problem hiding this comment.
Nit: a warning could potentially go right here, if the self.NAME check fails, we could warn something like "for proper identification of your reader, please provide a Reader.NAME string in your implementation."
Description
The purpose of this PR is to resolve #bioio-devs/bioio#159 and allow users to access the name of the reader. This is specifically useful at the
BioImagelevel where users can callBioImage.reader.nameto see which reader was selected to read their file.