howdoi icon indicating copy to clipboard operation
howdoi copied to clipboard

Pylint passes locally but fails in Github actions

Open gleitz opened this issue 4 years ago • 6 comments

What happened:

Check out https://github.com/gleitz/howdoi/pull/433/checks?check_run_id=3861232824

The pylint tests fail in Github actions but pass locally (with the same version of pylint).

Locally:

» python setup.py lint
running lint

Running Flake8...
No lint errors found by Flake8

Running Pylint...

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

No lint errors found by Pylint

» pylint --version
pylint 2.11.1
astroid 2.8.0
Python 3.9.7 (default, Sep 20 2021, 08:30:41)
[Clang 12.0.0 (clang-1200.0.32.29)]

gleitz avatar Oct 11 '21 16:10 gleitz

The pre-commit is configured to use pylint 2.8.2 which does not give error but pylint 2.11.1 gives the error. You can try it by running pylint howdoi --rcfile=.pylintrc.

Can you check the output of which pylint to see if it from your virtual environment or the global one?

Prateek93a avatar Oct 16 '21 08:10 Prateek93a

I think we should do three things:

  • Unify the version of Pylint (2.11.1) (in requirements/dev.txt)
  • Make sure that all pylint command use pylint howdoi *.py --rcfile=.pylintrc (in setup.py and .pre-commit-config.yaml and .github/workflows/python-non-master.yml and .github/workflows/python.yml)
  • Pin the version of pylint used by the github action (.github/workflows/python-non-master.yml and .github/workflows/python.yml)

@V2dha

gleitz avatar Oct 18 '21 16:10 gleitz

These are import errors given by Pylint (2.11.1) upon running pylint howdoi *.py --rcfile=.pylintrc

1

and upon running python3 setup.py lint it only checks the howdoi directory

2

Development Environment

3

V2dha avatar Oct 18 '21 16:10 V2dha

It's strange that it's mostly import errors - it's almost as if Pylint is not using the virtual environment or something like that.

gleitz avatar Oct 18 '21 16:10 gleitz

It's strange that it's mostly import errors - it's almost as if Pylint is not using the virtual environment or something like that.

Upon checking which pylint in the development environment, it is not considering the virtual environment on my system.

V2dha avatar Oct 22 '21 17:10 V2dha

Two options here - we can uninstall pylint globally or use the virtual environment's python to run pylint.

Let's try the latter first.

For me, I can find my local python with which python

» which python
/Users/gleitz/.virtualenvs/howdoi/bin/python

Then I can run pylint using this local version of python

» python -m pylint howdoi *.py --rcfile=.pylintrc

--------------------------------------------------------------------
Your code has been rated at 10.00/10 (previous run: 10.00/10, +0.00)

This should avoid the import-errors.

gleitz avatar Oct 22 '21 18:10 gleitz