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

Transition to using importlib.resources to open local files #7

Open
samuel-emrys opened this issue May 23, 2020 · 0 comments
Open

Transition to using importlib.resources to open local files #7

samuel-emrys opened this issue May 23, 2020 · 0 comments
Labels
enhancement New feature or request
Milestone

Comments

@samuel-emrys
Copy link
Owner

See: https://docs.python.org/3/library/importlib.html#module-importlib.resources

Allows files to be imported similarly to modules rather than dealing with the complexities of managing relative file paths. Example:

import importlib.resources
from . import resources

mock_response = importlib.resources.open_text(resources, "mock_response.json")
@samuel-emrys samuel-emrys added the enhancement New feature or request label May 23, 2020
@samuel-emrys samuel-emrys added this to the v1.1.0 milestone May 28, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant