-
Notifications
You must be signed in to change notification settings - Fork 47
feat: add skip_if_exists command to skip when paths exists #54
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
Conversation
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.
LGTM, thanks!
Released as 0.7.6. |
return any(not Path(path).exist() for path in paths) | ||
class SkipIfExistCommand(Command): | ||
def initialize_options(self): | ||
if not should_skip: |
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.
Shouldn't this be?
if not should_skip():
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.
Good catch, and all(Path(path).exist() for path in paths)
should improve readability
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.
Also wondering about the logic here.
Shouldn't the command be run (= not skipped) in case any of the files is missing?
Wondering whether this could be:
def should_run():
return any(not Path(path).exist() for path in paths)
And then:
if should_run():
self.command = CommandClass(self.distribution)
self.command.initialize_options()
else:
self.command = None
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.
OK I can submit a follow-up PR then.
Upstreaming from bqplot/bqplot#1235 to make source package skip the npm build step. Note, I cannot test this, because I don't know how. Since running pip install will fetch jupyter_packaging from pypi, how can I use my local dev install? cc @martinRenou