Skip to contentSkip to conversation

perf build: default build fails in pylint (pylint 4, missing optional modules)

DISCUSSION Lalit Maganti 2 participants 3 messages Oct 18 – Nov 4

lore
Share & tools
lore
#0 lore raw

Hi Ian, Alice,

Since 5fe83fb352c8 ("perf build: Make pylint build test opt-out (NO_PYLINT=1)") the build runs pylint whenever it is installed, and a default build of perf-tools-next (1c90f0a3c8a1) now fails in pylint for me, on Fedora 44 with Python 3.14.8 and pylint 4.1.3. With make -k, four files fail:

pmu-events/jevents.py:1494:26: W4904: Using deprecated class FileType of module argparse (deprecated-class) pmu-events/jevents.py:1496:33: W4904: Using deprecated class FileType of module argparse (deprecated-class) tests/shell/lib/perf_json_output_lint.py:23:31: W4904: Using deprecated class FileType of module argparse (deprecated-class) python/treport.py:12:0: E0401: Unable to import 'rich.markup' (import-error)
python/treport.py:625:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init) python/ttimechart.py:33:0: E0401: Unable to import 'rich.segment' (import-error) python/ttimechart.py:1086:8: W0201: Attribute 'virtual_size' defined outside __init__ (attribute-defined-outside-init) (and a few more of the same kinds in treport.py and ttimechart.py)

There seem to be two separate things going on:

1. Python 3.14 marks argparse.FileType for deprecation (it raises a
PendingDeprecationWarning: "Simply open files after parsing arguments"), which pylint 4 reports as deprecated-class. That needs a code change in jevents.py and perf_json_output_lint.py.

2. The rest only happens because the optional textual and rich modules are not installed: the imports fail, and pylint then cannot see that textual's App and ScrollView define sub_title and virtual_size. With textual and rich installed, treport.py and ttimechart.py pass, but if that environment lacks setuptools, util/setup.py fails instead:

     util/setup.py:15:0: E0401: Unable to import 'setuptools' (import-error)

So whether the default build passes depends on which optional Python modules happen to be installed alongside pylint. Should import-error be disabled (or those modules be in ignored-modules) for the default build?

NO_PYLINT=1 works around both. For mypy 2.x, which fails on jevents.py in a similar way, I've sent a fix separately:
"perf pmu-events: Fix jevents.py type annotations for mypy 2.x".

Thanks,
Lalit

#1 lore raw

On Sun, Oct 18, 2026 at 08:01:10AM +0100, Lalit Maganti wrote:

[...]

Quoted 9 lines

Since 5fe83fb352c8 ("perf build: Make pylint build test opt-out (NO_PYLINT=1)") the build runs pylint whenever it is installed, and a default build of perf-tools-next (1c90f0a3c8a1) now fails in pylint for me, on Fedora 44 with Python 3.14.8 and pylint 4.1.3. With make -k, four files fail:

python/treport.py:625:8: W0201: Attribute 'sub_title' defined outside __init__ (attribute-defined-outside-init) python/ttimechart.py:1086:8: W0201: Attribute 'virtual_size' defined outside __init__ (attribute-defined-outside-init) (and a few more of the same kinds in treport.py and ttimechart.py)

I try to avoid duplicating others' work, but our CI failed to build perf due to W0201 warning, so I sent two patches to fix it:
https://lore.kernel.org/linux-perf-users/[email protected]/T/#t

I haven't found other reported issues so far, so I'll leave it to Ian and Alice to take a look.

Thanks,
Leo

#2 lore raw

Hi,

Just wanted to bump this patch in case it was missed. I believe this is still an issue in main today.

Best,
Lalit