Skip to content

Commit

Permalink
progress bars to stdout
Browse files Browse the repository at this point in the history
  • Loading branch information
willmcgugan committed May 15, 2020
1 parent 7489857 commit 52e5b70
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 4 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).

## [1.1.5] - 2020-05-15

### Changed

- Changed progress bars to write to stdout on terminal and hide on non-terminal

## [1.1.4] - 2020-05-15

### Fixed
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
name = "rich"
homepage = "https://github.com/willmcgugan/rich"
documentation = "https://rich.readthedocs.io/en/latest/"
version = "1.1.4"
version = "1.1.5"
description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal"
authors = ["Will McGugan <[email protected]>"]
license = "MIT"
Expand Down
7 changes: 4 additions & 3 deletions rich/progress.py
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ class Progress:
"""Renders an auto-updating progress bar(s).
Args:
console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stderr.
console (Console, optional): Optional Console instance. Default will an internal Console instance writing to stdout.
auto_refresh (bool, optional): Enable auto refresh. If disabled, you will need to call `refresh()`.
refresh_per_second (int, optional): Number of times per second to refresh the progress information. Defaults to 10.
speed_estimate_period: (float, optional): Period (in seconds) used to calculate the speed estimate. Defaults to 30.
Expand All @@ -345,7 +345,7 @@ def __init__(
"[progress.percentage]{task.percentage:>3.0f}%",
TimeRemainingColumn(),
)
self.console = console or Console(file=sys.stderr)
self.console = console or Console(file=sys.stdout)
self.auto_refresh = auto_refresh
self.refresh_per_second = refresh_per_second
self.speed_estimate_period = speed_estimate_period
Expand Down Expand Up @@ -400,7 +400,8 @@ def stop(self) -> None:
self._refresh_thread.stop()
self._refresh_thread = None
self.refresh()
self.console.line()
if self.console.is_terminal:
self.console.line()
finally:
self.console.show_cursor(True)

Expand Down

0 comments on commit 52e5b70

Please sign in to comment.