Skip to content

Add tools/generate_pyi based on mypy.stubgen POC #211

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

Closed
wants to merge 1 commit into from

Conversation

touilleMan
Copy link
Owner

I think #202 is better suited for our needs, but since I tried this approach it's always nice to keep this code somewhere ;-)

@touilleMan
Copy link
Owner Author

note the __doc__ changes in the bindings generation is due to mypy.stubgen having some internal trouble with C extension (python/mypy#7692, basically we need to have a __doc__ field available for each class and each class attribute)

@touilleMan
Copy link
Owner Author

the generate godot/binding.pyi looks like this:

from typing import Any

BUTTON_LEFT: int
BUTTON_MASK_LEFT: int
BUTTON_MASK_MIDDLE: int
BUTTON_MASK_RIGHT: int
BUTTON_MASK_XBUTTON1: int

[...]

OS: Any
ProjectSettings: Any
ResourceLoader: Any

[...]

class ARVRInterface(Reference):
    ARVR_AR: Any = ...
    ARVR_EXCESSIVE_MOTION: Any = ...
    ARVR_EXTERNAL: Any = ...
    ARVR_INSUFFICIENT_FEATURES: Any = ...
    ARVR_MONO: Any = ...
    ARVR_NONE: Any = ...
    ARVR_NORMAL_TRACKING: Any = ...
    ARVR_NOT_TRACKING: Any = ...
    ARVR_STEREO: Any = ...
    ARVR_UNKNOWN_TRACKING: Any = ...
    EYE_LEFT: Any = ...
    EYE_MONO: Any = ...
    EYE_RIGHT: Any = ...
    ar_is_anchor_detection_enabled: Any = ...
    interface_is_initialized: Any = ...
    interface_is_primary: Any = ...
    __pyx_vtable__: Any = ...
    @classmethod
    def __init__(self, *args, **kwargs) -> None: ...
    def _from_ptr(self, *args, **kwargs) -> Any: ...
    def get_anchor_detection_is_enabled(self, *args, **kwargs) -> Any: ...
    def get_camera_feed_id(self, *args, **kwargs) -> Any: ...
    def get_capabilities(self, *args, **kwargs) -> Any: ...
    def get_name(self, *args, **kwargs) -> Any: ...
    def get_render_targetsize(self, *args, **kwargs) -> Any: ...
    def get_tracking_status(self, *args, **kwargs) -> Any: ...
    def initialize(self, *args, **kwargs) -> Any: ...
    def is_initialized(self, *args, **kwargs) -> Any: ...
    def is_primary(self, *args, **kwargs) -> Any: ...
    def is_stereo(self, *args, **kwargs) -> Any: ...
    def set_anchor_detection_is_enabled(self, *args, **kwargs) -> Any: ...
    def set_is_initialized(self, *args, **kwargs) -> Any: ...
    def set_is_primary(self, *args, **kwargs) -> Any: ...
    def uninitialize(self, *args, **kwargs) -> Any: ...
    def __hash__(self) -> Any: ...
    def __reduce__(self) -> Any: ...
    def __setstate__(self, state) -> Any: ...

[...]

@touilleMan
Copy link
Owner Author

closed now #202 has been merged

@touilleMan touilleMan closed this Aug 4, 2020
@touilleMan touilleMan deleted the bindings-pyi-from-mypy-stubgen branch February 17, 2023 14:37
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

Successfully merging this pull request may close these issues.

1 participant