nixpkgs mirror (for testing)
github.com/NixOS/nixpkgs
nix
1{
2 lib,
3 stdenv,
4 astroid,
5 buildPythonPackage,
6 dill,
7 fetchFromGitHub,
8 gitpython,
9 isort,
10 mccabe,
11 platformdirs,
12 py,
13 pytest-timeout,
14 pytest-xdist,
15 pytest7CheckHook,
16 pythonAtLeast,
17 pythonOlder,
18 requests,
19 setuptools,
20 tomli,
21 tomlkit,
22 typing-extensions,
23 writableTmpDirAsHomeHook,
24}:
25
26buildPythonPackage (finalAttrs: {
27 pname = "pylint";
28 version = "4.0.4";
29 pyproject = true;
30
31 src = fetchFromGitHub {
32 owner = "pylint-dev";
33 repo = "pylint";
34 tag = "v${finalAttrs.version}";
35 hash = "sha256-mKI/sRYl2ZwZ3JklmqBTs7vRG9EA4zDHaW61d/Xozb4=";
36 };
37
38 build-system = [ setuptools ];
39
40 dependencies = [
41 astroid
42 dill
43 isort
44 mccabe
45 platformdirs
46 tomlkit
47 ]
48 ++ lib.optionals (pythonOlder "3.11") [ tomli ];
49
50 nativeCheckInputs = [
51 gitpython
52 # https://github.com/PyCQA/pylint/blob/main/requirements_test_min.txt
53 py
54 pytest-timeout
55 pytest-xdist
56 pytest7CheckHook
57 requests
58 typing-extensions
59 writableTmpDirAsHomeHook
60 ];
61
62 pytestFlags = [
63 # DeprecationWarning: pyreverse will drop support for resolving and
64 # displaying implemented interfaces in pylint 3.0. The
65 # implementation relies on the '__implements__' attribute proposed
66 # in PEP 245, which was rejected in 2006.
67 "-Wignore::DeprecationWarning"
68 "-v"
69 ];
70
71 disabledTestPaths = [
72 "tests/benchmark"
73 # tests miss multiple input files
74 # FileNotFoundError: [Errno 2] No such file or directory
75 "tests/pyreverse/test_writer.py"
76 ];
77
78 disabledTests = [
79 # AssertionError when self executing and checking output
80 # expected output looks like it should match though
81 "test_invocation_of_pylint_config"
82 "test_generate_rcfile"
83 "test_generate_toml_config"
84 "test_help_msg"
85 "test_output_of_callback_options"
86 # Failed: DID NOT WARN. No warnings of type (<class 'UserWarning'>,) were emitted. The list of emitted warnings is: [].
87 "test_save_and_load_not_a_linter_stats"
88 # Truncated string expectation mismatch
89 "test_truncated_compare"
90 # Probably related to pytest versions, see pylint-dev/pylint#9477 and pylint-dev/pylint#9483
91 "test_functional"
92 # AssertionError: assert [('specializa..., 'Ancestor')] == [('aggregatio..., 'Ancestor')]
93 "test_functional_relation_extraction"
94 ]
95 ++ lib.optionals (pythonAtLeast "3.14") [
96 # ModuleNotFoundError: No module named 'completely_unknown'
97 "test_do_not_import_files_from_local_directory"
98 ]
99 ++ lib.optionals stdenv.hostPlatform.isDarwin [
100 "test_parallel_execution"
101 "test_py3k_jobs_option"
102 ];
103
104 meta = {
105 description = "Bug and style checker for Python";
106 homepage = "https://pylint.readthedocs.io/en/stable/";
107 changelog = "https://github.com/pylint-dev/pylint/releases/tag/${finalAttrs.src.tag}";
108 longDescription = ''
109 Pylint is a Python static code analysis tool which looks for programming errors,
110 helps enforcing a coding standard, sniffs for code smells and offers simple
111 refactoring suggestions.
112 Pylint is shipped with following additional commands:
113 - pyreverse: an UML diagram generator
114 - symilar: an independent similarities checker
115 - epylint: Emacs and Flymake compatible Pylint
116 '';
117 license = lib.licenses.gpl2Plus;
118 maintainers = [ ];
119 mainProgram = "pylint";
120 };
121})