Re: Proposed design for importlib.resources()

Barry Warsaw <[email protected]> Wed, 25 Nov 2015 10:16:15 -0500
Newsgroups gmane.comp.python.import
Organization Damn Crazy Followers of the Horn
Message-ID <[email protected]>
--===============3887494574205752987==
Content-Type: multipart/signed; micalg=pgp-sha256;
 boundary="Sig_/2h6qDS2q+Jza3rve5_4Sbz2"; protocol="application/pgp-signature"

--Sig_/2h6qDS2q+Jza3rve5_4Sbz2
Content-Type: text/plain; charset=US-ASCII
Content-Transfer-Encoding: quoted-printable

On Nov 25, 2015, at 12:28 AM, Brett Cannon 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 hope it works out.

I want a lot of people to use the stdlib API as soon as possible.  That not
only reduces an external dependency, but helps to exercise the stdlib code
much more quickly, exposing any bugs, corner cases, or missing features
early.  If there's an easy migration path, it's much more likely to be adop=
ted
sooner.  Case in point: the enum module, which was compatible enough with
existing third party APIs that a simple conditional import statement allowed
for an early opt-in.

A third party shim module has several disadvantages.  You're trading one
external dependency for another, and on some platform you might even be
trading a distro-packaged one for a non-distro-packaged one.  You're certai=
nly
trading a tried-and-true dependency for a brand new one.  Plus, you have to
commit to supporting that new PyPI package for a long time, and make it
compatible across multiple versions of Python.  If you're going to go throu=
gh
all that trouble, why not include the batteries in the first place?

It's not like the simple pkg_resources API is a bad API.

Since I think you understand where I'm coming from by now, I'll stop
belaboring the point.

Cheers,
-Barry

--Sig_/2h6qDS2q+Jza3rve5_4Sbz2
Content-Type: application/pgp-signature
Content-Description: OpenPGP digital signature

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v2

iQIcBAEBCAAGBQJWVdDAAAoJEBJutWOnSwa/It8QAJYXzo4GBjwhawefi0+WU64z
bdvdnmlJGIX0rZwWvok4Qiw9NpP4LaXyvfmpwNEDGrayVTO+RrdIpI765T8w/k8O
jSratUXMIPBhg4E3hkk6yDiOxnNtUhK5xeIRF/Y+cgEvT1K62iNXv4uGkcwdGvHh
xevn47dzlbPcvfj2WTGVl0xJVQAg/vOsZI9yOIllzDrOJ8XHL4HZWFdTsYPTWFaC
U6YBs4MabygHNQgHX4B6BbbJHJSIjtvk0llxqPxpYBygHAXROIbfmfQI3XCX7eWw
blNqNmXEmsP++4h0+k9N8gSnrOQTcRZSY6+OgCOpm2gudAunGtHZi+/t/ep8LosA
9Q1m6aNf4DVM6d1J9Qs4b1ldMT7vFOlaotOKu1oPs9yVEnpV3dZ0JmtYJlZcFSdS
+hsfva4pSQ8WcvU2zVQdS5ozODycFvZ21YWrMI1UWJv3GxB85/cxi4dQ6dkHQ4/u
4aX4FxWVCdt5HXJST3ev7mTAmjEWoRecvuUOncPX5UCvV4gkMIXl1SgoKm+Ok0Cm
BOorNQ7V16N2btAbrQGjBcIW49RpbT3/C0/KnXwG/7eshEdYSu4n7n1huzZ4z5MJ
z8jXYRqtxi/uPKhkt7sUdN2cR8CZ4TPs8/yELkc1sYX9CW5/sxUm0a7VGFYKBQHl
TFm+vmBlECO/CD8FrFl+
=3wLS
-----END PGP SIGNATURE-----

--Sig_/2h6qDS2q+Jza3rve5_4Sbz2--

--===============3887494574205752987==
Content-Type: text/plain; charset="us-ascii"
MIME-Version: 1.0
Content-Transfer-Encoding: 7bit
Content-Disposition: inline

_______________________________________________
Import-SIG mailing list
[email protected]
https://mail.python.org/mailman/listinfo/import-sig

--===============3887494574205752987==--