Opened 5 years ago

Closed 4 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 5 years ago.
17078.patch (657 bytes) - added by Aymeric Augustin 5 years ago.

Download all attachments as: .zip

Change History (15)

Changed 5 years ago by matveym

Attachment: shell_py.diff added

comment:1 Changed 5 years ago by nbr

Needs documentation: unset
Needs tests: unset
Patch needs improvement: unset

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

comment:2 Changed 5 years ago by Aymeric Augustin

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?

Changed 5 years ago by Aymeric Augustin

Attachment: 17078.patch added

comment:3 Changed 5 years ago by Aymeric Augustin

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 Changed 5 years ago by Chris Beaven

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 Changed 5 years ago by Aymeric Augustin

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 Changed 5 years ago by Jacob

Resolution: fixed
Status: newclosed

In [17379]:

Fixed #17078: properly invoke IPython 0.12.

comment:7 Changed 5 years ago by Jacob

In [17380]:

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

Backport of r17379.

comment:8 Changed 5 years ago by Paul Egan

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 Changed 4 years ago by Aymeric Augustin

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 Changed 4 years ago by Aymeric Augustin

Owner: changed from nobody to Aymeric Augustin
Status: reopenednew

comment:11 Changed 4 years ago by Ramiro Morales

#18204 was closed as duplicate.

comment:12 Changed 4 years ago by bmihelac

Cc: bmihelac@… added

comment:13 Changed 4 years ago by Ramiro Morales <cramm0@…>

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