pyapp-kit / superqt

Missing widgets and components for Qt-python
https://pyapp-kit.github.io/superqt/
BSD 3-Clause "New" or "Revised" License
210 stars 38 forks source link

Older version typing-extensions causing trouble with superqt #45

Closed AhmetCanSolak closed 3 years ago

AhmetCanSolak commented 3 years ago

Describe the bug Older version of typing-extensions causing trouble with superqt during import time. I am happy to contribute a fix upon a decision together about how to address this(pinning typing-extensions version or something else?).

To Reproduce Install tensorflow==2.6.0(this installs typing-extensions==3.7.4.3), install superqt(or napari), and import superqt(or napari).

Expected behavior superqt doesn't cause trouble with imports in an ideal world. With latest typing-extensions(or tensorflow==2.7.0) there is no problem.

Screenshots

superqt/utils/_qthreading.py", line 23, in <module>
    from typing_extensions import Literal, ParamSpec
ImportError: cannot import name 'ParamSpec' from 'typing_extensions' 

Desktop (please complete the following information):

tlambert03 commented 3 years ago

ahh, thanks @AhmetCanSolak ... I think we need typing-extensions>=3.10.0.0

tlambert03 commented 3 years ago

bummer... looks like tensorflow pinned to ~=3.7.4 (meaning we won't be able to use anything >3.7) ... that's rather annoying for something like typing-extensions, which is just a backport. there's very little reason to pin! ... I can refactor to not use ParamSpec, but we loose some nice typing :/ argh

edit: this actually is a really big bummer, I would be more interested in using ParamSpec over at pysgnal and magicgui, once mypy has full support for it. but given the latency for people to update tensorflow, they kind of stuck the whole community with ancient typing :/ (or, install conflicts)

tlambert03 commented 3 years ago

does it work if you just manually pip install typing-extensions -U? (I feel rather confident that won't break tensorflow)

tlambert03 commented 3 years ago

I think we need typing-extensions>=3.10.0.0

maybe just make a PR to this effect... I should have done that if I was using ParamSpec anyway

AhmetCanSolak commented 3 years ago

yes they pinned :( honestly I like ParamSpec stuff. I prefer we add typing-extensions>=3.10.0.0

pip install typing-extensions -U gives dependency resolver conflict as tensorflow pinned to 3.7.4

tlambert03 commented 3 years ago

gives dependency resolver conflict as tensorflow pinned to 3.7.4

but it installs right, just with red text? ~or are you on conda?~ (no you said pip)

AhmetCanSolak commented 3 years ago

gives dependency resolver conflict as tensorflow pinned to 3.7.4

but it installs right, just with red text? ~or are you on conda?~ (no you said pip)

Yes it installs but gives red warning text.

edit: but when you have all these as dependencies pip will prefer pinned version(unless you show me a way to prevent that?), so I still think we have typing-extensions>=3.10.0.0 and ask people depending on this to upgrade tensorflow==2.7.0

tlambert03 commented 3 years ago

v0.2.5-1 is building now. thanks @AhmetCanSolak