Skip to content
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

bugfix/missing-plugin-metadata #59

Merged
merged 5 commits into from
Jul 24, 2024
Merged

Conversation

BrianWhitneyAI
Copy link
Contributor

Description of Changes

The purpose of this PR is to resolve #57. It seems that a plugins distribution metadata does not guarantee that there is an author or license attached to a plugin, thus a key error was raised. This PR adds a conditional for each as well as a test to run dump plugins to help us be aware of future issues with plugin reporting.

@BrianWhitneyAI BrianWhitneyAI marked this pull request as ready for review July 23, 2024 19:40
@BrianWhitneyAI BrianWhitneyAI requested a review from a team as a code owner July 23, 2024 19:40
@BrianWhitneyAI
Copy link
Contributor Author

Looking for some input on best way to test. Looks like there is some issues with python 3.12...


try:
# Install the plugin
subprocess.check_call([sys.executable, "-m", "pip", "install", package_name])
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this test would be safer if you just made a Mock Reader that didn't have an author in it. I'm honestly not sure how easy that would be to do (to act like it was installed), but it might be handy for other unit tests in this repo as well.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

added dummy plugin in 2c49cd8

bioio/plugins.py Outdated
if "author" in dist.metadata:
print(f" Author : {dist.metadata['author']}")
else:
print(" Author : Not specified")
Copy link
Contributor

Choose a reason for hiding this comment

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

I suggest trying to do it so that the string " Author : " is only in one print statement... something more or less like
author = dist.metadata.get("author")
print(f"Author:{author if author is not None else "Not Specified"}")

This feels incrementally less error prone.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

resolved in 2c49cd8

@@ -0,0 +1 @@
recursive-include bioio *.toml
Copy link
Contributor Author

Choose a reason for hiding this comment

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

If anyone knows how to do this in pyproject.toml that is probably better.

Copy link
Contributor

Choose a reason for hiding this comment

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

is this trying to include the dummy plugin? I think for the manifest we want to exclude test files right? or am i misunderstanding

Copy link
Contributor

Choose a reason for hiding this comment

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

also there's a check-manifest section in the main pyproject.toml

Copy link
Contributor

@evamaxfield evamaxfield left a comment

Choose a reason for hiding this comment

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

This all looks good to me! We should remember to update the dummy plugin if we ever change the cookiecutter / reader spec

@BrianWhitneyAI
Copy link
Contributor Author

Looking for some input on best way to test. Looks like there is some issues with python 3.12...

resolved!

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.

one question about the manifest but LGTM overall!

@@ -0,0 +1 @@
recursive-include bioio *.toml
Copy link
Contributor

Choose a reason for hiding this comment

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

is this trying to include the dummy plugin? I think for the manifest we want to exclude test files right? or am i misunderstanding


try:
# Install the plugin
subprocess.check_call([sys.executable, "-m", "pip", "install", DUMMY_PLUGIN])
Copy link
Contributor

Choose a reason for hiding this comment

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

I love the mock plugin, just wish there were a simpler way to "install" it. IDK this is fine tho.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

this is the simplest I have seen. I will do some looking...

@BrianWhitneyAI BrianWhitneyAI merged commit bf86b49 into main Jul 24, 2024
20 checks passed
@BrianWhitneyAI BrianWhitneyAI deleted the bugfix/missing-plugin-metadata branch July 24, 2024 21:07
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.

Bioio plugin dump unable to report plugins
3 participants