Python 3.3 in emacs (ropemacs support)

微笑、不失礼 提交于 2019-12-09 12:04:41

问题


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).


回答1:


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!




回答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.



来源:https://stackoverflow.com/questions/14846048/python-3-3-in-emacs-ropemacs-support

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!