types-PySide icon indicating copy to clipboard operation
types-PySide copied to clipboard

Incomplete `typing.Callable`

Open sisoe24 opened this issue 1 year ago • 2 comments

Hi! First of all, thank you very much for the extension!

As the title suggests, the typing.Callable is incomplete as an annotation. While mypy never complains, not even in --strict mode, pylance will, since the complete statement (a very generic one) would be typing.Callable[..., typing.Any].

After updating the reference, I tried to compile the stubs myself, but there are a couple of problems, probably due to the exact Python, PySide, and mypy versions. For example, every Classvar and Any miss the typing prefix, and Union[T, None] has changed to Optional[T].

Not to mention that the biggest problem is the function in mypy/stubdoc.py:is_valid_type. This function will complain about typing.Callable[..., Any] as not being a valid type, which makes sense, so I've modified its regex pattern to make it work. But of course, this would only work in my environment.

I have a repo that generates Nuke python stubs, and I managed to fix some irresolvable problems by running some post-fixes after the stubs generation. While not the cleanest solution, it allows for a certain level of "manual" modifications.

So I did fork your project, made the modifications, and passed the tests. You can look into whether you are interested in implementing this in one way or another or accepting a PR.

Thanks again for this extension.

sisoe24 avatar Feb 25 '24 18:02 sisoe24

Hi @sisoe24, thanks for the detailed report. I moved this project into my https://github.com/LumaPictures/cg-stubs projects. Sorry, I should update the README here to redirect there. I will do that ASAP.

It would be great if you could make a PR against that project. You'll see that the other project also has stubs for Nuke, so it would fantastic to team up on those.

chadrik avatar Feb 25 '24 19:02 chadrik

No problem at all, and it would be very cool to improve the Nuke stubs together.

I am trying to get the repo up and running, but I have gotten this error: ./stubgen_nuke.sh: line 7: setpkg: command not found. I see that it is a package of yours, but before I go down a rabbit hole maybe I need more context. Should we continue the conversation on the cg-stubs repo?

sisoe24 avatar Feb 26 '24 00:02 sisoe24