LaurenceWarne / cfn-lsp-extra

An Experimental Cloudformation language server

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

ValueError when running with python 3.11 (appears to be upstream pydantic bug)

clncy opened this issue · comments

Hi there,

Thank you for your work on this LS, I've really enjoyed using it with Neovim so far.

I'm getting the following error when I run cfn-lsp-extra:

  File "~/.local/pipx/venvs/cfn-lsp-extra/lib/python3.11/site-packages/pydantic/utils.py", line 231, in generate_model_signature
    merged_params[param_name] = Parameter(
                                ^^^^^^^^^^
  File "/opt/homebrew/Cellar/python@3.11/3.11.2_1/Frameworks/Python.framework/Versions/3.11/lib/python3.11/inspect.py", line 2722, in __init__
    raise ValueError('{!r} is not a valid parameter name'.format(name))
ValueError: 'from' is not a valid parameter name

It only occurs with python 3.11 (no issues with 3.9 and 3.10). It looks to be an upstream issue with Pydantic, which has now been resolved: pydantic/pydantic#4011

Manually installing pydantic 1.10.7 resolves the issue for me, so perhaps bumping the pydantic version up to 1.10 is all that is required.

Hi, thanks for the report! I'm glad you've found the language server useful.

It only occurs with python 3.11 (no issues with 3.9 and 3.10). It looks to be an upstream issue with Pydantic, which has now been resolved: pydantic/pydantic#4011

Good spot, I've updated pydantic (unfortunately this meant updating the LSP backend (pygls), where there were multiple breaking changes 😅), and enabled 3.11 on ci, and everything looks good.

To be double sure, are you able to install cfn-lsp-extra from source to check? You should be able to do with this lovely command:

pipx install git+https://github.com/laurencewarne/cfn-lsp-extra.git@$(git ls-remote git@github.com:laurencewarne/cfn-lsp-extra.git | head -1 | cut -f1) --force

unfortunately this meant updating the LSP backend (pygls), where there were multiple breaking changes 😅

Fun times!

To be double sure, are you able to install cfn-lsp-extra from source to check?

I've just used your command to install from source and the issue looks to be resolved 😎

Thanks for the quick response