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

[IMPROVEMENT] Support pathlib Path #2222

Closed
obust opened this issue Dec 3, 2018 · 8 comments
Closed

[IMPROVEMENT] Support pathlib Path #2222

obust opened this issue Dec 3, 2018 · 8 comments

Comments

@obust
Copy link

obust commented Dec 3, 2018

Feature Request

All functions and methods taking a path as argument should support the pathlib Path type.
pathlib is the preferred API to handle paths in python 2.7+ (although there is no official PEP8 recommendation). It would be good to at support it and maybe even advertise it in the tutorials to display modern python usage.

The following functions fail when given a Path argument:

  • autotvm.callback.log_to_file(filepath)
  • autotvm.apply_history_best(filepath)
  • lib.export_library(filepath)
  • more ?
@tqchen tqchen changed the title Support pathlib Path [IMPROVEMENT] Support pathlib Path Dec 4, 2018
@tqchen
Copy link
Member

tqchen commented Dec 4, 2018

Thanks, @obust for the suggestion. Given that pathlib is not available in 2.7, we might need to be a bit mindful on backward compatibility, other than that, I to tag this as help wanted and anyone is welcomed to bring in this feature

@obust
Copy link
Author

obust commented Dec 4, 2018

Oh, you are right, it is not in the 2.7 standard library but is available through PyPI.
I guess there are two ways to go about it:

@tqchen
Copy link
Member

tqchen commented Dec 4, 2018

I think cast arguments to string is going to be easier for now

@tqchen
Copy link
Member

tqchen commented Dec 13, 2018

@obust would you like to act on this?

@obust
Copy link
Author

obust commented Dec 17, 2018

I don't have authorization to contribute PRs yet. Feel free to pick it up for now :)

@cchung100m
Copy link
Contributor

Hi @tqchen

Do we still need to cast the variable filepath to string type in following three class?

  • autotvm.callback.log_to_file(filepath)
  • autotvm.apply_history_best(filepath)
  • lib.export_library(filepath)

@tqchen
Copy link
Member

tqchen commented Sep 12, 2019

@cchung100m feel free to take over and send a PR

@tqchen
Copy link
Member

tqchen commented Sep 18, 2019

#3968

@tqchen tqchen closed this as completed Oct 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants