Re: Proposed design for importlib.resources()
Nick Coghlan <[email protected]> Wed, 25 Nov 2015 19:36:15 +1000
| Newsgroups | gmane.comp.python.import |
|---|---|
| Message-ID | <CADiSq7dbAqEqOr9=yrKd+i-o=K5iOUE68VEE+vxEEgDW4z7qJw@mail.gmail.com> |
On 25 November 2015 at 10:28, Brett Cannon <[email protected]> wrote: > If we make it e.g., __loader__.resources().read_bytes(path) then I may be > more amenable to creating a importlib.resources module with the bastardized > pkg_resources API. Going to have to think about it, though. I think a compatibility shim on PyPI actually makes more sense, as then you can put the conditional pkg_resources dependency *in the shim*. That is, projects that switch would add a runtime dependency on "pkg_resources_compat" (or whatever name you choose) and then do " import pkg_resources_compat as pkg_resources" On Python 3.5 and earlier versions, pkg_resources_compat would depend on setuptools, and just re-export the pkg_resources APIs. On Python 3.6 and later, it would instead be a compatibility wrapper around the updated import machinery Cheers, Nick. -- Nick Coghlan | [email protected] | Brisbane, Australia