Permalink
Browse files

Merge pull request #1693 from bfroehle/_1167_ipythondir

deprecate IPYTHON_DIR in favor of IPYTHONDIR

IPYTHON_DIR was a proposed rename, whose added complexity does not outweigh any potential benefit, and is reverted.

closes #1167
  • Loading branch information...
2 parents c7e29e4 + a6feaed commit dbeeefd16d5339437700ebc6eb55359ca6232bea @minrk minrk committed May 4, 2012
@@ -118,7 +118,7 @@ def _profile_changed(self, name, old, new):
The name of the IPython directory. This directory is used for logging
configuration (through profiles), history storage, etc. The default
is usually $HOME/.ipython. This options can also be specified through
- the environment variable IPYTHON_DIR.
+ the environment variable IPYTHONDIR.
"""
)
@@ -148,7 +148,7 @@ def _config_files_default(self):
def __init__(self, **kwargs):
super(BaseIPythonApplication, self).__init__(**kwargs)
- # ensure even default IPYTHON_DIR exists
+ # ensure even default IPYTHONDIR exists
if not os.path.exists(self.ipython_dir):
self._ipython_dir_changed('ipython_dir', self.ipython_dir, self.ipython_dir)
@@ -186,7 +186,7 @@ def _ipython_dir_changed(self, name, old, new):
if not os.path.exists(readme):
path = os.path.join(get_ipython_package_dir(), u'config', u'profile')
shutil.copy(os.path.join(path, 'README'), readme)
- self.log.debug("IPYTHON_DIR set to: %s" % new)
+ self.log.debug("IPYTHONDIR set to: %s" % new)
def load_config_file(self, suppress_errors=True):
"""Load the config file.
@@ -135,7 +135,7 @@ class ProfileList(Application):
The name of the IPython directory. This directory is used for logging
configuration (through profiles), history storage, etc. The default
is usually $HOME/.ipython. This options can also be specified through
- the environment variable IPYTHON_DIR.
+ the environment variable IPYTHONDIR.
"""
)
View
@@ -39,21 +39,21 @@
configuration, look into your `ipython_config.py` configuration file for
details.
- This file is typically installed in the `IPYTHON_DIR` directory, and there
+ This file is typically installed in the `IPYTHONDIR` directory, and there
is a separate configuration directory for each profile. The default profile
- directory will be located in $IPYTHON_DIR/profile_default. For Linux users,
- IPYTHON_DIR defaults to `$HOME/.config/ipython`, and for other Unix systems
+ directory will be located in $IPYTHONDIR/profile_default. For Linux users,
+ IPYTHONDIR defaults to `$HOME/.config/ipython`, and for other Unix systems
to `$HOME/.ipython`. For Windows users, $HOME resolves to C:\\Documents
and Settings\\YourUserName in most instances.
To initialize a profile with the default configuration file, do::
$> ipython profile create
- and start editing `IPYTHON_DIR/profile_default/ipython_config.py`
+ and start editing `IPYTHONDIR/profile_default/ipython_config.py`
In IPython's documentation, we will refer to this directory as
- `IPYTHON_DIR`, you can change its default location by creating an
+ `IPYTHONDIR`, you can change its default location by creating an
environment variable with this name and setting it to the desired path.
For more information, see the manual available in HTML and PDF in your
View
@@ -260,7 +260,10 @@ def get_ipython_dir():
xdg_dir = get_xdg_dir()
# import pdb; pdb.set_trace() # dbg
- ipdir = env.get('IPYTHON_DIR', env.get('IPYTHONDIR', None))
+ if 'IPYTHON_DIR' in env:
+ warnings.warn('The environment variable IPYTHON_DIR is deprecated. '
+ 'Please use IPYTHONDIR instead.')
+ ipdir = env.get('IPYTHONDIR', env.get('IPYTHON_DIR', None))
if ipdir is None:
# not set explicitly, use XDG_CONFIG_HOME or HOME
home_ipdir = pjoin(home_dir, ipdir_def)
@@ -318,7 +321,7 @@ def get_ipython_module_path(module_str):
def locate_profile(profile='default'):
"""Find the path to the folder associated with a given profile.
- I.e. find $IPYTHON_DIR/profile_whatever.
+ I.e. find $IPYTHONDIR/profile_whatever.
"""
from IPython.core.profiledir import ProfileDir, ProfileDirError
try:
@@ -206,7 +206,7 @@ def test_get_ipython_dir_1():
"""test_get_ipython_dir_1, Testcase to see if we can call get_ipython_dir without Exceptions."""
env_ipdir = os.path.join("someplace", ".ipython")
path._writable_dir = lambda path: True
- env['IPYTHON_DIR'] = env_ipdir
+ env['IPYTHONDIR'] = env_ipdir
ipdir = path.get_ipython_dir()
nt.assert_equal(ipdir, env_ipdir)
@@ -278,10 +278,10 @@ def test_get_ipython_dir_6():
@with_environment
def test_get_ipython_dir_7():
- """test_get_ipython_dir_7, test home directory expansion on IPYTHON_DIR"""
+ """test_get_ipython_dir_7, test home directory expansion on IPYTHONDIR"""
path._writable_dir = lambda path: True
home_dir = os.path.expanduser('~')
- env['IPYTHON_DIR'] = os.path.join('~', 'somewhere')
+ env['IPYTHONDIR'] = os.path.join('~', 'somewhere')
ipdir = path.get_ipython_dir()
nt.assert_equal(ipdir, os.path.join(home_dir, 'somewhere'))
View
@@ -11,7 +11,7 @@
ipcluster is a control tool for IPython's parallel computing functions.
IPython cluster startup. This starts a controller and engines using various
-approaches. Use the IPYTHON_DIR environment variable to change your IPython
+approaches. Use the IPYTHONDIR environment variable to change your IPython
directory from the default of ~/.ipython or ~/.config/ipython. The log and security
subdirectories of your IPython directory will be used by this script for log
files and security files.
View
@@ -100,7 +100,7 @@ Default: u'/Users/minrk/.ipython'
The name of the IPython directory. This directory is used for logging
configuration (through profiles), history storage, etc. The default is
usually $HOME/.ipython. This options can also be specified through the
-environment variable IPYTHON_DIR.
+environment variable IPYTHONDIR.
.TP
.B \-\-url=<Unicode> (HubFactory.url)
Default: ''
View
@@ -51,7 +51,7 @@ whether to log to a file
The name of the IPython directory. This directory is used for logging
configuration (through profiles), history storage, etc. The default is
usually $XDG_CONFIG_HOME/ipython. This options can also be specified
-through the environment variable IPYTHON_DIR.
+through the environment variable IPYTHONDIR.
.TP
.B \-\-url=<Unicode> (LogWatcher.url)
.
View
@@ -182,7 +182,7 @@ Default: u'/Users/minrk/.ipython'
The name of the IPython directory. This directory is used for logging
configuration (through profiles), history storage, etc. The default is
usually $HOME/.ipython. This options can also be specified through the
-environment variable IPYTHON_DIR.
+environment variable IPYTHONDIR.
.TP
.B \-\-gui=<CaselessStrEnum> (TerminalIPythonApp.gui)
Default: None
@@ -95,7 +95,7 @@ sequences. You can go to a 'no color' mode by typing '%colors NoColor'.
You can try using a different terminal emulator program (Emacs users,
see below). To permanently set your color preferences, edit the file
-$IPYTHON_DIR/ipythonrc and set the colors option to the desired value.
+$IPYTHONDIR/ipythonrc and set the colors option to the desired value.
Object details (types, docstrings, source code, etc.)
@@ -284,8 +284,10 @@ following algorithm:
* If the ``ipython_dir`` command line flag is given, its value is used.
* If not, the value returned by :func:`IPython.utils.path.get_ipython_dir`
- is used. This function will first look at the :envvar:`IPYTHON_DIR`
+ is used. This function will first look at the :envvar:`IPYTHONDIR`
environment variable and then default to a platform-specific default.
+ Historical support for the :envvar:`IPYTHON_DIR` environment variable will
+ be removed in a future release.
On posix systems (Linux, Unix, etc.), IPython respects the ``$XDG_CONFIG_HOME``
part of the `XDG Base Directory`_ specification. If ``$XDG_CONFIG_HOME`` is
@@ -302,7 +304,7 @@ elsewhere.
Once the location of the IPython directory has been determined, you need to know
which profile you are using. For users with a single configuration, this will
simply be 'default', and will be located in
-:file:`<IPYTHON_DIR>/profile_default`.
+:file:`<IPYTHONDIR>/profile_default`.
The next thing you need to know is what to call your configuration file. The
basic idea is that each application has its own default configuration filename.
@@ -344,7 +346,7 @@ Let's start by showing how a profile is used:
This tells the :command:`ipython` command line program to get its configuration
from the "sympy" profile. The file names for various profiles do not change. The
only difference is that profiles are named in a special way. In the case above,
-the "sympy" profile means looking for :file:`ipython_config.py` in :file:`<IPYTHON_DIR>/profile_sympy`.
+the "sympy" profile means looking for :file:`ipython_config.py` in :file:`<IPYTHONDIR>/profile_sympy`.
The general pattern is this: simply create a new profile with:
@@ -400,9 +400,9 @@ generate this key, but the default is just to generate a new UUID. You can gener
private key with::
# generate 1024b of random data, and store in a file only you can read:
- # (assumes IPYTHON_DIR is defined, otherwise use your IPython directory)
- $> python -c "import os; print os.urandom(128).encode('base64')" > $IPYTHON_DIR/sessionkey
- $> chmod 600 $IPYTHON_DIR/sessionkey
+ # (assumes IPYTHONDIR is defined, otherwise use your IPython directory)
+ $> python -c "import os; print os.urandom(128).encode('base64')" > $IPYTHONDIR/sessionkey
+ $> chmod 600 $IPYTHONDIR/sessionkey
The *contents* of this file will be stored in the JSON connection file, so that file
contains everything you need to connect to and use a kernel.
@@ -411,7 +411,7 @@ To use this generated key, simply specify the ``Session.keyfile`` configurable
in :file:`ipython_config.py` or at the command-line, as in::
# instruct IPython to sign messages with that key, instead of a new UUID
- $> ipython qtconsole --Session.keyfile=$IPYTHON_DIR/sessionkey
+ $> ipython qtconsole --Session.keyfile=$IPYTHONDIR/sessionkey
.. _ssh_tunnels:
@@ -26,7 +26,7 @@ the command line, simply because they are not practical here. Look into
your configuration files for details on those. There are separate configuration
files for each profile, and the files look like "ipython_config.py" or
"ipython_config_<frontendname>.py". Profile directories look like
-"profile_profilename" and are typically installed in the IPYTHON_DIR directory.
+"profile_profilename" and are typically installed in the IPYTHONDIR directory.
For Linux users, this will be $HOME/.config/ipython, and for other users it
will be $HOME/.ipython. For Windows users, $HOME resolves to C:\\Documents and
Settings\\YourUserName in most instances.
@@ -249,7 +249,7 @@ Persistent command history across sessions
IPython will save your input history when it leaves and reload it next
time you restart it. By default, the history file is named
-$IPYTHON_DIR/profile_<name>/history.sqlite. This allows you to keep
+$IPYTHONDIR/profile_<name>/history.sqlite. This allows you to keep
separate histories related to various tasks: commands related to
numerical work will not be clobbered by a system shell history, for
example.
@@ -26,7 +26,7 @@ the "pysh" shortcut in start menu.
If you want to use the features of sh profile as your defaults (which
might be a good idea if you use other profiles a lot of the time but
still want the convenience of sh profile), add ``import ipy_profile_sh``
-to your $IPYTHON_DIR/ipy_user_conf.py.
+to your $IPYTHONDIR/ipy_user_conf.py.
The 'sh' profile is different from the default profile in that:
@@ -37,7 +37,7 @@ module and then create a :class:`.Client` instance:
In [2]: rc = Client()
This form assumes that the default connection information (stored in
-:file:`ipcontroller-client.json` found in :file:`IPYTHON_DIR/profile_default/security`) is
+:file:`ipcontroller-client.json` found in :file:`IPYTHONDIR/profile_default/security`) is
accurate. If the controller was started on a remote machine, you must copy that connection
file to the client machine, or enter its contents as arguments to the Client constructor:
@@ -15,4 +15,9 @@ Other new features
* **%install_ext**: A new magic function to install an IPython extension from
a URL. E.g. ``%install_ext https://bitbucket.org/birkenfeld/ipython-physics/raw/d1310a2ab15d/physics.py``.
+* The :envvar:`IPYTHON_DIR` environment variable, introduced in the Great
+ Reorganization of 0.11 and existing only in versions 0.11-0.13, has been
+ deprecated. As described in :ghissue:`1167`, the complexity and confusion of
+ migrating to this variable is not worth the aesthetic improvement. Please use
+ the historical :envvar:`IPYTHONDIR` environment variable instead.

0 comments on commit dbeeefd

Please sign in to comment.