Skip to content

Commit 52e5b70

Browse files
committed
progress bars to stdout
1 parent 7489857 commit 52e5b70

File tree

3 files changed

+11
-4
lines changed

3 files changed

+11
-4
lines changed

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

8+
## [1.1.5] - 2020-05-15
9+
10+
### Changed
11+
12+
- Changed progress bars to write to stdout on terminal and hide on non-terminal
13+
814
## [1.1.4] - 2020-05-15
915

1016
### Fixed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
name = "rich"
33
homepage = "https://github.com/willmcgugan/rich"
44
documentation = "https://rich.readthedocs.io/en/latest/"
5-
version = "1.1.4"
5+
version = "1.1.5"
66
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
77
authors = ["Will McGugan <willmcgugan@gmail.com>"]
88
license = "MIT"

rich/progress.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -324,7 +324,7 @@ class Progress:
324324
"""Renders an auto-updating progress bar(s).
325325
326326
Args:
327-
console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stderr.
327+
console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stdout.
328328
auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()`.
329329
refresh_per_second (int, optional): Number of times per second to refresh the progress information. Defaults to 10.
330330
speed_estimate_period: (float, optional): Period (in seconds) used to calculate the speed estimate. Defaults to 30.
@@ -345,7 +345,7 @@ def __init__(
345345
"[progress.percentage]{task.percentage:>3.0f}%",
346346
TimeRemainingColumn(),
347347
)
348-
self.console = console or Console(file=sys.stderr)
348+
self.console = console or Console(file=sys.stdout)
349349
self.auto_refresh = auto_refresh
350350
self.refresh_per_second = refresh_per_second
351351
self.speed_estimate_period = speed_estimate_period
@@ -400,7 +400,8 @@ def stop(self) -> None:
400400
self._refresh_thread.stop()
401401
self._refresh_thread = None
402402
self.refresh()
403-
self.console.line()
403+
if self.console.is_terminal:
404+
self.console.line()
404405
finally:
405406
self.console.show_cursor(True)
406407

0 commit comments

Comments
 (0)