diff --git a/news/6207.bugfix.rst b/news/6207.bugfix.rst new file mode 100644 index 0000000000..5e251d99ca --- /dev/null +++ b/news/6207.bugfix.rst @@ -0,0 +1 @@ +Solve issue with quiet lock not writing the lock file #6207. diff --git a/pipenv/cli/command.py b/pipenv/cli/command.py index 9924e541d3..247672d811 100644 --- a/pipenv/cli/command.py +++ b/pipenv/cli/command.py @@ -344,7 +344,8 @@ def lock(ctx, state, **kwargs): clear=state.clear, pre=pre, pypi_mirror=state.pypi_mirror, - write=not state.quiet, + write=True, + quiet=state.quiet, categories=state.installstate.categories, ) diff --git a/pipenv/routines/lock.py b/pipenv/routines/lock.py index 78893b3077..ec12370cab 100644 --- a/pipenv/routines/lock.py +++ b/pipenv/routines/lock.py @@ -12,6 +12,7 @@ def do_lock( clear=False, pre=False, write=True, + quiet=False, pypi_mirror=None, categories=None, extra_pip_args=None, @@ -46,15 +47,15 @@ def do_lock( packages = project.get_pipfile_section(pipfile_category) if write: - # Alert the user of progress. - click.echo( - "{} {} {}".format( - click.style("Locking"), - click.style(f"[{pipfile_category}]", fg="yellow"), - click.style("dependencies..."), - ), - err=True, - ) + if not quiet: # Alert the user of progress. + click.echo( + "{} {} {}".format( + click.style("Locking"), + click.style(f"[{pipfile_category}]", fg="yellow"), + click.style("dependencies..."), + ), + err=True, + ) # Prune old lockfile category as new one will be created. with contextlib.suppress(KeyError): @@ -89,15 +90,16 @@ def do_lock( if write: lockfile.update({"_meta": project.get_lockfile_meta()}) project.write_lockfile(lockfile) - click.echo( - "{}".format( - click.style( - f"Updated Pipfile.lock ({project.get_lockfile_hash()})!", - bold=True, - ) - ), - err=True, - ) + if not quiet: + click.echo( + "{}".format( + click.style( + f"Updated Pipfile.lock ({project.get_lockfile_hash()})!", + bold=True, + ) + ), + err=True, + ) else: return lockfile