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] make Booster and Dataset 'handle' attributes private (fixes #5313) #5947

Merged
merged 3 commits into from
Jun 29, 2023

Conversation

jameslamb
Copy link
Collaborator

@jameslamb jameslamb commented Jun 27, 2023

Fixes #5313.

Removes handle attribute from the public API in the Python package, with the following changes:

  • Booster.handle -> Booster._handle
  • Dataset.handle -> Dataset._handle
  • _InnerPredictor.handle -> _InnerPredictor._handle

Why?

Making this implementation detail private allows changing it in the future without breaking user code.

@StrikerRUS originally recommended this, and I agree: #5313 (comment)

What about the R package?

Handles are already private there.

private$handle <- handle

private$handle <- handle

How impactful will this be?

I don't know for sure what uses cases are out there where people are relying on the handle attribute being public in the Python package. But I did a quick check of popular open source projects relying on lightgbm (https://www.wheelodex.org/projects/lightgbm/rdepends/) and didn't find any uses there:

@jameslamb jameslamb changed the title WIP: [python-package] make Booster and Dataset 'handle' attributes private (fixes #5313) [python-package] make Booster and Dataset 'handle' attributes private (fixes #5313) Jun 27, 2023
@jameslamb jameslamb marked this pull request as ready for review June 27, 2023 02:56
@jameslamb jameslamb requested a review from guolinke June 27, 2023 19:55
@jameslamb jameslamb mentioned this pull request Jun 28, 2023
60 tasks
@github-actions
Copy link

github-actions bot commented Oct 4, 2023

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 Oct 4, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[python-package] prefix all internal object names with "_"
2 participants