Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Command line options to not override profile options #849

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

Command line options to not override profile options #849

asmeurer opened this issue Oct 9, 2011 · 0 comments
Milestone

Comments

@asmeurer
Copy link
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 added a commit to minrk/ipython that referenced this issue Oct 10, 2011
…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 ipythongh-849
@minrk minrk closed this as completed in d2ab692 Oct 13, 2011
mattvonrocketstein pushed a commit to mattvonrocketstein/ipython that referenced this issue Nov 3, 2014
…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 ipythongh-849
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants