[PATCH v1 0/6] Mypy and pylint build support

Ian Rogers posted 6 patches 1 year, 3 months ago
There is a newer version of this series
tools/build/Makefile.build         |  6 +++++-
tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
tools/perf/Makefile.perf           | 14 +++++++++++--
tools/perf/arch/x86/Build          |  6 +++---
tools/perf/arch/x86/tests/Build    |  6 +++---
tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
tools/perf/tests/shell/lib/attr.py |  8 +-------
tools/perf/trace/beauty/Build      |  6 +++---
tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
tools/perf/util/setup.py           | 10 ++++++++--
12 files changed, 171 insertions(+), 31 deletions(-)
[PATCH v1 0/6] Mypy and pylint build support
Posted by Ian Rogers 1 year, 3 months ago
Support building perf checking the python code with mypy and/or
pylint. Currently there are too many errors to make this a default.

Shellcheck generates no output on success, so linking shellcheck files
doesn't cause `ld` to fail. Mypy and pylint generate output that will
break `ld` so change the Makefile.build to ignore test log files.

Address some initial mypy errors.

Ian Rogers (6):
  tools/build: Don't pass test log files to linker
  perf build: Rename TEST_LOGS to SHELL_TEST_LOGS
  perf build: Add mypy build tests
  perf build: Add pylint build tests
  perf test: Address attr.py mypy error
  perf python: Fix setup.py mypy errors

 tools/build/Makefile.build         |  6 +++++-
 tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
 tools/perf/Makefile.perf           | 14 +++++++++++--
 tools/perf/arch/x86/Build          |  6 +++---
 tools/perf/arch/x86/tests/Build    |  6 +++---
 tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
 tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
 tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
 tools/perf/tests/shell/lib/attr.py |  8 +-------
 tools/perf/trace/beauty/Build      |  6 +++---
 tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
 tools/perf/util/setup.py           | 10 ++++++++--
 12 files changed, 171 insertions(+), 31 deletions(-)

-- 
2.47.0.163.g1226f6d8fa-goog
Re: [PATCH v1 0/6] Mypy and pylint build support
Posted by Namhyung Kim 1 year ago
On Fri, Oct 25, 2024 at 10:22:57AM -0700, Ian Rogers wrote:
> Support building perf checking the python code with mypy and/or
> pylint. Currently there are too many errors to make this a default.
> 
> Shellcheck generates no output on success, so linking shellcheck files
> doesn't cause `ld` to fail. Mypy and pylint generate output that will
> break `ld` so change the Makefile.build to ignore test log files.
> 
> Address some initial mypy errors.
> 
> Ian Rogers (6):
>   tools/build: Don't pass test log files to linker
>   perf build: Rename TEST_LOGS to SHELL_TEST_LOGS
>   perf build: Add mypy build tests
>   perf build: Add pylint build tests
>   perf test: Address attr.py mypy error
>   perf python: Fix setup.py mypy errors

It doesn't apply to the perf-tools-next cleanly.  Can you please rebase?

Thanks,
Namhyung

> 
>  tools/build/Makefile.build         |  6 +++++-
>  tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
>  tools/perf/Makefile.perf           | 14 +++++++++++--
>  tools/perf/arch/x86/Build          |  6 +++---
>  tools/perf/arch/x86/tests/Build    |  6 +++---
>  tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
>  tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
>  tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
>  tools/perf/tests/shell/lib/attr.py |  8 +-------
>  tools/perf/trace/beauty/Build      |  6 +++---
>  tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
>  tools/perf/util/setup.py           | 10 ++++++++--
>  12 files changed, 171 insertions(+), 31 deletions(-)
> 
> -- 
> 2.47.0.163.g1226f6d8fa-goog
>
Re: [PATCH v1 0/6] Mypy and pylint build support
Posted by James Clark 1 year ago

On 25/10/2024 6:22 pm, Ian Rogers wrote:
> Support building perf checking the python code with mypy and/or
> pylint. Currently there are too many errors to make this a default.
> 
> Shellcheck generates no output on success, so linking shellcheck files
> doesn't cause `ld` to fail. Mypy and pylint generate output that will
> break `ld` so change the Makefile.build to ignore test log files.
> 
> Address some initial mypy errors.
> 
> Ian Rogers (6):
>    tools/build: Don't pass test log files to linker
>    perf build: Rename TEST_LOGS to SHELL_TEST_LOGS
>    perf build: Add mypy build tests
>    perf build: Add pylint build tests
>    perf test: Address attr.py mypy error
>    perf python: Fix setup.py mypy errors
> 
>   tools/build/Makefile.build         |  6 +++++-
>   tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
>   tools/perf/Makefile.perf           | 14 +++++++++++--
>   tools/perf/arch/x86/Build          |  6 +++---
>   tools/perf/arch/x86/tests/Build    |  6 +++---
>   tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
>   tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
>   tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
>   tools/perf/tests/shell/lib/attr.py |  8 +-------
>   tools/perf/trace/beauty/Build      |  6 +++---
>   tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
>   tools/perf/util/setup.py           | 10 ++++++++--
>   12 files changed, 171 insertions(+), 31 deletions(-)
> 

Reviewed-by: James Clark <james.clark@linaro.org>

   $ make PYLINT=1 MYPY=1

   TEST    python/twatch.py.pylint_log
   ...
   Your code has been rated at -5.00/10
   ...
Re: [PATCH v1 0/6] Mypy and pylint build support
Posted by James Clark 1 year ago

