Opened 14 years ago
Closed 13 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)
Change History (15)
by , 14 years ago
| Attachment: | shell_py.diff added |
|---|
comment:1 by , 14 years ago
comment:2 by , 14 years ago
| Triage Stage: | Unreviewed → Accepted |
|---|---|
| Type: | Bug → Cleanup/optimization |
Considering:
- IPython's embedding docs,
- the fact that
embedbasically callsload_default_configand runs aTerminalInteractiveShell— see the source, - the discussions on #16483,
I think we should simply call embed, as demonstrated in attached patch.
Could someone who's familiar with IPython confirm?
by , 14 years ago
| Attachment: | 17078.patch added |
|---|
comment:3 by , 14 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 , 14 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 , 14 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:8 by , 14 years ago
| Cc: | 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 , 13 years ago
| Resolution: | fixed |
|---|---|
| Status: | closed → reopened |
| Version: | 1.3 → 1.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 , 13 years ago
| Owner: | changed from to |
|---|---|
| Status: | reopened → new |
comment:12 by , 13 years ago
| Cc: | added |
|---|
comment:13 by , 13 years ago
| Resolution: | → fixed |
|---|---|
| Status: | new → closed |
The patch seems to help, for me at least. (Python 2.6.1, Django 1.3.1, IPython 0.11, osx.)