[Distutils] pkg_resources: Loading resources in a uniform fashion
mailing at franzoni.eu
Thu Oct 28 18:18:51 CEST 2010
lately I was thinking about writing a kind of factory method for
parsing an url and returning a resource filename or stream, something
fs_resource = load_resource_filename("file:///etc/software/config.conf")
pkg_resource = load_resource_filename("pkg://package.something")
I'd like the first one to just return the file system path
"/etc/software/config.conf", while I'd like the second one one to do
something roughly like
from pkg_resources import resource_filename
return resource_filename("package", "something")
This way it would be pretty easy to get a consistent way to describe a
resource from a stream.
I've got some questions:
1) is there anything around that already does something like that?
2) would you think it to be a good addition for pkg_resources, or
would it go beyond its scope?
3) can you see some obvious issues?
4) how would you handle requirements string?
contact me at public@[mysurname].eu
More information about the Distutils-SIG