pyinvoke / invoke

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

Support for Python 3.11 #891

Closed blazewicz closed 1 year ago

blazewicz commented 1 year ago

We're using invoke internally and it seems to be the last dependency incompatible with Python 3.11.

Error we're getting is pasted below, probably not the last one.

Traceback (most recent call last):
  File ".venv/bin/invoke", line 8, in <module>
    sys.exit(program.run())
             ^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/invoke/program.py", line 373, in run
    self.parse_collection()
  File ".venv/lib/python3.11/site-packages/invoke/program.py", line 465, in parse_collection
    self.load_collection()
  File ".venv/lib/python3.11/site-packages/invoke/program.py", line 699, in load_collection
    module, parent = loader.load(coll_name)
                     ^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/invoke/loader.py", line 76, in load
    module = imp.load_module(name, fd, path, desc)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/imp.py", line 235, in load_module
    return load_source(name, filename, file)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/imp.py", line 172, in load_source
    module = _load(spec)
             ^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 721, in _load
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "src/tasks.py", line 29, in <module>
    @task(name="migrate")
     ^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/invoke/tasks.py", line 357, in inner
    obj = klass(
          ^^^^^^
  File ".venv/lib/python3.11/site-packages/invoke/tasks.py", line 76, in __init__
    self.positional = self.fill_implicit_positionals(positional)
                      ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/invoke/tasks.py", line 167, in fill_implicit_positionals
    args, spec_dict = self.argspec(self.body)
                      ^^^^^^^^^^^^^^^^^^^^^^^
  File ".venv/lib/python3.11/site-packages/invoke/tasks.py", line 153, in argspec
    spec = inspect.getargspec(func)
           ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
oznogon commented 1 year ago

Similar to/dupe of #833, which contains workarounds (shimming getargspec or switching to a fork that applies the patch); #458 and #606 would fix this specific error if merged. Maintainers suggest this is blocked by #856 (remove python2 support).

blazewicz commented 1 year ago

I can confirm that issue was fixed with 8f6c0617c7dc59b105dd1b92fb417e75adc21bea, we're awaiting for next release.

Snooz82 commented 1 year ago

Any ideas when the next release will come?

blazewicz commented 1 year ago

Support for 3.11 was brought with release 2.0.0 🎉 thanks @bitprophet!