-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
[python-package] add type hints on Dataset constructors #5458
Conversation
WDYT about defining a type for the dataset handle like in LightGBM/include/LightGBM/c_api.h Line 29 in 0a5c583
|
Can you be more specific about what you're proposing for the Python side and what the benefit would be? I don't understand. |
Something like: DatasetHandle = ctypes.c_void_p
def __init_from_np2d(
self,
mat: np.ndarray,
params_str: str,
ref_dataset: Optional[DatasetHandle]
) -> "Dataset": The benefit in my opinion is that when reading the code instead of reading: "the reference dataset is a void pointer", you'll instead read: "the reference dataset is a dataset handle" |
ah ok, so just for documentation purposes? Yeah that works for me! I'll make that change here. |
updated in 00b4477 thanks for the suggestion! |
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!
😬
Azure DevOps build link: https://dev.azure.com/lightgbm-ci/lightgbm-ci/_build/results?buildId=13407&view=logs&j=382e14e0-e893-5ccd-73ac-68042457c8d8 Refer to #5391. We have #5396 to fix this, but it's blocked by #5390, which is blocked by the need to switch to a new image for building wheels with a more recent version of glibc (#5390 (comment)). As that error message says, we have until September 30th to get this all done. I'll prioritize changing that image and start working on it today. |
This pull request has been automatically locked since there has not been any recent activity since it was closed. To start a new related discussion, open a new issue at https://github.com/microsoft/LightGBM/issues including a reference to this. |
Contributes to #3756.
Contributes to #3867.
Adds type hints on some methods in
Dataset
which don't currently have them.Notes for Reviewers
I'm beginning work on the "array-like" inputs in LightGBM's Python API, per #3756 (comment).
This is a first step towards that.