Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I integrate Pylint with Geany so that I can use Geany as a python IDE?

http://michaeljaylissner.com/blog/using-pylint-in-geany#comments

This blog says to set build command as

 pylint -r no "%f" 

and set a custom error regex

(W|E|F):([0-9]+):(.*)

The commenter suggests that with command

PYTHONPATH=${PYTHONPATH}:$(dirname %d) pylint --output-format=parseable --reports=n "%f"

that it is possible to click on a line number in log and be brought there by geany. I tried this and it has not worked for me.

In my project file, I have added

[build_settings]
error_regex=^(W|E|F):([0-9]+):(.*)

After reloading the file, same result. Am I setting the error_regex correctly? Why doesnt this work?

like image 972
HaltingState Avatar asked Jan 20 '23 15:01

HaltingState


2 Answers

I'm the commenter on the blog post you cite.

I'm using a Debian-based system at the moment (Linux Mint Debian, to be precise), and using Geany 0.20. What I have is a file named filetypes.python in ~/.config/geany/filedefs which contains this:

[build-menu]
FT_00_LB=pep8
FT_00_CM=pep8 --repeat --count "%f"
FT_00_WD=
FT_01_LB=PyLint (basic)
FT_01_CM=PYTHONPATH=${PYTHONPATH}:"%d" pylint --output-format=parseable --reports=n --errors-only "%f"
FT_01_WD=
FT_02_LB=PyLint (full)
FT_02_CM=PYTHONPATH=${PYTHONPATH}:"%d" pylint --output-format=parseable "%f"
FT_02_WD=
error_regex=^([^:]+?):([0-9]+):.+

Note that the key difference between my setup and the blog post is that i'm using --output-format=pareseable, and my error_regex is a little less pylint-specific, so that it will work for pep8 too.

The PYTHONPATH=${PYTHONPATH}:"%d" bit is to add the current working directory to my custom python path, and I guess, off the top of my head, it won't work like that on Windows, so if you're on Windows you'll certainly need to modify (or drop) that bit. In fact, if you're on Windows, please indicate that, as there might be a few bits that need changing.

like image 123
simon Avatar answered Feb 06 '23 17:02

simon


I have written a plugin which checks your code with pep8 pylint and pyflakes the code is available on launchpad and is packaged for ubuntu in a ppa.

https://code.launchpad.net/~oly/geany-python-code-checker/trunk

https://launchpad.net/~oly/+archive/geany

maybe useful for some one, you can toggle some options on and off as well like checking of line length.

like image 20
Oly Avatar answered Feb 06 '23 17:02

Oly