-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Lupa stubs: #14359
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
base: main
Are you sure you want to change the base?
Lupa stubs: #14359
Conversation
Support get/set/del from Lua tables. Lua table values are all Any because we can't typecheck across language boundaries. Support unpack_returned_tuples in the LuaRuntime constructor. # Please enter the commit message for your changes. Lines starting # with '#' will be ignored, and an empty message aborts the commit. # # Date: Tue Jul 1 16:43:21 2025 -0700 # # On branch main # Your branch is ahead of 'origin/main' by 1 commit. # (use "git push" to publish your local commits) # # Changes to be committed: # modified: lua51.pyi # modified: lua52.pyi # modified: lua53.pyi # modified: lua54.pyi #
The failing check is easy enough to fix, but I found a possible way to get around the Any and I need to test it, so I'll be a while. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
Thanks, remarks below. Please note that I only left remarks on the first file, but they apply to all files.
@@ -70,8 +73,7 @@ class LuaRuntime: | |||
lua_implementation: Final[str] | |||
lua_version: Final[tuple[int, int]] | |||
|
|||
# @classmethod | |||
# def __cinit__(cls, unpack_return_tuples: bool) -> None: ... | |||
def __init__(self, /, unpack_returned_tuples: bool, *args: Any) -> None: ... |
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.
Please note that we need a comment for each Any
, explaining which types are allowed and/or how it's used.
LuaKey: TypeAlias = str | int | ||
LuaObject: TypeAlias = _LuaTable | int | str | float | bool | None |
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.
As far as I understand, these are not available at runtime, so we need to preface them with an underscore.
You could also consider adding a lupa._types
modules where you define these type-check only items and just import them, but that's just an option.
Support get/set/del from Lua tables.
Lua table values are all Any because we can't typecheck across language boundaries.
Support unpack_returned_tuples in the LuaRuntime constructor.