Search code examples
pythonpylintgeany

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?


Solution

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