[Python-Dev] Announcing importlib_resources 0.1

Barry Warsaw barry at python.org
Thu Dec 7 12:48:07 EST 2017


Brett and I have been working on a little skunkworks project for a few weeks, and it’s now time to announce the first release.  We’re calling it importlib_resources and its intent is to replace the “Basic Resource Access” APIs of pkg_resources with more efficient implementations based directly on importlib.

importlib_resources 0.1 provides support for Python 2.7, and 3.4-3.7.  It defines an ABC that loaders can implement to provide direct access to resources inside packages.  importlib_resources has fallbacks for file system and zip file loaders, so it should work out of the box in most of the places that pkg_resources is currently used.  We even have a migration guide for folks who want to drop pkg_resources altogether and adopt importlib_resources.  importlib_resources explicitly does not support pkg_resources features like entry points, working sets, etc.  Still, we think the APIs provided will be good enough for most current use cases.

http://importlib-resources.readthedocs.io/

We are calling it “importlib_resources” because we intend to port this into Python 3.7 under a new importlib.resources subpackage, so starting with Python 3.7, you will get this for free.  The API is going to officially be provisional, but I’ve already done an experimental port of at least one big application (I’ll let you guess which one :) and it’s fairly straightforward, if not completely mechanical unfortunately.  Take a look at the migration guide for details:

http://importlib-resources.readthedocs.io/en/latest/migration.html

We also intend to include the ABC in Python 3.7:

http://importlib-resources.readthedocs.io/en/latest/abc.html

You can of course `pip install importlib_resources`.

We’re hosting the project on GitLab, and welcome feedback, bug fixes, improvements, etc!

 * Project home: https://gitlab.com/python-devs/importlib_resources
 * Report bugs at: https://gitlab.com/python-devs/importlib_resources/issues
 * Code hosting: https://gitlab.com/python-devs/importlib_resources.git
 * Documentation: http://importlib_resources.readthedocs.io/

Cheers.
-Barry and Brett

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <http://mail.python.org/pipermail/python-dev/attachments/20171207/221305c1/attachment.sig>


More information about the Python-Dev mailing list