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.
Have you tried setting $IPYTHONDIR?
https://ipython.readthedocs.io/en/stable/config/intro.html?highlight=ipythondir#envvar-IPYTHONDIR
$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.
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.