Skip to content

feature/reader-name#54

Merged
BrianWhitneyAI merged 5 commits intomainfrom
feature/reader-name
Dec 8, 2025
Merged

feature/reader-name#54
BrianWhitneyAI merged 5 commits intomainfrom
feature/reader-name

Conversation

@BrianWhitneyAI
Copy link
Contributor

@BrianWhitneyAI BrianWhitneyAI commented Dec 3, 2025

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 BioImage level where users can call BioImage.reader.name to see which reader was selected to read their file.

if self.NAME is not None:
return self.NAME

module = self.__class__.__module__
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: module_name might be a better name for this string?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

agree

Copy link
Contributor

@toloudis toloudis left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@BrianWhitneyAI
Copy link
Contributor Author

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.

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?

I also wonder if we could automatically get NAME from some repo-level config thing like the pyproject file.

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.

@toloudis
Copy link
Contributor

toloudis commented Dec 4, 2025

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.

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?

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")]

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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."

@BrianWhitneyAI BrianWhitneyAI merged commit 47018cd into main Dec 8, 2025
16 checks passed
@BrianWhitneyAI BrianWhitneyAI deleted the feature/reader-name branch December 8, 2025 22:32
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.

5 participants