To go from a dotted asset specification you may use pyramid.path.AssetResolver
, as the documentation states, it looks like this:
from pyramid.path import AssetResolver
a = AssetResolver()
resolver = a.resolve('myproject:templates/foo.pt')
print(resolver.abspath())
# -> /path/to/myproject/templates/foo.pt
Specifically it has this to say about resolving paths:
If spec is an absolute filename (e.g. /path/to/myproject/templates/foo.pt
) or an absolute asset spec (e.g. myproject:templates/foo.pt
), an asset descriptor is returned without taking into account the package passed to this class' constructor.
However I would highly recommend against letting users modify the template files inside your package directly. What I would recommend instead is that you in your installation procedures have a way of copying all your templates out of your package, and then using Pyramids asset override mechanism to sub out the existing asset specs with a new location. At that point you can use the standard Python open/close file methods to have the user update the templates.