Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Update pylint version in pre-commit #4856

@billsacks

Description

@billsacks

I had trouble running pre-commit on my Mac with python 3.13:

$ pre-commit run -a
[INFO] Installing environment for https://github.com/PyCQA/pylint.
[INFO] Once installed this environment will be reused.
[INFO] This may take a few minutes...
An unexpected error has occurred: CalledProcessError: command: ('/Users/sacks/.cache/pre-commit/repofyy_uh61/py_env-python3.13/bin/python', '-mpip', 'install', '.')
return code: 1
stdout:
    Processing /Users/sacks/.cache/pre-commit/repofyy_uh61
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'done'
      Preparing metadata (pyproject.toml): started
      Preparing metadata (pyproject.toml): finished with status 'done'
    Collecting platformdirs>=2.2.0 (from pylint==2.11.1)
      Using cached platformdirs-4.4.0-py3-none-any.whl.metadata (12 kB)
    Collecting astroid<2.9,>=2.8.0 (from pylint==2.11.1)
      Using cached astroid-2.8.6-py3-none-any.whl.metadata (4.7 kB)
    Collecting isort<6,>=4.2.5 (from pylint==2.11.1)
      Using cached isort-5.13.2-py3-none-any.whl.metadata (12 kB)
    Collecting mccabe<0.7,>=0.6 (from pylint==2.11.1)
      Using cached mccabe-0.6.1-py2.py3-none-any.whl.metadata (4.3 kB)
    Collecting toml>=0.7.1 (from pylint==2.11.1)
      Using cached toml-0.10.2-py2.py3-none-any.whl.metadata (7.1 kB)
    Collecting lazy-object-proxy>=1.4.0 (from astroid<2.9,>=2.8.0->pylint==2.11.1)
      Using cached lazy_object_proxy-1.12.0-cp313-cp313-macosx_11_0_arm64.whl.metadata (5.1 kB)
    Collecting wrapt<1.14,>=1.11 (from astroid<2.9,>=2.8.0->pylint==2.11.1)
      Using cached wrapt-1.13.3.tar.gz (48 kB)
      Installing build dependencies: started
      Installing build dependencies: finished with status 'done'
      Getting requirements to build wheel: started
      Getting requirements to build wheel: finished with status 'done'
      Preparing metadata (pyproject.toml): started
      Preparing metadata (pyproject.toml): finished with status 'error'
