Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to enable PyCharm Type Checker feature for cython(.pyx) file?

It seems python type checker in PyCharm automatically works for .py files.. but not for .pyx files.

Is there any way to enable type checker for .pyx files in PyCharm?

Also, is there any way to use mypy with cython files (.pyx files)?

like image 490
sdf3w Avatar asked Feb 19 '18 04:02

sdf3w


People also ask

How do I change the file type in PyCharm?

Press Ctrl+Alt+S to open the IDE settings and select Editor | File Types. Click Associate File Types with PyCharm and select the file extensions you want to open with the IDE. Click OK and close the dialog.

What is a PYX file Python?

A PYX file is a source code written in the Python-like language Pyrex. It may contain code that references existing C modules. Pyrex is a programming language that is used for creating Python modules PYD and is based on C-like syntax.


1 Answers

The .pyx file is regarded as a text file by default in Pycharm. However, you can change the setting. Go to File->Settings->Editor->File Types. In recognized file types, find "Text", delete the entry ".pyx" in the registered patterns. Then, find "Python" in the recognized file types, add an entry ".pyx" in the registered patterns.

like image 138
Chengyu Wang Avatar answered Oct 15 '22 13:10

Chengyu Wang