<br><br><div class="gmail_quote">On Tue, Jul 3, 2012 at 9:04 PM, Ian Kelly <span dir="ltr"><<a href="mailto:ian.g.kelly@gmail.com" target="_blank">ian.g.kelly@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div class="im">On Tue, Jul 3, 2012 at 2:40 PM, Dan Stromberg <<a href="mailto:drsalists@gmail.com">drsalists@gmail.com</a>> wrote:<br>
><br>
> Why is it that so much 3rd party python code gets installed to<br>
> site-packages?<br>
<br>
</div>Because that's what site-packages is for?<br><div class="im"></div></blockquote><div><br>Agh.  But -why- is it because that's what it's for?<br><br>"Who made this rule"?<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
> Even for things that are almost certainly going to be used by a single<br>
> application?<br>
><br>
> Even for things you might only use once?<br>
><br>
> Even for things that might require one version for one app, and another<br>
> version for another app?<br>
<br>
</div>For these types of uses, I suggest using virtualenv if you don't want<br>
to pollute your site-packages.  Or Python 3.3 with the new built-in<br>
virtual environment option.<br><div class="im"></div></blockquote><div>Virtualenv is worth thinking about, but it kind of does the same thing, just less of it.<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
> Why not stash an application's python modules in /usr/local/lib/[appname],<br>
> and stash a little frontend in /usr/local/bin that adds<br>
> /usr/local/lib/[appname] to sys.path?<br>
<br>
</div>What if you then write an application that you find needs two of these<br>
libraries?  You write yet another frontend that adds both of them to<br>
<div class="im">sys.path?<br></div></blockquote><div>If it was intended to be reusable code, I'd think it -should- go in site-packages.<br><br>But so much code in site-packages isn't intended to be reusable.<br><br>
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.<br><br>
If we weren't stashing so much stuff in site-packages, there probably wouldn't have been a desire for something like virtualenv.<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
<div class="im">
> Here's a thread on stackoverflow today asking why python starts up so<br>
> slowly, and making it clear that this is because so much stuff ends up in<br>
> site-packages:<br>
> <a href="http://stackoverflow.com/questions/11318028/is-it-safe-to-use-pythons-s-option" target="_blank">http://stackoverflow.com/questions/11318028/is-it-safe-to-use-pythons-s-option</a><br>
<br>
</div>I think you may be misunderstanding that thread.  They're saying that<br>
starting Python with the -S option (i.e. not automatically importing<br>
the site module) significantly cuts down on Python's startup time.<br></blockquote><div>Yes...<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

The site module has to process any .pth files in the site-packages,<br>
but apart from that, I think the actual amount of stuff in<br>
site-packages should be irrelevant.</blockquote><div>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?<br>
 <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  Nothing in site-packages is<br>
actually imported or otherwise processed until the application<br>
requests it.</blockquote><div>Other than .pth's, apparently.<br> <br></div><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">  You could have a completely empty site-packages, or you<br>

could have 20 gigs of third-party packages, and the time to import<br>
site would be basically the same.<br>
</blockquote></div>Well, I'd guess that a large directory would slow things down before causing filesystem complaints, but I see your point.<br><br>