Giter VIP home page Giter VIP logo

types-pyside's Issues

Cannot manage to make the stubs used by PyCharm.

Hello, I have been trying to get your stubs working alongside my PyCharm project.

I am using Qt.py from which types-PySide is perfectly installed using 1.3.8. But they are not being picked by PyCharm at all.

The reasons for now are :

  • PyCharm create some pre-build "binary skeletons", I need to remove them from External Libraries/Binary Skeletons.
  • Then it seems PySide2 comes with its own stubs file installed along. You can just perform a pip install PySide2 --target "somedir/", look at the content of somedir and notice a .pyi file for each root Qt module. Again I can deleted those manually but though it's not a good practice as this need to be performed at each venv update.

Here is a screenshot of the site-packages directory of the venv :

image

So this would actually be more of a "discussion" than an "issue" as there is no issue with types-PySide directly, just PyCharm being annoying to work with. I'm still creating the issue so it can maybe help other people having the same issue.

I'm looking for any advice on the resolution that would involve minimal hackery.

  • Is there any flag when installing PySide2 so it doesn't install stubs
  • Can I make PySide2-stubs stubs take priority over the .pyi files in PySide2 directory ?
Context

PyCharm 2022.3.2
Poetry 1.2.0
Qt.py 1.3.8
types-PySide2 5.15.2.1.5

Feel free to close this if you don't estimate it's the right place to discuss it.
Cheers.
Liam.

Incomplete `typing.Callable`

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.

QTextEdit.setFontWeight() type error

This produces a type error:

self.setFontWeight(QtGui.QFont.DemiBold)
Argument of type "Weight" cannot be assigned to parameter "w" of type "int" in function "setFontWeight"
  "Weight" is incompatible with "int"

setFontWeight() allows QFont predefined weight enums, but they don't register as compatible with ints, even though they are

Can't use these stubs in vscode, mypy has a number of errors

When I tried to use these stubs in vscode they didn't work, then checking the Output window (under python) I discovered a number of errors like this:

/stubs/PySide2-stubs/QtCore.pyi:377:5: error: Signature of "columnCount" incompatible with supertype "QAbstractItemModel"

I'm guessing vscode does a pass with mypy.stubtest first and doesn't use them unless it passes. (That's just a guess, I haven't gone to the trouble of testing this myself yet)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.