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
Add support for Path from pathlib. #114
Conversation
Yes. Support it everywhere... I was even thinking about actually storing the PosixPath instead of converting it to string. |
What's the benefit? I can imagine only two implementations:
But maybe I miss something important. |
I was thinking about supporting passing a Another reason would be to have a more robust file comparison. See #109, but I guess that is not worth the problem. Conclusion: you are right 😄 , just convert to string. |
|
It also can be a good thing to do, but I agree that not in this PR.
Hmm, I didn't think about
Yeah, I think it would be a good first step :-)
Ok. |
It looks like these failed tests didn't run before this PR on Windows. I assumed it by the number of tests:
I have added only one test. |
@schettino72 I've commited support for |
Perhaps it would be reasonable to do type checking for |
Sorry. No idea.
When it introduces file_dep add an example using pathlib. Then in other places (targets, ...) just mention that it also supports pathlib too.
go ahead 😄 Sorry I didnt review the code yet... and probably wont do that next week also 😓 |
I re-run the tests in an old commit just to double check. I dont want to debug that... lets just disable the test if strace not available OR it is on windows. |
thanks. one more thing. add your name in the AUTHORS file 😀 |
and an entry on CHANGES file |
file_dep=["123", Path("456"), PurePath("789")]) | ||
assert {"123","456", "789"} == my_task.file_dep | ||
|
||
def test_file_dep_must_be_string_or_path(self): |
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.
test_file_dep_str()
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.
Fixed
looks good. thanks. just need docs now. |
I'm already there 😉 I'll add info to |
@schettino72 thank you for review. |
thanks. squashed and merged. There was a typo in the docs, already fixed. |
def task_checker(): | ||
return {'actions': ["pyflakes sample.py"], | ||
'file_dep': ["sample.py"]} | ||
|
||
def task_checker_pathlib(): |
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.
actually I would prefer to have a separate example... to keep examples really simple.
But I merged anyway.
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.
I agree - it is a good thing to concentrate reader on one feature at a time. I can remove this example here and add a new section like pathlib support
with example which uses pathlib
both in file_dep
, targets
and CmdAction
.
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.
PR with whatever improvements are always welcome.
@schettino72 thank you for merging! |
To tell you the truth I dont care about this feature. I am worried it could have a negative effect on performance. And I dont know how I would implement that. Anyway if you want to give a try, go ahead :) |
Adding support for
Path
infile_dep
is quite easy. But clearly this is only the part of the problem: if someone (like me) usesPath
then he want to use them all other the place. It would be quite strange to pass them tofile_dep
as is but convert tostr
before passing intargets
for example. I think at leasttargets
should support them too and perhaps it would be not very bad idea to support them inCmdAction
.@schettino72 what do you think about it?