-
Notifications
You must be signed in to change notification settings - Fork 29
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 verbose flag #247
Add verbose flag #247
Conversation
Codecov Report
@@ Coverage Diff @@
## master #247 +/- ##
=======================================
Coverage 91.89% 91.90%
=======================================
Files 30 30
Lines 851 852 +1
Branches 113 113
=======================================
+ Hits 782 783 +1
Misses 49 49
Partials 20 20
Continue to review full report at Codecov.
|
pipcompilemulti/environment.py
Outdated
@@ -63,11 +63,23 @@ def create_lockfile(self): | |||
if sink_out_path and sink_out_path != self.outfile: | |||
original_in_file = self._read_infile() | |||
self._inject_sink() | |||
|
|||
verbose = True | |||
process = subprocess.Popen( | |||
self.pin_command, | |||
stdout=subprocess.PIPE, |
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 think the stdout is captured only for logging it later, so we could just set: stdout=None
(the subprocess inherits stdout) and then skip logging stdout in verbose mode
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.
Setting the stdout=None
here gives:
Traceback (most recent call last):
File "/Users/john/.virtualenvs/pip-compile-multi-demo/lib/python3.8/site-packages/pipcompilemulti/cli_v1.py", line 26, in cli
recompile()
File "/Users/john/.virtualenvs/pip-compile-multi-demo/lib/python3.8/site-packages/pipcompilemulti/actions.py", line 30, in recompile
compile_topologically(env_confs, deduplicator)
File "/Users/john/.virtualenvs/pip-compile-multi-demo/lib/python3.8/site-packages/pipcompilemulti/actions.py", line 39, in compile_topologically
if env.maybe_create_lockfile():
File "/Users/john/.virtualenvs/pip-compile-multi-demo/lib/python3.8/site-packages/pipcompilemulti/environment.py", line 50, in maybe_create_lockfile
self.create_lockfile()
File "/Users/john/.virtualenvs/pip-compile-multi-demo/lib/python3.8/site-packages/pipcompilemulti/environment.py", line 74, in create_lockfile
output = process.stdout.readline()
AttributeError: 'NoneType' object has no attribute 'readline'
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 you won't need to use process.stdout anymore as it should be sent to the terminal already
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.
Oh my that makes it simpler
Looking good. The outstanding steps:
|
Closing in favor of #251 |
Initial sketch of a solution to #153
These are my changes so far in their entirety (within
environment.py::Environment::create_lockfile()
):I haven't add the CLI argument for
verbose
as I'm not sure of the best way to hook this up; also I'm not sure if this solution is workable. I've tested it, and it works, but there may be drawbacks from doing this that I'm not aware of and I'm pretty sure that usingprint(output.strip())
here isn't correct (should it belogger.info()
orsys.stdout.write()
maybe?).Hopefully it's a starting point though?
It's passing
flake8
and I've run pytest: