Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #44317 > unrolled thread

IPython in Emacs

Started bySeb <spluque@gmail.com>
First post2013-04-24 22:35 -0500
Last post2013-04-25 21:06 -0700
Articles 6 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  IPython in Emacs Seb <spluque@gmail.com> - 2013-04-24 22:35 -0500
    Re: IPython in Emacs rusi <rustompmody@gmail.com> - 2013-04-24 21:38 -0700
      Re: IPython in Emacs Seb <spluque@gmail.com> - 2013-04-25 08:01 -0500
        Re: IPython in Emacs rusi <rustompmody@gmail.com> - 2013-04-25 06:54 -0700
          Re: IPython in Emacs Seb <spluque@gmail.com> - 2013-04-25 17:18 -0500
            Re: IPython in Emacs rusi <rustompmody@gmail.com> - 2013-04-25 21:06 -0700

#44317 — IPython in Emacs

FromSeb <spluque@gmail.com>
Date2013-04-24 22:35 -0500
SubjectIPython in Emacs
Message-ID<mailman.1050.1366862111.3114.python-list@python.org>
Hi,

Please excuse the slightly off-topic query.  I'm learning Python, using
the IPython (0.13) shell, and wanted to run it from Emacs 24.  AFAICT,
python.el is the most actively developed library, and is included in
Emacs.  How do experienced Python programmers set up their python.el to
make the best of it?  I've done it following the recommendations given
in the library¹:

(setq
 python-shell-interpreter "ipython"
 python-shell-interpreter-args ""
 python-shell-prompt-regexp "In \\[[0-9]+\\]: "
 python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
 python-shell-completion-setup-code
 "from IPython.core.completerlib import module_completion"
 python-shell-completion-module-string-code
 "';'.join(module_completion('''%s'''))\n"
 python-shell-completion-string-code
 "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")

but this may be a little outdated as it refers to IPython 0.11.

Thanks,
Seb

+--- Footnotes ---+
¹ Ignored recommended setting for `python-shell-interpreter-args'

[toc] | [next] | [standalone]


#44319

Fromrusi <rustompmody@gmail.com>
Date2013-04-24 21:38 -0700
Message-ID<774a9ef7-dadd-4769-998c-d24cceb1b6a0@j5g2000pby.googlegroups.com>
In reply to#44317
On Apr 25, 8:35 am, Seb <splu...@gmail.com> wrote:
> Hi,
>
> Please excuse the slightly off-topic query.  I'm learning Python, using
> the IPython (0.13) shell, and wanted to run it from Emacs 24.  AFAICT,
> python.el is the most actively developed library, and is included in
> Emacs.  How do experienced Python programmers set up their python.el to
> make the best of it?  I've done it following the recommendations given
> in the library¹:
>
> (setq
>  python-shell-interpreter "ipython"
>  python-shell-interpreter-args ""
>  python-shell-prompt-regexp "In \\[[0-9]+\\]: "
>  python-shell-prompt-output-regexp "Out\\[[0-9]+\\]: "
>  python-shell-completion-setup-code
>  "from IPython.core.completerlib import module_completion"
>  python-shell-completion-module-string-code
>  "';'.join(module_completion('''%s'''))\n"
>  python-shell-completion-string-code
>  "';'.join(get_ipython().Completer.all_completions('''%s'''))\n")
>
> but this may be a little outdated as it refers to IPython 0.11.
>
> Thanks,
> Seb
>
> +--- Footnotes ---+
> ¹ Ignored recommended setting for `python-shell-interpreter-args'

There were some ipython+emacs+windows bugs:
https://bugs.launchpad.net/ipython/+bug/290228

Last I tried nearly 2 years, they were still there
http://groups.google.com/group/comp.lang.python/browse_thread/thread/36e757567f28368e

[Since you did not say whether you are on windows or *nix, just saying]

[toc] | [prev] | [next] | [standalone]


#44336

FromSeb <spluque@gmail.com>
Date2013-04-25 08:01 -0500
Message-ID<mailman.1058.1366894911.3114.python-list@python.org>
In reply to#44319
On Wed, 24 Apr 2013 21:38:04 -0700 (PDT),
rusi <rustompmody@gmail.com> wrote:

> There were some ipython+emacs+windows bugs:
> https://bugs.launchpad.net/ipython/+bug/290228

> Last I tried nearly 2 years, they were still there
> http://groups.google.com/group/comp.lang.python/browse_thread/thread/36e757567f28368e

On Debian here, so not a problem.

Thanks,
-- 
Seb

[toc] | [prev] | [next] | [standalone]


#44340

Fromrusi <rustompmody@gmail.com>
Date2013-04-25 06:54 -0700
Message-ID<aceba0c4-7ad2-407b-80d9-6c58f03d823d@lr6g2000pbb.googlegroups.com>
In reply to#44336
On Apr 25, 6:01 pm, Seb <splu...@gmail.com> wrote:
> On Wed, 24 Apr 2013 21:38:04 -0700 (PDT),
>
> rusi <rustompm...@gmail.com> wrote:
> > There were some ipython+emacs+windows bugs:
> >https://bugs.launchpad.net/ipython/+bug/290228
> > Last I tried nearly 2 years, they were still there
> >http://groups.google.com/group/comp.lang.python/browse_thread/thread/...
>
> On Debian here, so not a problem.

Ok me too :-)

A quick try of your startup code did not work for me.
There is a perennial clash in emacs between python.el and python-
mode.el -- I guess its that.
Which do you use?

What are your commands for eval-buffer and start-interpreter?

[toc] | [prev] | [next] | [standalone]


#44369

FromSeb <spluque@gmail.com>
Date2013-04-25 17:18 -0500
Message-ID<mailman.1071.1366928336.3114.python-list@python.org>
In reply to#44340
On Thu, 25 Apr 2013 06:54:33 -0700 (PDT),
rusi <rustompmody@gmail.com> wrote:

> On Apr 25, 6:01 pm, Seb <splu...@gmail.com> wrote:
>> On Wed, 24 Apr 2013 21:38:04 -0700 (PDT),

>> rusi <rustompm...@gmail.com> wrote:
>> > There were some ipython+emacs+windows bugs:
>> >https://bugs.launchpad.net/ipython/+bug/290228 > Last I tried nearly
>> 2 years, they were still there
>> >http://groups.google.com/group/comp.lang.python/browse_thread/thread/...

>> On Debian here, so not a problem.

> Ok me too :-)

> A quick try of your startup code did not work for me.  There is a
> perennial clash in emacs between python.el and python- mode.el -- I
> guess its that.  Which do you use?

The first.  I don't have anything python-related in ~/.emacs other than
what I showed.  Works fine for me, except for weird things like multiple
input prompts in the IPython shell at startup, which seem to come from
each statement in the variables I showed.  Similar things happen when
sending code from the script buffer.


> What are your commands for eval-buffer and start-interpreter?

I don't understand what you're asking.  I evaluate the script buffer
with `python-shell-send-buffer' and start IPython with `run-python'.


-- 
Seb

[toc] | [prev] | [next] | [standalone]


#44382

Fromrusi <rustompmody@gmail.com>
Date2013-04-25 21:06 -0700
Message-ID<014b6c7b-b21b-466d-b807-78c2f33f3e0e@pa2g2000pbb.googlegroups.com>
In reply to#44369
On Apr 26, 3:18 am, Seb <splu...@gmail.com> wrote:
>
> I don't understand what you're asking.  I evaluate the script buffer
> with `python-shell-send-buffer' and start IPython with `run-python'.


There are two emacs python modes -- one which comes builtin with emacs
-- python.el, one which (used to?) come with python -- python-mode.el.

My impression is that most pythonistas preferred the python-mode
earlier. Not so sure now.
You can get it from https://launchpad.net/python-mode/

Heres a minimal setup for python-mode +ipython (everything's probably
not working)

(add-to-list 'load-path "~/.emacs.d/downloads/python-mode")  ;; Or
whatever is your path for python-mode.el
(autoload 'python-mode "python-mode" "Python Mode." t)
(add-to-list 'auto-mode-alist '("\\.py\\'" . python-mode))
(add-to-list 'interpreter-mode-alist '("python" . python-mode))

;; A first cut at replicating your settings of ipython for python-mode
(setq py-python-command "ipython"  ; python-shell-interpreter
      py-python-command-args '("")    ; python-shell-interpreter-args
					; Should it be -i?
      py-shell-input-prompt-1-regexp "In \\[[0-9]+\\]: "
      ; Other variables dont exist or cant find
      ; Not really explored ipython.el
)

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web