<html><head><meta http-equiv="Content-Type" content="text/html charset=utf-8"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Jan 31, 2015, at 7:59 PM, Donald Stufft <<a href="mailto:donald@stufft.io" class="">donald@stufft.io</a>> wrote:</div><div class=""><div style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;" class=""><blockquote type="cite" class=""><div class=""><div dir="ltr" class="" style="font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px;"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left-width: 1px; border-left-color: rgb(204, 204, 204); border-left-style: solid; padding-left: 1ex;"><div class="" style="word-wrap: break-word;"><div class=""><div class=""><br class=""></div><div class="">How this is implemented in the Loader() API can be whatever folks want. The important thing is that these all solve actual use cases and solve them better and easier than the naive approach of using os.path functions directly. </div><div class=""><br class=""></div><div class="">Important Things:</div><div class=""><br class=""></div><div class="">* resource_filename and ResourceFilename() must return the real file system path if available and a temporary file else wise.</div><div class="">* resource_filename *must* be available for the lifetime of the process once the function has been called.</div><div class="">* ResourceFilename *must* clean itself up at the end of the context manager.</div><div class="">* These functions/context managers *must* work in terms of package names and relative file paths.</div></div></div></blockquote><div class=""><br class=""></div><div class="">All seem reasonable to me.</div><div class=""><br class=""></div></div></div></div></blockquote></div></div></blockquote></div><div class=""><br class=""></div><div class="">Oh, one additional thing that I think is important:</div><div class=""><br class=""></div><div class="">They should work with modules (foo -> foo.py), packages (foo -> foo/__init__.py), old style “namespace” packages via extending __path__ (foo -> multiple foo/__init__.py ), new style namespace packages (foo -> multiple foo/). What file path to use is obvious in the first two cases because there is only one candidate file. For the other two I think it should just use the order of the __path__ and return the first one it finds (or None/Exception if it doesn’t find one).</div><br class=""><div class="">
<div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div style="color: rgb(0, 0, 0); letter-spacing: normal; orphans: auto; text-align: start; text-indent: 0px; text-transform: none; white-space: normal; widows: auto; word-spacing: 0px; -webkit-text-stroke-width: 0px; word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><div class="">---</div><div class="">Donald Stufft</div><div class="">PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA</div></div></div>
</div>
<br class=""></body></html>