Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork1.9k
Add stubs for pyimgui - Dear ImGui bindings#14317
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
base:main
Are you sure you want to change the base?
Uh oh!
There was an error while loading.Please reload this page.
Conversation
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
…into imgui-2.0.0-stubs
This comment has been minimized.
This comment has been minimized.
Uh oh!
There was an error while loading.Please reload this page.
stubs/imgui/imgui/core.pyi Outdated
Condition = typing.NewType("Condition", enum.IntFlag) | ||
NONE = typing.cast(Condition, ...) | ||
ALWAYS = typing.cast(Condition, ...) | ||
ONCE = typing.cast(Condition, ...) | ||
FIRST_USE_EVER = typing.cast(Condition, ...) | ||
APPEARING = typing.cast(Condition, ...) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Cython represents these using plain ints at runtime. IntFlag operations won't work (e.g. NONE.name would raise).
I'd suggest typing these asFinal
ints. If the values are stable, you can include them in the stubs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
The idea was to enforce usage of correct enums in certain contexts i.e. using values that fall under theWindowFlags
category in places when such are expected. Using plainint
s then will result in typechecker errors, when user tries to use combination of those flags (with|
operator) (because it expects concrete value).
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
Uh oh!
There was an error while loading.Please reload this page.
brianschubert commentedJun 21, 2025 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
It appears imgui only supports Python <=3.11. That could be problem for stubtest, which currently runs on Python 3.13 in the CI |
Use `typing_extensions.Self` instead of `typing.Self`Use `ABC`s from `collections.abc` moduleUse `Final[int]` for int constants inside `__init__.pyi`Use named imports
I personally used imgui mainly with Python 3.12.3 and it worked fine then. I cannot install it on 3.13 and above tho. |
Use custom `_IntFlag` instead of `enum.IntFlag`Use `Final` for constants instead of assignment with `cast` functionUse `Callable` from `collections.abc` instead of `typing` module
…into imgui-2.0.0-stubs
This comment has been minimized.
This comment has been minimized.
Remove typehints for `__init__` methods without arguments
…into imgui-2.0.0-stubs
According tomypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
Additionally flake8 fails with |
No description provided.