Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #24832 > unrolled thread

Re: Why site-packages?

Started byIan Kelly <ian.g.kelly@gmail.com>
First post2012-07-03 15:04 -0600
Last post2012-07-03 15:04 -0600
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Why site-packages? Ian Kelly <ian.g.kelly@gmail.com> - 2012-07-03 15:04 -0600

#24832 — Re: Why site-packages?

FromIan Kelly <ian.g.kelly@gmail.com>
Date2012-07-03 15:04 -0600
SubjectRe: Why site-packages?
Message-ID<mailman.1758.1341349496.4697.python-list@python.org>
On Tue, Jul 3, 2012 at 2:40 PM, Dan Stromberg <drsalists@gmail.com> wrote:
>
> Why is it that so much 3rd party python code gets installed to
> site-packages?

Because that's what site-packages is for?

> Even for things that are almost certainly going to be used by a single
> application?
>
> Even for things you might only use once?
>
> Even for things that might require one version for one app, and another
> version for another app?

For these types of uses, I suggest using virtualenv if you don't want
to pollute your site-packages.  Or Python 3.3 with the new built-in
virtual environment option.

> Why not stash an application's python modules in /usr/local/lib/[appname],
> and stash a little frontend in /usr/local/bin that adds
> /usr/local/lib/[appname] to sys.path?

What if you then write an application that you find needs two of these
libraries?  You write yet another frontend that adds both of them to
sys.path?

> Here's a thread on stackoverflow today asking why python starts up so
> slowly, and making it clear that this is because so much stuff ends up in
> site-packages:
> http://stackoverflow.com/questions/11318028/is-it-safe-to-use-pythons-s-option

I think you may be misunderstanding that thread.  They're saying that
starting Python with the -S option (i.e. not automatically importing
the site module) significantly cuts down on Python's startup time.
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.  Nothing in site-packages is
actually imported or otherwise processed until the application
requests it.  You could have a completely empty site-packages, or you
could have 20 gigs of third-party packages, and the time to import
site would be basically the same.

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web