pyinvoke / invoke

Pythonic task management & command execution.
http://pyinvoke.org
BSD 2-Clause "Simplified" License
4.31k stars 365 forks source link

getargspec deprecated in Python 3.0 - now gone #968

Closed datalogics-robb closed 9 months ago

datalogics-robb commented 9 months ago

We have a lot of infrastructure built on invoke - and are running into this problem when updating Python to 3.11 on Windows 10

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\tasks\__init__.py", line 1, in <module>

    from dl_conan_build_tools.tasks import build, check, conan

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\python-env-win10-apdfl18\Lib\site-packages\dl_conan_build_tools\tasks\build.py", line 10, in <module>

    from . import conan

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\python-env-win10-apdfl18\Lib\site-packages\dl_conan_build_tools\tasks\conan.py", line 424, in <module>

    @task(

     ^^^^^

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\python-env-win10-apdfl18\Lib\site-packages\invoke\tasks.py", line 357, in inner

    obj = klass(

          ^^^^^^

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\python-env-win10-apdfl18\Lib\site-packages\invoke\tasks.py", line 76, in __init__

    self.positional = self.fill_implicit_positionals(positional)

                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\python-env-win10-apdfl18\Lib\site-packages\invoke\tasks.py", line 167, in fill_implicit_positionals

    args, spec_dict = self.argspec(self.body)

                      ^^^^^^^^^^^^^^^^^^^^^^^

  File "F:\Kepler\workspace\pdf2img_PR-320_windows-32-pdf2img\python-env-win10-apdfl18\Lib\site-packages\invoke\tasks.py", line 153, in argspec

    spec = inspect.getargspec(func)

           ^^^^^^^^^^^^^^^^^^

AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?

script returned exit code 1

According to the docs - https://docs.python.org/3.10/library/inspect.html?highlight=getargspec#inspect.getargspec the method getfullargspec() is a straightforward replacement. Python 2.x support should not be needed at this point in history.

datalogics-robb commented 9 months ago

Re: https://github.com/python/cpython/issues/89483

datalogics-robb commented 9 months ago

Whelp, one of my dependencies was requiring an old version of invoke - 2.0.1 - and it appears this has been fixed.