guix-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Down with PYTHONPATH!


From: Pjotr Prins
Subject: Re: Down with PYTHONPATH!
Date: Mon, 17 Jun 2019 10:48:52 -0500
User-agent: NeoMutt/20170113 (1.7.2)

On Mon, Jun 17, 2019 at 12:20:12PM +0200, Konrad Hinsen wrote:
> Hi Ludo,
> 
> > How does virtualenv work, if not by setting PYTHONPATH?
> 
> It creates a new filetree corresponding to a complete new Python
> installation, and the uses soft links to share most of the actual files
> with the parent installation.

Exactly, Python is 'aware' of certain default paths. Virtualenv uses
that.

> > Setting up an environment all about augmenting the search path, so I
> > naively thought that virtualenv sets PYTHONPATH or the corresponding
> > Python variable.
> 
> PYTHONPATH only adds directories to the search path. The standard
> library and packages installed via pip are already on the search path
> before PYTHONPATH is looked at. So virtualenv could not work by
> modifying PYTHONPATH.

PYTHONPATH's main use is to override the search path for modules. Guix
using this is a recipe for trouble because users will always want to
set it for their own purposes (I do the same for the genenetwork
stack) and you get the question of precedence and versioning - I solve
it by creating a module library that makes use of a Guix hash so it is
tied to one interpreter.

We should always allow people to override PYTHONPATH.

For Guix it would actually make sense to make the interpreter Guix
aware. Since we don't abide by the default paths I think it takes very
much approach similar to overriding RPATH to solve this satisfactory.

That does imply patching the interpreter. All interpreters, including
Ruby and Perl. A special environment variable may work too.

It would be interesting to see how others solve this problem.
Including Nix and Conda.

Pj.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]