-
-
Notifications
You must be signed in to change notification settings - Fork 47
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
Unable to load resources for modules #203
Comments
Shouldn't Another option would be |
Would it be possible to make Currently, the best option to plug the current module into to |
@jaraco I would like to hear your feedback on this proposal when you have time. Personally, I have mixed feelings, but can't come up with anything better. Actually, I would really like for Python to add a |
Today I noticed the comments and they were minimized, though I'm unsure why. I've unhidden the comments as they seem valid and in good faith. |
Sure, if you wish to assume that all resources are on the file system and if you're willing to force the user to encode the structure of their modules into their implementation, then that's fine. However, it's these use-cases that
Yes, but again, I'd rather provide a uniform solution for users instead of a set of instructions that boils down to: "use importlib resources when you have resources in packages, but use some other technique when you have resources alongside modules."
Yes, I was thinking something like that. Especially if |
Yeah, I marked them as "outdated" as I looked into the issue and realized the proposals did not make much sense. |
…tion of resources from adjacent modules, even those not found in a package. Fixes #203.
…tion of resources from adjacent modules, even those not found in a package. Fixes #203.
In #60, I encountered an issue where importlib resources was unable to supply an interface for modules that wish to load neighboring resources. I've encountered another use-case where it's not straightforward to replace the pkg_resources usage with importlib.resources.
Again, in this case, because the test module isn't in a package, importlib resources doesn't support it, but
pkg_resources
does. The current workarounds include:tests
directory a proper package. However, doing this also causes that package to get discovered as a package.__file__
to infer the location of nearby resources.In my opinion, if 'importlib' supports importing non-package modules, 'importlib resources' should support loading resources pertinent to those modules.
The text was updated successfully, but these errors were encountered: