Opened 13 years ago

Closed 12 years ago

#17078 closed Cleanup/optimization (fixed)

IPython 0.11 configuration not loaded

Reported by: matveym Owned by: Aymeric Augustin
Component: Core (Management commands) Version: 1.4
Severity: Normal Keywords:
Cc: paulegan@…, bmihelac@… Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

In IPython profile colors='Linux', in django shell colors='LightBG'.

See path for the fix.

Attachments (2)

shell_py.diff (695 bytes ) - added by matveym 13 years ago.
17078.patch (657 bytes ) - added by Aymeric Augustin 13 years ago.

Download all attachments as: .zip

Change History (15)

by matveym, 13 years ago

Attachment: shell_py.diff added

comment:1 by nbr, 13 years ago

The patch seems to help, for me at least. (Python 2.6.1, Django 1.3.1, IPython 0.11, osx.)

comment:2 by Aymeric Augustin, 13 years ago

Triage Stage: UnreviewedAccepted
Type: BugCleanup/optimization

Considering:

I think we should simply call embed, as demonstrated in attached patch.

Could someone who's familiar with IPython confirm?

by Aymeric Augustin, 13 years ago

Attachment: 17078.patch added

comment:3 by Aymeric Augustin, 13 years ago

The last comment on #16483 suggests that IPython.embed has some issues, but it links to a ticket that doesn't mention embed.

Given the number of options that exist to embed an IPython shell, and that each technique appears to have advantages and drawbacks, I'm now leaning towards using the simplest API -- ie. IPython.embed -- and let the IPython developers sort out their bugs if there are any.

comment:4 by Chris Beaven, 13 years ago

The ticket has been resolved, and in the resolution embed is mentioned.
So this is fixed in 0.12 (which has been released), but if we change it like this we're breaking it for people who still have 0.11. Is this acceptable?

comment:5 by Aymeric Augustin, 13 years ago

Yes, I think that's acceptable.

IPython is only useful in a development environment, where people can get any version they need, and even isolate it with virtualenv if necessary.

comment:6 by Jacob, 13 years ago

Resolution: fixed
Status: newclosed

In [17379]:

Fixed #17078: properly invoke IPython 0.12.

comment:7 by Jacob, 13 years ago

In [17380]:

[1.3.X] Fixed #17078: properly invoke IPython 0.12.

Backport of r17379.

comment:8 by Paul Egan, 13 years ago

Cc: paulegan@… added

Sorry for commenting on a closed ticket but I thought it worth pointing out that using embed has additional affects.

The default config (e.g. created with ipython profile create) uses settings such as c.TerminalInteractiveShell.colors but these do not apply to an embedded shell. You need to use InteractiveShellEmbed or InteractiveShell configuration settings to change the appearance of a django shell started with embed.

Also using embed like this mean that there's no hook to load extensions or specify other app settings like exec_lines or exec_files (configured with InteractiveShellApp).

Instead of using embed, it might be better to use a similar pattern as used for the ipython command itself:

from IPython.frontend.terminal.ipapp import TerminalIPythonApp
app = TerminalIPythonApp.instance()
app.initialize(argv=[])
app.start()

comment:9 by Aymeric Augustin, 12 years ago

Resolution: fixed
Status: closedreopened
Version: 1.31.4

An IPyhton dev chimed in with a similar pull request: https://github.com/django/django/pull/512

The previous resolution wasn't optimal, I think it's worth revisiting this.

comment:10 by Aymeric Augustin, 12 years ago

Owner: changed from nobody to Aymeric Augustin
Status: reopenednew

comment:11 by Ramiro Morales, 12 years ago

#18204 was closed as duplicate.

comment:12 by bmihelac, 12 years ago

Cc: bmihelac@… added

comment:13 by Ramiro Morales <cramm0@…>, 12 years ago

Resolution: fixed
Status: newclosed

In 3570ff734e93f493e023b912c9a97101f605f7f5:

Fixed #17078 -- Made shell use std IPython startup.

This allows for a behavior more in line with what is expected by Ipython
users, e.g. the user namespace is initialized from config files, startup
files.

Thanks Benjamin Ragan-Kelley from the IPython dev team for the patch.

Note: See TracTickets for help on using tickets.
Back to Top