Skip to content

Commit

Permalink
Do not use progress bars in non-interactive runs (#58)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaimergp authored Feb 27, 2024
1 parent 203e05c commit c6c7417
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
19 changes: 19 additions & 0 deletions news/58-progress-bars
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
### Enhancements

* Do not render extraction progress bars in non-interactive runs or when `CONDA_QUIET` is set to a truthy value. (#58)

### Bug fixes

* <news item>

### Deprecations

* <news item>

### Docs

* <news item>

### Other

* <news item>
7 changes: 6 additions & 1 deletion src/entry_point.py
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ def _constructor_extract_conda_pkgs(prefix, max_workers=None):
from concurrent.futures import ProcessPoolExecutor

import tqdm
from conda.auxlib.type_coercion import boolify
from conda.base.constants import CONDA_PACKAGE_EXTENSIONS
from conda_package_handling import api

Expand All @@ -155,7 +156,11 @@ def _constructor_extract_conda_pkgs(prefix, max_workers=None):
if pkg.endswith(ext):
fn = os.path.join(os.getcwd(), pkg)
flist.append(fn)
with tqdm.tqdm(total=len(flist), leave=False) as t:
if boolify(os.environ.get("CONDA_QUIET")):
disabled = True
else:
disabled = None # only for non-tty
with tqdm.tqdm(total=len(flist), leave=False, disable=disabled) as t:
for fn, _ in zip(flist, executor.map(api.extract, flist)):
t.set_description("Extracting : %s" % os.path.basename(fn))
t.update()
Expand Down

0 comments on commit c6c7417

Please sign in to comment.