openlawlibrary / pygls

A pythonic generic language server
https://pygls.readthedocs.io/en/latest/
Apache License 2.0
588 stars 105 forks source link

Crashes on Python 3.11 #234

Closed Bobronium closed 2 years ago

Bobronium commented 2 years ago

Official support for python 3.10 was added only to pydantic in version 1.9, however in lib requirements lower version is pinned: https://github.com/openlawlibrary/pygls/blob/4ce8988c87ba75352a510611881bc1d9d4e6757f/setup.cfg#L28

Might be fixed in #229 Causes https://github.com/microsoft/vscode-black-formatter/issues/67

Initially I thought it crashes on Python 3.10, but as it turned out, I got it wrong.

pfmoore commented 2 years ago

Is there any progress on Python 3.11 support? With the official release in a day or so, this (or more specifically the related issue in vscode-isort) will become a more significant problem.

karthiknadig commented 2 years ago

@tombh @alcarney Can this issue be prioritized, this is currently impacting about 8 different servers? We might need a temporary solution until pygls 1.0.0 can hit final release.

tombh commented 2 years ago

I have time today, I'll look into it and either fix it or find a temporary workaround.

BTW, what are those servers?

karthiknadig commented 2 years ago

Following are from Microsoft:

tombh commented 2 years ago

Quick question, it seems like the fix is to set pydantic>=1.10.2 in order to include their https://github.com/pydantic/pydantic/pull/4012 PR. It seems easy, so I'm wondering if this wasn't suggested before because upgrading Pydantic would break other projects' dependencies?

BTW thanks for the list, could we add them to https://github.com/openlawlibrary/pygls/blob/master/Implementations.md ?

karthiknadig commented 2 years ago

Looking at other issues, it seems like potential breaking changes in pydantic were the reason.

tombh commented 2 years ago

So how about if Pygls set its dependency to pydantic>=1.19.1,<=1.10.2? I'm not familiar enough with Python to know if that's helpful? The idea being that most users will remain unaffected, but that if somebody really needs to use Python 3.11 then they'll need to explicitly install Pydantic 1.10.2.

brettcannon commented 2 years ago

So how about if Pygls set its dependency to pydantic>=1.19.1,<=1.10.2? I'm not familiar enough with Python to know if that's helpful?

You can also do pydantic!=1.9.2,!=1.10.1 .

brettcannon commented 2 years ago

You can also specify that Python 3.11 needs a newer version with pydantic>=1.10.2; python_version>=3.11

tombh commented 2 years ago

Made PR at https://github.com/openlawlibrary/pygls/pull/279 If it all looks good I can publish today.

karthiknadig commented 2 years ago

279 looks good

tombh commented 2 years ago

Released https://pypi.org/project/pygls/0.12.3 🚀

karthiknadig commented 2 years ago

@tombh I have a PR to loosen the upper bound on python <3.11 for pydantic, https://github.com/openlawlibrary/pygls/pull/280 . The upper bound on py<3.11 means that there is no pydantic version that woks for all 3.7-3.11.

brettcannon commented 2 years ago

FYI Python 3.11.0 is now out: https://www.python.org/downloads/release/python-3110/ .