Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incomplete typing.Callable #4

Open
sisoe24 opened this issue Feb 25, 2024 · 2 comments
Open

Incomplete typing.Callable #4

sisoe24 opened this issue Feb 25, 2024 · 2 comments

Comments

@sisoe24
Copy link

sisoe24 commented Feb 25, 2024

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.

@chadrik
Copy link
Owner

chadrik commented Feb 25, 2024

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.

@sisoe24
Copy link
Author

sisoe24 commented Feb 26, 2024

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?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants