Skip to content

Stop using pkg_resources#158

Merged
alexzorin merged 6 commits intomasterfrom
no-pkg-resources
Mar 9, 2023
Merged

Stop using pkg_resources#158
alexzorin merged 6 commits intomasterfrom
no-pkg-resources

Conversation

@bmw
Copy link
Copy Markdown
Member

@bmw bmw commented Mar 7, 2023

When working on #157, I got errors because the new version of setuptools deprecates pkg_resources. To fix that, I used the "Attention" message at the top of https://setuptools.pypa.io/en/latest/pkg_resources.html and https://importlib-resources.readthedocs.io/en/latest/index.html. Importing testdata as a package like this after adding __init__.py Just Works™ for the same reason import test_util works.

@bmw bmw force-pushed the no-pkg-resources branch from b5fe628 to 6c2cc39 Compare March 7, 2023 23:15
@bmw bmw marked this pull request as ready for review March 7, 2023 23:15
"""Path to a test vector."""
return pkg_resources.resource_filename(
__name__, os.path.join('testdata', *names))
file_manager = contextlib.ExitStack()
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

It would be nice to have an explanatory comment here.

For me, it was not obvious that as_file might generate temporary files on disk that need to be cleaned up.

Copy link
Copy Markdown
Member Author

@bmw bmw Mar 9, 2023

Choose a reason for hiding this comment

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

That's totally reasonable. I linked to the migration guide I based this code on.

@alexzorin alexzorin self-assigned this Mar 8, 2023
Copy link
Copy Markdown
Collaborator

@alexzorin alexzorin left a comment

Choose a reason for hiding this comment

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

LGTM!

@alexzorin alexzorin merged commit 8f1b4b5 into master Mar 9, 2023
@alexzorin alexzorin deleted the no-pkg-resources branch March 9, 2023 21:00
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