-
-
Notifications
You must be signed in to change notification settings - Fork 147
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
Allow showing the commands output #174
Conversation
This was the least intrusive approach but it means changing the only debug log call to info. |
Hmm, I'm not sold on this approach. I don't like the idea of introducing a new flag (I'm very conservative about this). What do you (and others) think about being able to just override the "silent" arg to session.install("requests", silent=False) |
Since nox is pytest inspired, have you though about allowing noxfiles to extend the available CLI flags? |
Also, to answer your question, with your suggestion you can either have it always on or off(the output). |
nox/command.py
Outdated
@@ -124,6 +124,9 @@ def run( | |||
|
|||
raise CommandFailed("Returned code {}".format(return_code)) | |||
|
|||
if output: | |||
logger.debug(output) |
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.
So the problem with using logger.debug
is that the output will actually differ from the normal operation because the logger appends nox >
to the begging of each log-line. I would prefer that this goes to stderr
just like the block above that sais if silent: sys.stderr.write(output)
.
Cool - this mostly looks good then, just one comment about using |
If we don't use logging we'll need to pass down the verbose flag to where we want verbose to be respected. |
Do you want the verbose flag passed down? |
I like the idea of an additional verbose level that doesn't include the
prefix. We already extend the logger to add the "success" level.
…On Sat, Mar 23, 2019, 7:23 AM Pedro Algarvio ***@***.***> wrote:
Do you want the verbose flag passed down?
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#174 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPUc1bGa6fIhdV6jV48wiWH9u2hlyd7ks5vZjjhgaJpZM4b3xR1>
.
|
Ok. I'll go down that route. |
It's already possible to override the silent flag in session.install (see #157). If the desired outcome is conditional reporting particularly in a CI context, the function in the noxfile could potentially handle this via extra arguments. For example, @nox.session(python='3.7')
def tests(session):
verbosity = True if 'verbose' in session.posargs else False
session.install('numpy', silent=verbosity) |
True, but you won't get any output unless the command fails. |
I will verify it and update you but I’m fairly sure setting the silent flag means that it doesn’t have to fail for it to be printed. This is precisely what I was looking for when I submitted the PR. It looks like there hasn’t been a release since then, so perhaps that’s all that needs to happen @theacodes |
@erinwild-rubikloud you stand correct, passing |
I'm glad we got you what you need, but it may still be useful to have a
verbose mode that immediately turn on output for all of our "silent"
commands. Is this something you'd still be interested in adding?
…On Thu, Apr 11, 2019, 8:18 AM Pedro Algarvio ***@***.***> wrote:
@erinwild-rubikloud <https://github.com/erinwild-rubikloud> you stand
correct, passing silent=False shows the pip install output.
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#174 (comment)>, or mute
the thread
<https://github.com/notifications/unsubscribe-auth/AAPUc6f8Tj9z_pLHBvm67SdltX3AZ4Rlks5vf1I9gaJpZM4b3xR1>
.
|
Sure, I'll get back to it once I get some spare time. |
510a0ff
to
8bd28f1
Compare
Ready for another set of eyes |
nox/__main__.py
Outdated
@@ -216,6 +218,10 @@ def main(): | |||
"--report", help="Output a report of all sessions to the given filename." | |||
) | |||
|
|||
secondary.add_argument( | |||
"--verbose", help="Show verbose output.", action="store_true" |
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.
Might be useful to mention here that it overrides the silent option.
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.
Yeah, please do expand on this. Something like "Shows the output of all commands run, regardless of the silent argument."
This looks mostly good except for the one comment. Can you add documentation as well? (If not, I can amend the PR to do it.) |
8bd28f1
to
4effcca
Compare
Applied suggestions. |
This LGTM, but I'm going to merge #187 and fix this up to use the new options pattern first. :) It'll make it in before the next release. |
4effcca
to
46def2d
Compare
Okay, @s0undt3ch. I've rebased this to work with the changes for #187. I do have an open question though: How does this handle cases such as |
46def2d
to
8df5da2
Compare
@theacodes Nothing is logged but the error is printed to stderr. Also, fixed conflict and rebased. |
Conflicts resolved again. |
Thank you thank you! |
Thank You! |
Refs #173