[Distutils] Code for inserting paths into system configuration?

Nick Coghlan ncoghlan at gmail.com
Wed Sep 14 00:24:39 EDT 2016

On 14 September 2016 at 14:13, Nick Coghlan <ncoghlan at gmail.com> wrote:
> On 14 September 2016 at 07:00, Glyph Lefkowitz <glyph at twistedmatrix.com> wrote:
>> On Sep 13, 2016, at 12:58 PM, Matthew Brett <matthew.brett at gmail.com> wrote:
>>> I was reflecting on the detail of putting pip user bin directories on
>>> the user's path, and was then thinking of making a tiny pip package
>>> like this:
>>> pip install pip_user_config
>>> python -m pip_user_config
>>> where the latter would cleverly insert the user bin directory into the
>>> user's configuration.
>>> Does anyone know of any code to do something like that?
>> This is shell- and platform-specific.  This would be a great idea!  But it would be a challenging integration project.
> I know the Anaconda installer (the Continuum Analytics one) does this
> (since I've reported a bug against it for messing up user level access
> to the system SQLite installation)

Thinking about that a bit more, I realised I was misremembering - the
bug was in the way "conda env" activation scripts worked, not in the
initial installation of Anaconda.

So those activation scripts and the equivalent ones for virtualenv and
venv are worth a look for understanding how to configure a currently
active shell session (which is shell dependent), while venv management
tools like vex and pew show how to launch a new subshell with a
reconfigured environment (which is easier to make shell independent
and portable across platforms).

What we don't currently have is anything which makes it easy to set up
a shell session where you're still using the system Python, but "pip
install" is targeting your user site-packages directory (regardless of
the system-wide default behaviour - this is the default on Debian &
Ubuntu for example, but not yet the default on Fedora et al), and you
can run scripts from "~/.local/bin" (this is the default on Fedora,
but not on Debian and Ubuntu, and not necessarily on Fedora
derivatives either)


Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia

More information about the Distutils-SIG mailing list