Hi,
My company is using python embedded into an application.
Is it possible to use pylint in unit tests, like the following:
from pylint import epylint as lint
lint.py_run('../lib/lib.py --rcfile=../pylint.rc')
I have tried that one, but I get a strange error:
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/pylint/lint/__init__.py",
line 76, in <module>
from pylint.lint.parallel import check_parallel
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/pylint/lint/parallel.py",
line 8, in <module>
from pylint import reporters
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/pylint/reporters/__init__.py",
line 27, in <module>
from pylint import utils
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/pylint/utils/__init__.py",
line 47, in <module>
from pylint.utils.ast_walker import ASTWalker
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/pylint/utils/ast_walker.py",
line 7, in <module>
from astroid import nodes
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/astroid/__init__.py",
line 51, in <module>
from astroid.nodes import node_classes, scoped_nodes
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/astroid/nodes/__init__.py",
line 27, in <module>
from astroid.nodes.node_classes import ( # pylint:
disable=redefined-builtin (Ellipsis)
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/astroid/nodes/node_classes.py",
line 47, in <module>
from astroid import decorators, mixins, util
File "/home/b/development/euryale-module-py/build.debug/py/py_lib/site-packages/astroid/decorators.py",
line 36, in <module>
from typing import ParamSpec
ImportError: cannot import name 'ParamSpec' from 'typing'
(/home/b/development/euryale-module-py/build.debug/py/py_lib/typing.py)
After digging a bit, I think that somehow pylint is trying to use
*python* executable (from PATH), because my host python is 3.10,
while the embedded python is 3.9 and there is no python executable at all.
My question is: is there a pylint API to let it check sources with the
current python, without doing system/exec etc., which are not
available in my case?
WBR, basiliscos.