On 16/01/2025 10:56 am, James Clark wrote:
> 
> 
> On 25/10/2024 6:22 pm, Ian Rogers wrote:
>> Support building perf checking the python code with mypy and/or
>> pylint. Currently there are too many errors to make this a default.
>>
>> Shellcheck generates no output on success, so linking shellcheck files
>> doesn't cause `ld` to fail. Mypy and pylint generate output that will
>> break `ld` so change the Makefile.build to ignore test log files.
>>
>> Address some initial mypy errors.
>>
>> Ian Rogers (6):
>>    tools/build: Don't pass test log files to linker
>>    perf build: Rename TEST_LOGS to SHELL_TEST_LOGS
>>    perf build: Add mypy build tests
>>    perf build: Add pylint build tests
>>    perf test: Address attr.py mypy error
>>    perf python: Fix setup.py mypy errors
>>
>>   tools/build/Makefile.build         |  6 +++++-
>>   tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
>>   tools/perf/Makefile.perf           | 14 +++++++++++--
>>   tools/perf/arch/x86/Build          |  6 +++---
>>   tools/perf/arch/x86/tests/Build    |  6 +++---
>>   tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
>>   tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
>>   tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
>>   tools/perf/tests/shell/lib/attr.py |  8 +-------
>>   tools/perf/trace/beauty/Build      |  6 +++---
>>   tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
>>   tools/perf/util/setup.py           | 10 ++++++++--
>>   12 files changed, 171 insertions(+), 31 deletions(-)
>>
> 
> Reviewed-by: James Clark <james.clark@linaro.org>
> 
>    $ make PYLINT=1 MYPY=1
> 
>    TEST    python/twatch.py.pylint_log
>    ...
>    Your code has been rated at -5.00/10
>    ...

I forgot to add this:

  :(

I didn't know it could go negative.

Re: [PATCH v1 0/6] Mypy and pylint build support
Posted by Ian Rogers 1 year ago
On Thu, Jan 16, 2025 at 2:58 AM James Clark <james.clark@linaro.org> wrote:
>
>
>
> On 16/01/2025 10:56 am, James Clark wrote:
> >
> >
> > On 25/10/2024 6:22 pm, Ian Rogers wrote:
> >> Support building perf checking the python code with mypy and/or
> >> pylint. Currently there are too many errors to make this a default.
> >>
> >> Shellcheck generates no output on success, so linking shellcheck files
> >> doesn't cause `ld` to fail. Mypy and pylint generate output that will
> >> break `ld` so change the Makefile.build to ignore test log files.
> >>
> >> Address some initial mypy errors.
> >>
> >> Ian Rogers (6):
> >>    tools/build: Don't pass test log files to linker
> >>    perf build: Rename TEST_LOGS to SHELL_TEST_LOGS
> >>    perf build: Add mypy build tests
> >>    perf build: Add pylint build tests
> >>    perf test: Address attr.py mypy error
> >>    perf python: Fix setup.py mypy errors
> >>
> >>   tools/build/Makefile.build         |  6 +++++-
> >>   tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
> >>   tools/perf/Makefile.perf           | 14 +++++++++++--
> >>   tools/perf/arch/x86/Build          |  6 +++---
> >>   tools/perf/arch/x86/tests/Build    |  6 +++---
> >>   tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
> >>   tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
> >>   tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
> >>   tools/perf/tests/shell/lib/attr.py |  8 +-------
> >>   tools/perf/trace/beauty/Build      |  6 +++---
> >>   tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
> >>   tools/perf/util/setup.py           | 10 ++++++++--
> >>   12 files changed, 171 insertions(+), 31 deletions(-)
> >>
> >
> > Reviewed-by: James Clark <james.clark@linaro.org>
> >
> >    $ make PYLINT=1 MYPY=1
> >
> >    TEST    python/twatch.py.pylint_log
> >    ...
> >    Your code has been rated at -5.00/10
> >    ...
>
> I forgot to add this:
>
>   :(
>
> I didn't know it could go negative.

:-) Shows we have some room to improve.

Thanks for the review!
Ian
Re: [PATCH v1 0/6] Mypy and pylint build support
Posted by Ian Rogers 1 year ago
On Fri, Oct 25, 2024 at 10:23 AM Ian Rogers <irogers@google.com> wrote:
>
> Support building perf checking the python code with mypy and/or
> pylint. Currently there are too many errors to make this a default.
>
> Shellcheck generates no output on success, so linking shellcheck files
> doesn't cause `ld` to fail. Mypy and pylint generate output that will
> break `ld` so change the Makefile.build to ignore test log files.
>
> Address some initial mypy errors.
>
> Ian Rogers (6):
>   tools/build: Don't pass test log files to linker
>   perf build: Rename TEST_LOGS to SHELL_TEST_LOGS
>   perf build: Add mypy build tests
>   perf build: Add pylint build tests
>   perf test: Address attr.py mypy error
>   perf python: Fix setup.py mypy errors

Ping.

Thanks,
Ian

>  tools/build/Makefile.build         |  6 +++++-
>  tools/perf/Build                   | 32 +++++++++++++++++++++++++++---
>  tools/perf/Makefile.perf           | 14 +++++++++++--
>  tools/perf/arch/x86/Build          |  6 +++---
>  tools/perf/arch/x86/tests/Build    |  6 +++---
>  tools/perf/pmu-events/Build        | 25 ++++++++++++++++++++++-
>  tools/perf/scripts/Build           | 26 ++++++++++++++++++++++++
>  tools/perf/tests/Build             | 32 +++++++++++++++++++++++++++---
>  tools/perf/tests/shell/lib/attr.py |  8 +-------
>  tools/perf/trace/beauty/Build      |  6 +++---
>  tools/perf/util/Build              | 31 ++++++++++++++++++++++++++---
>  tools/perf/util/setup.py           | 10 ++++++++--
>  12 files changed, 171 insertions(+), 31 deletions(-)
>
> --
> 2.47.0.163.g1226f6d8fa-goog
>