Ipython: Set default IPython profile with environment variable

Created on 21 Aug 2019  路  3Comments  路  Source: ipython/ipython

It would be nice to set the IPython profile with an environment variable, i.e. something like

$ IPYTHON_PROFILE=testing ipython
Python 3.7.4 (default, Aug 13 2019, 20:35:49) 
Type 'copyright', 'credits' or 'license' for more information
IPython 7.7.0 -- An enhanced Interactive Python. Type '?' for help.

IPython profile: testing
In [1]:

My particular use case is to use the conda {de,}activate.d/ hooks to change profiles based on which conda environment is active. At the moment, an easy hack is to alias ipython to ipython --profile={profile} and then unalias in deactivate, but environment variables would be cleaner.

Most helpful comment

:+1:
It would be nice to have this feature. Many applications let use IPython instead of standard shell, but we cannot specify profile when it invokes.

All 3 comments

$IPYTHONDIR allows you to redefine $HOME/.ipython (where the profiles are located) to somewhere else, rather than which profile is selected.

You could have a hack where each profile sits in its own .ipython directory, but this is worse than the alias trick.

:+1:
It would be nice to have this feature. Many applications let use IPython instead of standard shell, but we cannot specify profile when it invokes.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

ipython picture ipython  路  3Comments

okomarov picture okomarov  路  3Comments

gregcaporaso picture gregcaporaso  路  3Comments

sataliulan picture sataliulan  路  4Comments

minrk picture minrk  路  5Comments