Skip to content

Slow with all checks disabled using pandas + dataclass #5835

Open
@brandon-leapyear

Description

@brandon-leapyear

Bug description

Repro:

  1. mkdir test && cd test

  2. python3 -m venv venv

  3. venv/bin/pip install pylint pandas

  4. Write foo.py:

    from dataclasses import dataclass
    from pandas import DataFrame
    @dataclass
    class Foo:
        a: DataFrame
  5. time pylint --disable=all foo.py

And this consistently takes 8s to run on my machine. Doing any of the following brings the runtime down to <2s:

  • Comment out the dataclasses import
  • Comment out the pandas import
  • Comment out the @dataclass decorator
  • Use @foo instead of @dataclass
  • Use @dataclasses.dataclass instead of @dataclass
  • Use int instead of pandas.Series
  • Use Optional[DataFrame] instead of DataFrame
  • Uninstalling pandas from the environment

Configuration

No response

Command used

time pylint --disable=all foo.py

Pylint output

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

 --disable=all foo.py  7.93s user 0.28s system 111% cpu 7.387 total

Expected behavior

Disabling all checks should not take 8 seconds for this small file.

Pylint version

pylint 2.12.2
astroid 2.9.3
Python 3.9.7 (default, Sep  3 2021, 12:45:31) 
[Clang 12.0.0 (clang-1200.0.32.29)]

OS / Environment

OSX 10.15 (Catalina)

Additional dependencies

astroid==2.9.3
isort==5.10.1
lazy-object-proxy==1.7.1
mccabe==0.6.1
numpy==1.22.2
pandas==1.4.1
platformdirs==2.5.1
pylint==2.12.2
python-dateutil==2.8.2
pytz==2021.3
six==1.16.0
toml==0.10.2
typing_extensions==4.1.1
wrapt==1.13.3

Metadata

Metadata

Assignees

No one assigned

    Labels

    Lib specific 💅This affect the code from a particular libraryNeeds investigation 🔬A bug or crash where it's not immediately obvious what is happenningperformance

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions