pylint #5697 PYTHONPATH configurable in pylintrc [open]
Maarten wrote, Today I have written a custom checker for pylint. I can successfully run it with a command line like this: PYTHONPATH=/path/to/plugin pylint --load-plugins=custom_checker -rn module.py However, I want to keep the command line short for easy interactive use. To do that, I moved the load-plugins part to pylintrc. However, I couldn't find anywhere in pylintrc to put the PYTHONPATH part. Right now I solved this by using a shell alias, but I would prefer to put this in pylintrc. Is that possible with the current pylint? Is it reasonable to expect it to be configurable in pylintrc or would another approach be better? | |
priority | normal |
---|---|
type | enhancement |
done in | <not specified> |
load | 0.200 |
load left | 0.200 |
closed by | <not specified> |
similar entities
Comments
-
2008/08/06 08:34
-
2008/08/06 08:36, written by sthenault
-
2008/08/06 08:48
-
2008/08/06 09:03
-
2011/11/15 13:01, written by anon
-
2012/01/19 15:29, written by sthenault
add commentWhy not let --load-plugins accept a full path to the plugin or a python module name (which then should be in the PYTHONPATH) as we do for the module/file we want to check?
because that doesn't solve the PYTHONPATH problem ?
I think using imp.find_module(os.path.basename(fullpath), os.path.dirname(path)) and imp.load_module() should do the trick, without any sys.path manipulation.
However, the checker would have to be self-contained, or at least should only depend on imports that can be resolved in sys.path. It seems reasonable to me.
Actually, for pure python modules, imp.load_source(modulename, path) is the easy way of doing the job.
Thanks for the answers, I would be searching for the exact same thing, but cannot really understand where I should put the imp.load_source thing :s
Should I create a higher level python file that would call pylint ?
Thx
sounds like when loading plugins we should attempt to use load_source if plugin is specified as a filename rather than a module name