stderr:
      error: subprocess-exited-with-error

      × Preparing metadata (pyproject.toml) did not run successfully.
      │ exit code: 1
      ╰─> [98 lines of output]
          Traceback (most recent call last):
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/expand.py", line 71, in __getattr__
              return next(
                  ast.literal_eval(value)
                  for target, value in self._find_assignments()
                  if isinstance(target, ast.Name) and target.id == attr
              )
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/expand.py", line 72, in <genexpr>
              ast.literal_eval(value)
              ~~~~~~~~~~~~~~~~^^^^^^^
            File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ast.py", line 110, in literal_eval
              return _convert(node_or_string)
            File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ast.py", line 109, in _convert
              return _convert_signed_num(node)
            File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ast.py", line 83, in _convert_signed_num
              return _convert_num(node)
            File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ast.py", line 74, in _convert_num
              _raise_malformed_node(node)
              ~~~~~~~~~~~~~~~~~~~~~^^^^^^
            File "/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/ast.py", line 71, in _raise_malformed_node
              raise ValueError(msg + f': {node!r}')
          ValueError: malformed node or string on line 2: <ast.Call object at 0x102783dd0>

          The above exception was the direct cause of the following exception:

          Traceback (most recent call last):
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/expand.py", line 185, in read_attr
              value = getattr(StaticModule(module_name, spec), attr_name)
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/expand.py", line 77, in __getattr__
              raise AttributeError(f"{self.name} has no attribute {attr}") from e
          AttributeError: wrapt has no attribute __version__

          During handling of the above exception, another exception occurred:

          Traceback (most recent call last):
            File "/Users/sacks/.cache/pre-commit/repofyy_uh61/py_env-python3.13/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 389, in <module>
              main()
              ~~~~^^
            File "/Users/sacks/.cache/pre-commit/repofyy_uh61/py_env-python3.13/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 373, in main
              json_out["return_val"] = hook(**hook_input["kwargs"])
                                       ~~~~^^^^^^^^^^^^^^^^^^^^^^^^
            File "/Users/sacks/.cache/pre-commit/repofyy_uh61/py_env-python3.13/lib/python3.13/site-packages/pip/_vendor/pyproject_hooks/_in_process/_in_process.py", line 175, in prepare_metadata_for_build_wheel
              return hook(metadata_directory, config_settings)
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 374, in prepare_metadata_for_build_wheel
              self.run_setup()
              ~~~~~~~~~~~~~~^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 512, in run_setup
              super().run_setup(setup_script=setup_script)
              ~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/build_meta.py", line 317, in run_setup
              exec(code, locals())
              ~~~~^^^^^^^^^^^^^^^^
            File "<string>", line 41, in <module>
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/__init__.py", line 115, in setup
              return distutils.core.setup(**attrs)
                     ~~~~~~~~~~~~~~~~~~~~^^^^^^^^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/_distutils/core.py", line 160, in setup
              dist.parse_config_files()
              ~~~~~~~~~~~~~~~~~~~~~~~^^
            File "/Users/sacks/.cache/pre-commit/repofyy_uh61/py_env-python3.13/lib/python3.13/site-packages/_virtualenv.py", line 22, in parse_config_files
              result = old_parse_config_files(self, *args, **kwargs)
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/dist.py", line 752, in parse_config_files
              setupcfg.parse_configuration(
              ~~~~~~~~~~~~~~~~~~~~~~~~~~~~^
                  self, self.command_options, ignore_option_errors=ignore_option_errors
                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
              )
              ^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/setupcfg.py", line 188, in parse_configuration
              meta.parse()
              ~~~~~~~~~~^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/setupcfg.py", line 502, in parse
              section_parser_method(section_options)
              ~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/setupcfg.py", line 477, in parse_section
              self[name] = value
              ~~~~^^^^^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/setupcfg.py", line 294, in __setitem__
              parsed = self.parsers.get(option_name, lambda x: x)(value)
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/setupcfg.py", line 600, in _parse_version
              return expand.version(self._parse_attr(value, self.package_dir, self.root_dir))
                                    ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/setupcfg.py", line 419, in _parse_attr
              return expand.read_attr(attr_desc, package_dir, root_dir)
                     ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/expand.py", line 190, in read_attr
              module = _load_spec(spec, module_name)
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-build-env-hnbpvhbk/overlay/lib/python3.13/site-packages/setuptools/config/expand.py", line 211, in _load_spec
              spec.loader.exec_module(module)
              ~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
            File "<frozen importlib._bootstrap_external>", line 1026, in exec_module
            File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-install-dwq0vdza/wrapt_3dd7183d94544ffba170c187878610d3/src/wrapt/__init__.py", line 10, in <module>
              from .decorators import (adapter_factory, AdapterFactory, decorator,
                      synchronized)
            File "/private/var/folders/mp/rlk6q70n1jl_syyghjrhsv7w0000gp/T/pip-install-dwq0vdza/wrapt_3dd7183d94544ffba170c187878610d3/src/wrapt/decorators.py", line 34, in <module>
              from inspect import ismethod, isclass, formatargspec
          ImportError: cannot import name 'formatargspec' from 'inspect' (/opt/homebrew/Cellar/[email protected]/3.13.7/Frameworks/Python.framework/Versions/3.13/lib/python3.13/inspect.py). Did you mean: 'formatargvalues'?
          [end of output]

      note: This error originates from a subprocess, and is likely not a problem with pip.
    error: metadata-generation-failed

    × Encountered error while generating package metadata.
    ╰─> See above for output.

    note: This is an issue with the package mentioned above, not pip.
    hint: See above for details.
Check the log at /Users/sacks/.cache/pre-commit/pre-commit.log

I think this is a dependency issue. Updating pylint to the latest (v3.3.8; we're currently pointing to the old v2.11.1) in .pre-commit-config.yaml solves this issue.

However, this pylint update will require either fixing (ideally) or disabling (short-term) some checks that are now failing. I'll open separate issues for these.

@jasonb5 and others: does it seem reasonable to update pylint to the latest in our pre-commit config?

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions