Why site-packages?

Ian Kelly ian.g.kelly at gmail.com
Wed Jul 4 00:04:45 CEST 2012


On Tue, Jul 3, 2012 at 3:34 PM, Dan Stromberg <drsalists at gmail.com> wrote:
> If it was intended to be reusable code, I'd think it -should- go in
> site-packages.
>
> But so much code in site-packages isn't intended to be reusable.

Can you give some examples?  Looking through my site-packages
directory, everything in there is either used by multiple applications
or at least has the potential to be.  Frankly, if you've installed a
third-party package and written your own code against it, even if only
in one little script, isn't that already reuse?

> And even for stuff that's reusable, there are advantages to just duplicating
> them for the purposes of each application, because you never know when one
> of them is going to need a different version from another.

Definitely a situation for virtualenv, IMO.

>> The site module has to process any .pth files in the site-packages,
>> but apart from that, I think the actual amount of stuff in
>> site-packages should be irrelevant.
>
> Irrelevant to what?   More stuff in site slowing things down?  Are .pth's
> not correlated with more stuff in site-packages?  Aren't they actually a
> thing In site?

Yes, but I just don't expect the .pth files to grow that fast.  I've
got something like 30 packages in my site-packages and only 6 .pth
files, and most of those are one-liners.

Right now this all seems highly speculative to me.  I think it might
be informative, either to you or to me, to do an actual timing test.
Why don't you try setting up two side-by-side installations of Python,
one with all the site-packages cruft, and one trimmed down to only
what you think should be in there, and see if you can measure a real
difference in startup time?



More information about the Python-list mailing list