Python 3.11 support?

@cornelinux
It looks like, that current pi-manage is not compatible with Python 3.11:

Traceback (most recent call last):
  File "/opt/privacyidea/bin/pi-manage", line 150, in <module>
    @hsm_manager.command
     ^^^^^^^^^^^^^^^^^^^
  File "/opt/privacyidea/lib/python3.11/site-packages/flask_script/__init__.py", line 288, in command
    command = Command(func)
              ^^^^^^^^^^^^^
  File "/opt/privacyidea/lib/python3.11/site-packages/flask_script/commands.py", line 118, in __init__
    args, varargs, keywords, defaults = inspect.getargspec(func)
                                        ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
Traceback (most recent call last):
  File "/opt/privacyidea/bin/pi-manage", line 150, in <module>
    @hsm_manager.command
     ^^^^^^^^^^^^^^^^^^^
  File "/opt/privacyidea/lib/python3.11/site-packages/flask_script/__init__.py", line 288, in command
    command = Command(func)
              ^^^^^^^^^^^^^
  File "/opt/privacyidea/lib/python3.11/site-packages/flask_script/commands.py", line 118, in __init__
    args, varargs, keywords, defaults = inspect.getargspec(func)
                                        ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?
Traceback (most recent call last):
  File "/opt/privacyidea/bin/pi-manage", line 150, in <module>
    @hsm_manager.command
     ^^^^^^^^^^^^^^^^^^^
  File "/opt/privacyidea/lib/python3.11/site-packages/flask_script/__init__.py", line 288, in command
    command = Command(func)
              ^^^^^^^^^^^^^
  File "/opt/privacyidea/lib/python3.11/site-packages/flask_script/commands.py", line 118, in __init__
    args, varargs, keywords, defaults = inspect.getargspec(func)
                                        ^^^^^^^^^^^^^^^^^^
AttributeError: module 'inspect' has no attribute 'getargspec'. Did you mean: 'getargs'?

inspect.getargspec was deprecated in 3.0. Is this already known?

Edit:
Workaround for me was to use inspect.fullargspec instead, and add 3 dummy variables because getfullargspec will return 7 items instead of 4 :

args, varargs, keywords, defaults, foo, foo1, foo2 = inspect.getfullargspec(func)

Your oberservation is correct.

Is Python 3.11 support planned for the near future?

I am busy upgrading from Debian Bullseye (Python 3.9) to Bookworm which contains Python 3.11. Is it worth halting the OS upgrade until Privacyidea supports 3.11 or should a look for an alternative way to support 3.10 on Bookworm e.g. by using pyenv?

– Kees.

It is planned to provide support for python 3.11 in privacyIDEA 3.10, which might be available in Q2/2024.