Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

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

Draft
m4reQ wants to merge19 commits intopython:main
base:main
Choose a base branch
Loading
fromm4reQ:imgui-2.0.0-stubs

Conversation

m4reQ
Copy link

No description provided.

@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions

This comment has been minimized.

Comment on lines 9 to 14
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, ...)

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.

Copy link
Author

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 plainints then will result in typechecker errors, when user tries to use combination of those flags (with| operator) (because it expects concrete value).

@m4reQm4reQ marked this pull request as draftJune 21, 2025 17:56
@brianschubert
Copy link
Member

brianschubert commentedJun 21, 2025
edited
Loading

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
@m4reQ
Copy link
Author

It appears imgui only supports Python <=3.11. That could be problem for stubtest, which currently runs on Python 3.13 in the CI

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.

m4reQand others added3 commitsJune 22, 2025 16:51
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
@github-actionsGitHub Actions

This comment has been minimized.

@github-actionsGitHub Actions
Copy link
Contributor

According tomypy_primer, this change has no effect on the checked open source code. 🤖🎉

@m4reQ
Copy link
Author

Additionally flake8 fails withY011 Only simple default values allowed for typed arguments for functions with defaults that use previously defined enum values. I believe they should be treated as simple literals as they are justFinal constants. I think removing the defaults takes away useful insight about the function usage. Is there any way to convince flake to allow for such construct or can we just silence that warning in this case?

Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment
Reviewers

@donBarbosdonBarbosdonBarbos left review comments

@brianschubertbrianschubertbrianschubert requested changes

Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

3 participants
@m4reQ@brianschubert@donBarbos

[8]ページ先頭

©2009-2025 Movatter.jp