Live data from Hacker News

Emacs setup for Python development

caisah.info

21–30 of 56 posts

Re: Emacs setup for Python development

#21

The author seems to imply that sublime does not qualify as a "serious" editor, and offers a link to quora as explanation, but the article there doesn't address what Sublime is missing at all.

>doesn't address what Sublime is missing at all. Being a fully programmable work environment. Edit: I used ST2 for about a month. The Python was neat but it's going to fade away eventually.

What can't you do with ST2 if you write a plugin? Or is that just a relative pain compared to emacs & vim?

Re: Emacs setup for Python development

#22

That's a lot of junk that doesn't have a lot to do with Python. Take a look here at my dotfiles to see how to use Rope/Ropemode/Ropemacs to get a Python-aware Emacs environment with the goodies that entails: https://github.com/bitemyapp/dotfiles/ Edit: Try to ignore or not be daunted by the other directories, my Emacs setup is well maintained but very old and has over 400,000 LOC.

Yep, Rope in emacs is the way to go. I remember having trouble getting Pymacs set up the first time around, but if you are working on an actual python project (not just some loosely couple source files) I have not found a better environment anywhere.

Re: Emacs setup for Python development

#23
post #17

I have a similar emacs setup with cedet, autocomplete, and whatnot, but I have one problem -- things like "evaluate this buffer" don't work when your python environment is on a remote server (due to work constraints I am obliged to do this). Files open fine over tramp, but a lot of things (python-mode, jedi, etc.) don't understand that they are interacting with a remote python shell. Is there any easy way that someon…

If you have a remote file open with Tramp, you can also get a shell open there with M-x shell. Try doing that, running python in that shell and renaming the shell buffer to Python . It might work :P. If that doesn't work, you might have to find the variable which specifies which buffer has the current running Python process. You should then be able to just change that to a remote shell as above. You can also automate…

Nice trick to hoodwink emacs :) It didn't work though.

I understand what you're saying in the rest of your comment though -- basically I will have to learn some elisp. Thanks for the help.

Re: Emacs setup for Python development

#24
post #19

I have a similar emacs setup with cedet, autocomplete, and whatnot, but I have one problem -- things like "evaluate this buffer" don't work when your python environment is on a remote server (due to work constraints I am obliged to do this). Files open fine over tramp, but a lot of things (python-mode, jedi, etc.) don't understand that they are interacting with a remote python shell. Is there any easy way that someon…

The way I get around that is running emacs on the remote server in screen/tmux. If there's a better way I'd love to know it, but I haven't found it to be too much of a problem.

Well, you can put emacs into server mode and then connect with emacsclient, provided you tunnel X. I got this working once but I didn't like using the X Windows version emacs over the native desktop version. Sorry I don't remember the details, but I don't recall it being tricky.

My goal was to connect a local emacsclient to a remote emacs server over TCP... if this were possible, I would be fairly ecstatic.

Re: Emacs setup for Python development

#26
post #19

Earlier quoted context omitted.

The way I get around that is running emacs on the remote server in screen/tmux. If there's a better way I'd love to know it, but I haven't found it to be too much of a problem.

I have tried this, and it works fine... almost :) The only problem I have is that doesn't give you some of the GUI goodness. For example, I find CEDET's code folding incredibly useful when I want to get a bird's eye view of my modules, and the CLI version doesn't seem to support drawing the expandoes. Thanks for the tip though.

True, but "emacs in screen/tmux" has a few other advantages for me - namely that I can leave all my buffers open when I leave the office and easily pick up from home. It's also more pleasant over a slow vpn connection.

Re: Emacs setup for Python development

#27

Can someone link a vim setup for python, for comparison puposes, perhaps with a short feature comparison? I'm currently a vim user with a fairly basic setup (I tried st 2 but couldn't figure it out for managing my work flow) , but I find the idea of emacs attractive.

You could run emacs with evil[1]. It's got a lot of the familiar keystrokes and modes. I would install it using el-get.

[1] http://emacswiki.org/emacs/Evil

Re: Emacs setup for Python development

#28
post #11
post #10

The Emacs tutorial is a great place to start. Using Emacs is a bit of a paradigm shift in text editing, so you should expect a bit more work up front for great results later on. Going through the tutorial and learning the basic vocabulary and commands takes care of most of that up-front cost and should not take long. I think it took me less than two weeks of fairly casual use. Part of the beauty is that most of the t…

>> For some languages, Emacs is even the only option Which ones would those be? Common Lisp using SLIME?

Erlang. Even though some IDE's are starting to support it now. Erlang is the original reason I got into using Emacs actually.

Re: Emacs setup for Python development

#29

Can someone link a vim setup for python, for comparison puposes, perhaps with a short feature comparison? I'm currently a vim user with a fairly basic setup (I tried st 2 but couldn't figure it out for managing my work flow) , but I find the idea of emacs attractive.

My vimrc is at https://github.com/Julian/dotfiles/blob/master/.vimrc but it isn't really divided up into Python specific stuff.

(It's also a bit in flux as I migrate to tpope/vim-dispatch)

I can try elaborating feature-wise when I get home.

Re: Emacs setup for Python development

#30

On a related note, emacs support for ipython notebook with ein ( http://tkf.github.io/emacs-ipython-notebook/ ) is marvelous. If you are comfortable with emacs, ein is far superior for interacting with your ipython notebook compared to the browser experience.

Seriously. I spend a large fraction of my day in ein. Great for exploratory data analysis.
Post reply on HN