Python 3.3 in emacs (ropemacs support)
Asked Answered
E

2

7

I am running arch linux and scripting in python 3.3 I want IDE like features (auto complete, syntax checker etc). I've installed rope, rope-mode and pymacs. Does ropemacs support python 3.x?

If not, suggest alternate ways (I'm ready to consider vim if I get above mentioned features).

Earlearla answered 13/2, 2013 at 3:43 Comment(2)
there's also elpy.el which tries to wrap up all these things for you, but i'm having trouble with it myself. it works pretty great, except the latest version keeps trying to add a snippets dir for my project that doesn't existReynold
Upgrading scripts (even emacs) is sometimes terrible process.Earlearla
L
6

The original rope library does indeed support Py3k according to its webpage

You

pip install rope_py3k

or download it from PyPi. Currently (Jan '16), the github project page has newer versions than PyPi.

Then you install Pymacs, from its website. The code seems to be hosted on github, too.

Finally,

pip install ropemacs

or download again from PyPi or github.

Particularly, Python 3.3 got released on 29-Sep-2012 after the last commit to the rope_py3k sourcecode which happened on the 25-Jun-2012 (as of 2014).

So the major new features of Python 3.3 (compared to Python 3.2) which are (based on my personal preference) can not be supported explicitly:

  • yield from to easier delegate/forward values from one generator
  • Allow u'unicode' syntax again (existed in >=Py2.7 and
  • Exception hierarchy for IOErrors, based on class OSError
  • time.perf_counter() et al. to time durations with high subsecond precision
  • New in stdlib:
    • ipaddress,
    • lxma (compression),
    • unittest.mock,
    • venv (integrates PyPi's virtualenv)

(For a full list check the Python 3.3 release note)

So, while autocompletion for the new stdlib modules, the new functions, the new exception classes might not work, the biggest stumbling block might be the syntax addition to the yield statement.

But I would suspect that rope (or any auto-completion IDE for that matter) introspects any imported module to check which functions/methods/variables are available for autocompletion. So all of the above might (and arguably should) work.

I'd certainly give it a try. Not having the yield from detected might not be an issue at all. I'm not a user of rope myself, but got interested due to your question.

Good luck!

Leeward answered 20/2, 2013 at 15:30 Comment(4)
Yes rope is py3k compliant, but neither Pymacs nor ropemacs are py3k compliants. You need to edit pymacs.el to comment lines 508 and 509 where pymacs use the str.decode() method that does not exist anymore in py3. ropemacs is not py3k compliant. Don't ask me if that works under Windows...Pes
Pymacs is now py3k compliants (just use PYTHON=python3 as you make install), the problem is that ropemacs and ropemode are notAmorete
Do you know if there are plans for ropemacs support for python 3.4 and 3.5?Repose
I don't know, but rope moved from SF to github, and pymacs & ropemacs are on github, too. So I've changed/added the links.Leeward
A
2

I have been using PyCharm community edition for years, but just today I installed elpy (which I believe is a superset of rope, jedi, and flymake) and I am very pleased. I am not sure if elpy is using rope, rope_py3k, jedi, or something else, but the refactoring support is great :D

Like most, I was unable to sudo pip install rope due to the default python using Python 3 (I am using ArchLinux as well), but I ran sudo pip install rope_py3k just fine. Refactoring, syntax highlighting, auto-complete, and jumping to definitions is working very well.

Here are the install instructions and the documentation. It seems well supported. I am happy to report back and see if I can get off PyCharm and only use elpy in the future.

Whenever I have a problem with elpy, I usually just run M-x elpy-config and it shows me what is broken. I also run M-x elpy-rpc-restart just to be sure.

Update

It's been ~2 months and Emacs with elpy is still going great. I haven't had to touch PyCharm, and may never have to again! I think the only updates I made were a few tweaks in M-x customize-group RET elpy. I think there was also an Arch python3 update where I needed to re-install rope_py3k, but it was pretty easy.

Also, just to clarify, I also installed rope in my base install and virtualenvs. Python 3 is the default in Arch, but I have some virtualenvs in 2.7, so I needed to run pip install rope in my virtualenvs and pip install rope_py3k in the base install.

Amelina answered 14/8, 2015 at 19:17 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.