-
-
Notifications
You must be signed in to change notification settings - Fork 48
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
Add support for a directory of resources #228
Comments
I think you meant to open this in Would expanding |
Yep. I'm often getting these mixed up. |
Right. And that's the core challenge with these file-based providers. If the file (or directory of files) doesn't already exist on the disk, something needs to create them on disk and something needs to later clean up that creation. Hence, the That doesn't mean the files can't persist for longer. For example, see how certifi/python-certifi#147 proposes to use I fail to see how Maybe it would help if you could describe how a ZipReader could present something with |
You know that Not every use-case guarantees this, for eg. the certifi one doesn't. I've had use for it a few times.
It can't, you'd have to resort Just an idea, instead of having
But that puts some extra burden on implementations using traversables that do not inherit from |
Right. And what I want is a solution that works for resources on the file system and resources by other providers, where if a directory of files is needed, it can be extracted to the file system for the duration of a context. I have an implementation drafted. |
Here's a demo of what I have in mind:
|
Today I was looking at jaraco/cssutils#9 and discovered that cssutils takes advantage of directory tree support in pkg_resources. That is,
pkg_resources.resource_filename
supports specifying a directory as a resource and making those contents available on the file system.Currently, the
as_file
implementation only supports a single file and not a tree of files. To support use-cases like those of cssutils,as_file
should support extracting a tree of traversables.The text was updated successfully, but these errors were encountered: