Cython support in PyCharm 2.0 EAP

Cython is a language that allows you to write C extensions for the Python language using the familiar Python syntax. You can use Cython for creating extensions that can be 50-100 times faster than pure-Python modules. Also Cython allows you to integrate your Python code with C libraries more smoothly than the standard ctypes library or generated C bindings.

We are currently working on Cython support in PyCharm. Here is an overview of what’s already available in the EAP builds.

First of all, you get Cython syntax highlighting and error checking:

Next, there is context-sensitive code completion for Cython keywords, fields of structs, and attributes of extension types:

We will continue working on code completion for other elements, such as type names.

You can go to definitions and find usages of Cython cdef variables, functions, structs, and extension types. This is especially useful if you take into account various ways of importing Cython files, such as include statements and implicit imports of Cython definition files:

We have also adapted some Python inspections and refactorings for Cython. For example, PyCharm will highlight unresolved references in your Cython code:

There are various ways of compiling Cython modules: with Cython functions for distutils, Makefiles that directly call the cython compiler, etc. In PyCharm you can set up any external tool for compiling your Cython code from the IDE:

You can also set up the go to error line functionality via output filters for external tools:

Cython support in PyCharm is still work in progress. More Cython-related features and improvements will be available in PyCharm 2.0 EAP builds in the coming weeks.

This entry was posted in Cool Feature. Bookmark the permalink.

3 Responses to Cython support in PyCharm 2.0 EAP

  1. Yury V. Zaytsev says:

    Very cool! Cross-posted to cython-users@. Can’t wait until release!

  2. Rob W says:

    2.0 is coming along nice, well done!

    Obviously things are not finished until they’re finished, but what is the hopeful release date for a final 2.0 ? By end-of-year?

Leave a Reply

Your email address will not be published. Required fields are marked *