pcdshub / pcds-envs

conda environments used by PCDS
Other
1 stars 9 forks source link

`PyQt5` type hints broken #305

Closed tangkong closed 6 months ago

tangkong commented 10 months ago

Note: Nothing functionally broken here, guis run in both environments.

Pylance doesn't seem to like the current iteration of PyQt5. In this version, the *.pyi files that provide type hints are not present, breaking language server support for qtpy. (qtpy hints simply look through to PyQt5, since that's what we have installed)

Note, as of the writing of this issue, the most recent pylance release is also broken, downgrade to 2023.10.40

(Edited, my previous assessment was incorrect and blamed qtpy unfairly)

ZLLentz commented 10 months ago

We can update to 2.4.1 if we're willing to spend some time verifying that all the qt apps still work

tangkong commented 10 months ago

A little more digging on my part revealed that it's actually not qtpy, but rather that the new version of PyQt5 doesn't have the type hint files (*.pyi files)

(pcds-5.8.0)roberttk@psbuild-rhel7-03:~$ find /cds/group/pcds/pyps/conda/py39/envs/pcds-5.7.3/lib/python3.9/site-packages/PyQt5/ -name '*.pyi*' | wc -l
33
(pcds-5.8.0)roberttk@psbuild-rhel7-03:~$ find /cds/group/pcds/pyps/conda/py39/envs/pcds-5.8.0/lib/python3.9/site-packages/PyQt5/ -name '*.pyi*' | wc -l
0
tangkong commented 10 months ago

A potential solution: installing PyQt5-stubs

Edit: Running a small venv on top of pcds-conda with the stubs package on top of pcds-conda has been working great for me. If we want everyone to have type hint support I think this is a good way to go.