I've asked before about bundling Distribute. But now I ask, is it possible to pull out the `pkg_resources` module from the Distribute folder and bundle only that with my project? Also, is that `pkg_resources` module different than the one that comes with setuptools? Thanks, Ram.
On Mon, Nov 30, 2009 at 3:09 PM, Ram Rachum <cool-rr@cool-rr.com> wrote:
I've asked before about bundling Distribute. But now I ask, is it possible to pull out the `pkg_resources` module from the Distribute folder and bundle only that with my project?
Technically, yes : it's a standalone module that depends only on the stdlib. What would be the use case for this ? I don't think it's the best practice to bundle other projects modules like that in most cases.
Also, is that `pkg_resources` module different than the one that comes with setuptools?
It is the same API and behavior. It has a few internals changes though to deal with the incompatibility with the Setuptools project, but is meant to work as a full replacement. Regards, Tarek
On Mon, Nov 30, 2009 at 6:10 PM, Tarek Ziadé <ziade.tarek@gmail.com> wrote:
I've asked before about bundling Distribute. But now I ask, is it
On Mon, Nov 30, 2009 at 3:09 PM, Ram Rachum <cool-rr@cool-rr.com> wrote: possible to
pull out the `pkg_resources` module from the Distribute folder and bundle only that with my project?
Technically, yes : it's a standalone module that depends only on the stdlib.
Great. So I can just yank out the `pkg_resources.py` file and it should work?
What would be the use case for this ? I don't think it's the best practice to bundle other projects modules like that in most cases.
Up to now I've been requiring my users to install Distribute, but one of them expressed reluctance to install it, partly because of the shadowing of setuptools. Ram.
On Mon, Nov 30, 2009 at 5:41 PM, cool-RR <cool-rr@cool-rr.com> wrote: [..]
What would be the use case for this ? I don't think it's the best practice to bundle other projects modules like that in most cases.
Up to now I've been requiring my users to install Distribute, but one of them expressed reluctance to install it, partly because of the shadowing of setuptools.
The only extra features Distribute provides are: - python 3 support - the upload_doc command The rest is the same APIs, minus some bug fixes we did, and the code that prevents concurrency problems with an installed setuptools. So if you just depend on pkg_resources, it means that your program can also work with Setuptools. So I would suggest to tell this user to install the tool he wants, and just warn him that he might bump into bugs in Setuptools that were fixed in Distribute. IOW, choosing between Distribute or Setuptools should be up to your users, *unless* you use python 3 support in your setup.py, that is only present in Distribute. And as far as I can see, Distribute as a drop-in replacement works well, besides some glitches we had to fix in zc.buildout and virtualenv because those were "married" to setuptools. Semi-related: If I can help in convincing this user, let me know Regards Tarek
You didn't answer my question about whether I can just yank out `pkg_resources.py` and use it.
What would be the use case for this ? I don't think it's the best
practice to bundle other projects modules like that in most cases.
Up to now I've been requiring my users to install Distribute, but one of them expressed reluctance to install it, partly because of the shadowing of setuptools.
The only extra features Distribute provides are:
- python 3 support - the upload_doc command
The rest is the same APIs, minus some bug fixes we did, and the code that prevents concurrency problems with an installed setuptools.
So if you just depend on pkg_resources, it means that your program can also work with Setuptools.
So I would suggest to tell this user to install the tool he wants, and just warn him that he might bump into bugs in Setuptools that were fixed in Distribute.
Well, that sort of sucks. And this is my motivation for bundling the `pkg_resources` from Distribute. The last thing I want is having my software fail for my users because of setuptools while I have Distribute installed locally and can't see the bug on my computer.
IOW, choosing between Distribute or Setuptools should be up to your users, *unless* you use python 3 support in your setup.py, that is only present in Distribute.
And as far as I can see, Distribute as a drop-in replacement works well, besides some glitches we had to fix in zc.buildout and virtualenv because those were "married" to setuptools.
Semi-related: If I can help in convincing this user, let me know
I tried a bit, but I don't want to bother him more than I currently am. Ram.
On Mon, Nov 30, 2009 at 18:16, cool-RR <cool-rr@cool-rr.com> wrote:
You didn't answer my question about whether I can just yank out `pkg_resources.py` and use it.
Yes, but then it will again shadow the pkg_resources.py from setuptools/Distribute, so why your customer would be more happy with that I don't know.
Well, that sort of sucks. And this is my motivation for bundling the `pkg_resources` from Distribute. The last thing I want is having my software fail for my users because of setuptools while I have Distribute installed locally and can't see the bug on my computer.
You can have two pythons installed, one with setuptools and one with Distribute. -- Lennart Regebro: Python, Zope, Plone, Grok http://regebro.wordpress.com/ +33 661 58 14 64
At 02:09 PM 11/30/2009 +0000, Ram Rachum wrote:
I've asked before about bundling Distribute. But now I ask, is it possible to pull out the `pkg_resources` module from the Distribute folder and bundle only that with my project?
If your project is a standalone application with a completely isolated sys.path, then yes, you can bundle it. If your project is a library or shares sys.path directories with other libraries or applications, then no, *do not bundle it*. (This is true even for the original pkg_resources, but it's doubly true for Distribute's pkg_resources, as installing it may break a setuptools-based installation's ability to upgrade setuptools.)
On Mon, Nov 30, 2009 at 7:57 PM, P.J. Eby <pje@telecommunity.com> wrote:
At 02:09 PM 11/30/2009 +0000, Ram Rachum wrote:
I've asked before about bundling Distribute. But now I ask, is it possible to pull out the `pkg_resources` module from the Distribute folder and bundle only that with my project?
If your project is a standalone application with a completely isolated sys.path, then yes, you can bundle it. If your project is a library or shares sys.path directories with other libraries or applications, then no, *do not bundle it*.
(This is true even for the original pkg_resources, but it's doubly true for Distribute's pkg_resources, as installing it may break a setuptools-based installation's ability to upgrade setuptools.)
What I was thinking is to put it in its own package, and then import it like `from my_package import pkg_resources`. Would that still be problematic? Ram.
participants (5)
-
cool-RR
-
Lennart Regebro
-
P.J. Eby
-
Ram Rachum
-
Tarek Ziadé