Opened 5 years ago

Closed 4 years ago

#17078 closed Cleanup/optimization (fixed)

IPython 0.11 configuration not loaded

Reported by: matveym Owned by: aaugustin
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


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 aaugustin 5 years ago.

Download all attachments as: .zip

Change History (15)

Changed 5 years ago by matveym

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 aaugustin

  • Triage Stage changed from Unreviewed to Accepted
  • Type changed from Bug to Cleanup/optimization


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 aaugustin

comment:3 Changed 5 years ago by aaugustin

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 SmileyChris

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 aaugustin

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 set to fixed
  • Status changed from new to closed

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 paulegan

  • 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()

comment:9 Changed 4 years ago by aaugustin

  • Resolution fixed deleted
  • Status changed from closed to reopened
  • Version changed from 1.3 to 1.4

An IPyhton dev chimed in with a similar pull request:

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

comment:10 Changed 4 years ago by aaugustin

  • Owner changed from nobody to aaugustin
  • Status changed from reopened to new

comment:11 Changed 4 years ago by ramiro

#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 set to fixed
  • Status changed from new to closed

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

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

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