Skip to content
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

Merged
merged 5 commits into from
Sep 3, 2022

Conversation

jameslamb
Copy link
Collaborator

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.

@jmoralez
Copy link
Collaborator

jmoralez commented Sep 2, 2022

WDYT about defining a type for the dataset handle like in

typedef void* DatasetHandle; /*!< \brief Handle of dataset. */

@jameslamb
Copy link
Collaborator Author

WDYT about defining a type for the dataset handle like in

Can you be more specific about what you're proposing for the Python side and what the benefit would be? I don't understand.

@jmoralez
Copy link
Collaborator

jmoralez commented Sep 2, 2022

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"

@jameslamb
Copy link
Collaborator Author

ah ok, so just for documentation purposes? Yeah that works for me! I'll make that change here.

@jameslamb
Copy link
Collaborator Author

updated in 00b4477

thanks for the suggestion!

Copy link
Collaborator

@jmoralez jmoralez left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks!

@jameslamb
Copy link
Collaborator Author

😬

This is a scheduled macOS-10.15 brownout. The macOS-10.15 environment is deprecated and will be removed on September 30th, 2022. For more details, see actions/runner-images#5583

image

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.

@jameslamb jameslamb merged commit c8712a9 into master Sep 3, 2022
@jameslamb jameslamb deleted the dataset-hints branch September 3, 2022 03:25
@jameslamb jameslamb mentioned this pull request Oct 7, 2022
40 tasks
@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Aug 19, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants