5

I have a Python application that is not under a GPL-compatible license.

I would like to add style checking to my automatic test suite, and I would like to use pylint instead of pep8 because it provides more options.

However, I realize that pylint is GPL licensed. More specifically, it's GPLv2:

https://github.com/PyCQA/pylint/blob/master/LICENSE

I wonder, if pylint is only used by the testing suite i.e. whatever that's under ./test, but can never be invoked from my main program, is it still counted as OK?

Or is the best I can do to ditch pylint and use pep8 instead which has Apache license?

6

You can definitely use Pylint to check a program under any license. However, integrating Pylint into a test suite might require a bit of care.

Pylint is a program that reads some files, analyzes the files, and prints out various warnings. Those files happen to be another program, but there isn't really any connection between Pylint and the program being checked. In particular, they are not combined into a single creative work. Thus, there are no copyright concerns and consequently the GPL license does not matter.

In a test suite this might be a bit different. If we have a test that combines the program being checked with Pylint (e.g. by using Pylint not as an application but as a library), it might be that this test can only be distributed under the GPL, and that the program being checked would require a GPL-compatible license.

For the avoidance of doubt, I'd therefore suggest to not use Pylint as a library, but to keep it as a clearly separate program. Instead of import pylint this distinction can be maintained more clearly e.g. with subprocess.run(['pylint', ...]). Personally, I also find it a bit unusual to integrate a linter directly into a test suite, and would rather have a shell script that manages various quality assurance tasks (including linting and unit tests).

Note that Pylint and pep8 aren't really comparable. Whereas pep8 mostly just checks some basic formatting issues, Pylint also supports rich semantic checks.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.