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] allow to pass some params as pathlib.Path objects #4440

Merged
merged 4 commits into from
Jul 7, 2021

Conversation

StrikerRUS
Copy link
Collaborator

Allow to pass filenames as libpath.Path objects. Now path-like objects can be used in both named arguments and params dictionary (kwargs).

Contributes to #4416.

@StrikerRUS StrikerRUS marked this pull request as ready for review July 5, 2021 02:24
Copy link
Collaborator

@jameslamb jameslamb left a comment

Choose a reason for hiding this comment

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

If you are ok with supporting this expansion of the API and think the usability is worth the added maintenance burden, it's fine with me.

I left one very small suggestion about formatting but I'm approving because I'm ok with this being merged whether or not you agree with that suggestion.

tests/python_package_test/test_engine.py Outdated Show resolved Hide resolved
@StrikerRUS
Copy link
Collaborator Author

If you are ok with supporting this expansion of the API and think the usability is worth the added maintenance burden, it's fine with me.

I don't think it actually costs a lot us to support pathlib.Path as a valid type of parameter. All we need to do, is just add str() calls in some places.

What is important, it helps users easier switch between XGBoost and LightGBM because XGBoost has been supporting path-like params for some time.
https://github.com/dmlc/xgboost/blob/f937f514aafdc05515355e35158532d7e593ae74/python-package/xgboost/core.py#L713

tests/python_package_test/test_engine.py Outdated Show resolved Hide resolved
tests/python_package_test/test_engine.py Outdated Show resolved Hide resolved
@StrikerRUS StrikerRUS merged commit 90342e9 into master Jul 7, 2021
@StrikerRUS StrikerRUS deleted the pathlib branch July 7, 2021 11:31
@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 23, 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.

2 participants