Command line options to not override profile options #849

Closed
asmeurer opened this Issue Oct 9, 2011 · 0 comments

Comments

Projects
None yet
2 participants
Contributor

asmeurer commented Oct 9, 2011

See http://mail.scipy.org/pipermail/ipython-user/2011-October/008549.html. I don't have a full understanding of the issue, so I hope that nothing I say here is wrong. If I run ipython --colors=NoColor, it doesn't work, because I have c.TerminalInteractiveShell.colors ='Linux' set in my profile (see https://github.com/asmeurer/dotfiles/blob/master/.ipython/profile_default/ipython_config.py). To quote Min from the IPython mailing list

Yes - this is a silly thing that we need to figure out. The 'colors' cl_arg sets InteractiveShell.colors.  You have set TerminalInteractiveShell.colors, which is a subclass, and thus takes precedence.  So when you have colors set in your config, and *also* at the command-line, you will be starting up IPython with config:

c.InteractiveShell.colors = 'NoColor'
c.TerminalInteractiveShell.colors = 'Linux'

Now, if you change your config file to specify InteractiveShell.colors instead of TerminalInteractiveShell.colors, the cl-arg will properly override.

What we should really do is adjust the cl-arg system, such that it maps somehow to all subclasses, or possibly just the lowest active subclass, so it always gets highest priority.

@minrk minrk added a commit to minrk/ipython that referenced this issue Oct 10, 2011

@minrk minrk promote aliases and flags, to ensure they have priority over config f…
…iles

add Application.flatten_flags() method, which adjusts the alias
and flag dicts, such that they point to the subclass in the Application.classes list when passed to the argv parser.

This prevents TerminalInteractiveShell.colors in a config file overriding
`--colors` on the command-line, which points to InteractiveShell.colors.

Flattening is only done when the answer is unambiguous, so multiply inherited classes (e.g. Launchers in ipcluster) are not touched.

also remove now-obsolete manual workaround for this in IPClusterStart

closes gh-849
d7a1059

minrk closed this in d2ab692 Oct 13, 2011

@mattvonrocketstein mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014

@minrk @fperez minrk + fperez promote aliases and flags, to ensure they have priority over config f…
…iles

add Application.flatten_flags() method, which adjusts the alias
and flag dicts, such that they point to the subclass in the Application.classes list when passed to the argv parser.

This prevents TerminalInteractiveShell.colors in a config file overriding
`--colors` on the command-line, which points to InteractiveShell.colors.

Flattening is only done when the answer is unambiguous, so multiply inherited classes (e.g. Launchers in ipcluster) are not touched.

also remove now-obsolete manual workaround for this in IPClusterStart

closes gh-849
a21853b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment