Skip to content

Update resource import strategy to resolve deprecation warnings #213

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

Merged
merged 1 commit into from
Apr 3, 2024

Conversation

kroenlein
Copy link
Collaborator

importlib has deprecated several methods in favor of methods that are not available in Python 3.8. This PR imports their third-party re-implementations to maintain 3.8 support while resolving the warnings for 3.12 in this and downstream libraries.

resource = read_binary("gemd.demo", "toothpick.jpg")

return BytesIO(resource)
return files("gemd.demo").joinpath("toothpick.jpg").open("rb")

Choose a reason for hiding this comment

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

Should we rewrite this to files("gemd.demo").joinpath("toothpick.jpg").read_bytes() to be consistent with strehlow_and_cook.py and test_parser.py?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

It'd be nice, but that would break downstream consumers that expect a byte stream instead of bytes.

Copy link

@mVenetos97 mVenetos97 left a comment

Choose a reason for hiding this comment

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

Looks good to me

@kroenlein kroenlein merged commit f84671e into main Apr 3, 2024
@kroenlein kroenlein deleted the maintain/resolve-import-warnings branch April 3, 2024 20:16
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.

2 participants