progress-table 2.0.0__tar.gz → 2.1.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (21) hide show
  1. {progress-table-2.0.0 → progress-table-2.1.0}/PKG-INFO +3 -3
  2. {progress-table-2.0.0 → progress-table-2.1.0}/README.md +2 -2
  3. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/__init__.py +1 -1
  4. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/v1/progress_table.py +28 -10
  5. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/v1/styles.py +15 -1
  6. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table.egg-info/PKG-INFO +3 -3
  7. {progress-table-2.0.0 → progress-table-2.1.0}/tests/test_examples_automated.py +2 -2
  8. {progress-table-2.0.0 → progress-table-2.1.0}/LICENSE.txt +0 -0
  9. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/v0/__init__.py +0 -0
  10. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/v0/progress_table.py +0 -0
  11. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/v0/symbols.py +0 -0
  12. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table/v1/__init__.py +0 -0
  13. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table.egg-info/PKG-INFO.sync-conflict-20240314-015933-NXTV2IO +0 -0
  14. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table.egg-info/SOURCES.txt +0 -0
  15. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table.egg-info/dependency_links.txt +0 -0
  16. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table.egg-info/requires.txt +0 -0
  17. {progress-table-2.0.0 → progress-table-2.1.0}/progress_table.egg-info/top_level.txt +0 -0
  18. {progress-table-2.0.0 → progress-table-2.1.0}/pyproject.toml +0 -0
  19. {progress-table-2.0.0 → progress-table-2.1.0}/setup.cfg +0 -0
  20. {progress-table-2.0.0 → progress-table-2.1.0}/setup.py +0 -0
  21. {progress-table-2.0.0 → progress-table-2.1.0}/tests/test_docs_automated.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: progress-table
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Display progress as a pretty table in the command line.
5
5
  Home-page: https://github.com/gahaalt/progress-table.git
6
6
  Author: Szymon Mikler
@@ -118,8 +118,8 @@ Progress Table works correctly in most consoles, but there are some exceptions:
118
118
  * Some consoles like `PyCharm Python Console` or `IDLE` don't support cursor movement.
119
119
  You can still use ProgressTable, but with `interactive=1` option. This mode displays only 1 progress bar at once.
120
120
 
121
- > By default `interactive=2`. You can change the default `interactive` by
122
- > setting `PTABLE_INTERACTIVE` environment variable, e.g. `PTABLE_INTERACTIVE=1`.
121
+ > By default `interactive=2`. You can change the default `interactive` with an argument when creating the table object
122
+ > or by setting `PTABLE_INTERACTIVE` environment variable, e.g. `PTABLE_INTERACTIVE=1`.
123
123
 
124
124
  ## Installation
125
125
 
@@ -97,8 +97,8 @@ Progress Table works correctly in most consoles, but there are some exceptions:
97
97
  * Some consoles like `PyCharm Python Console` or `IDLE` don't support cursor movement.
98
98
  You can still use ProgressTable, but with `interactive=1` option. This mode displays only 1 progress bar at once.
99
99
 
100
- > By default `interactive=2`. You can change the default `interactive` by
101
- > setting `PTABLE_INTERACTIVE` environment variable, e.g. `PTABLE_INTERACTIVE=1`.
100
+ > By default `interactive=2`. You can change the default `interactive` with an argument when creating the table object
101
+ > or by setting `PTABLE_INTERACTIVE` environment variable, e.g. `PTABLE_INTERACTIVE=1`.
102
102
 
103
103
  ## Installation
104
104
 
@@ -1,6 +1,6 @@
1
1
  # Copyright (c) 2022-2024 Szymon Mikler
2
2
 
3
- __version__ = "2.0.0"
3
+ __version__ = "2.1.0"
4
4
 
5
5
  from progress_table.v0.progress_table import ProgressTableV0
6
6
  from progress_table.v1 import styles
@@ -151,13 +151,15 @@ class ProgressTableV1:
151
151
  default_column_color: ColorFormat = None,
152
152
  default_column_alignment: str | None = None,
153
153
  default_column_aggregate: str | None = None,
154
+ default_header_color: ColorFormat = None,
154
155
  default_row_color: ColorFormat = None,
155
156
  pbar_show_throughput: bool = True,
156
157
  pbar_show_progress: bool = False,
157
158
  pbar_show_percents: bool = False,
158
159
  pbar_show_eta: bool = False,
159
160
  pbar_embedded: bool = True,
160
- pbar_color: ColorFormat = None,
161
+ pbar_color_filled: ColorFormat = None,
162
+ pbar_color_empty: ColorFormat = None,
161
163
  print_header_on_top: bool = True,
162
164
  print_header_every_n_rows: int = 30,
163
165
  custom_cell_format: Callable[[Any], str] | None = None,
@@ -215,6 +217,8 @@ class ProgressTableV1:
215
217
  Embedded version is more subtle, but does not prevent the current row from being displayed.
216
218
  If False, the progress bar covers the current row, preventing the user from seeing values
217
219
  that are being updated until the progress bar finishes. The default is True.
220
+ pbar_color_filled: Default color of the filled part of the progress bars.
221
+ pbar_color_empty: Default color of the empty part of the progress bars.
218
222
  print_header_every_n_rows: 30 by default. When table has a lot of rows, it can be useful to remind what the header is.
219
223
  If True, hedaer will be displayed periodically after the selected number of rows. 0 to supress.
220
224
  custom_cell_format: A function that defines how to get str value to display from a cell content.
@@ -240,6 +244,9 @@ class ProgressTableV1:
240
244
 
241
245
  assert isinstance(default_row_color, ColorFormatTuple), "Row color has to be a color format!" # type: ignore
242
246
  assert isinstance(default_column_color, ColorFormatTuple), "Column color has to be a color format!" # type: ignore
247
+ assert isinstance(default_header_color, ColorFormatTuple), "Header color has to be a color format!" # type: ignore
248
+ assert isinstance(pbar_color_filled, ColorFormatTuple)
249
+ assert isinstance(pbar_color_empty, ColorFormatTuple)
243
250
 
244
251
  # Default values for column and
245
252
  self.column_width = default_column_width
@@ -247,6 +254,7 @@ class ProgressTableV1:
247
254
  self.column_alignment = default_column_alignment
248
255
  self.column_aggregate = default_column_aggregate
249
256
  self.row_color = default_row_color
257
+ self.header_color = default_header_color
250
258
 
251
259
  # We are storing column configs
252
260
  self.column_widths: dict[str, int] = {}
@@ -282,7 +290,8 @@ class ProgressTableV1:
282
290
  self.pbar_show_percents: bool = pbar_show_percents
283
291
  self.pbar_show_eta: bool = pbar_show_eta
284
292
  self.pbar_embedded: bool = pbar_embedded
285
- self.pbar_color = pbar_color
293
+ self.pbar_color_filled = pbar_color_filled
294
+ self.pbar_color_empty = pbar_color_empty
286
295
 
287
296
  self.refresh_rate: int = refresh_rate
288
297
 
@@ -786,8 +795,10 @@ class ProgressTableV1:
786
795
 
787
796
  def _get_header(self):
788
797
  content = []
798
+ colors = self.column_colors if self.header_color is None else self._resolve_row_color_dict(self.header_color)
799
+
789
800
  for column in self.column_names:
790
- value = self._apply_cell_formatting(column, column, color=self.column_colors[column])
801
+ value = self._apply_cell_formatting(column, column, color=colors[column])
791
802
  content.append(value)
792
803
  s = "".join(["\r", self.table_style.vertical, self.table_style.vertical.join(content), self.table_style.vertical])
793
804
  return s
@@ -802,7 +813,8 @@ class ProgressTableV1:
802
813
  *range_args,
803
814
  position=None,
804
815
  static=False,
805
- color="",
816
+ color_filled="",
817
+ color_empty="",
806
818
  total=None,
807
819
  refresh_rate=None,
808
820
  description="",
@@ -819,7 +831,8 @@ class ProgressTableV1:
819
831
  position: Level of the progress bar. If not provided, it will be set automatically.
820
832
  static: If True, the progress bar will stick to the row with index given by position.
821
833
  If False, the position will be interpreted as the offset from the last row.
822
- color: Color of the progress bar.
834
+ color_filled: Color of the filled part of the progress bar.
835
+ color_empty: Color of the empty part of the progress bar.
823
836
  total: Total number of iterations. If not provided, it will be calculated from the length of the iterable.
824
837
  refresh_rate: The maximal number of times per second the progress bar will be refreshed.
825
838
  description: Custom description of the progress bar that will be shown as prefix.
@@ -850,7 +863,8 @@ class ProgressTableV1:
850
863
  total=total,
851
864
  position=position,
852
865
  static=static,
853
- color=color or self.pbar_color,
866
+ color_filled=color_filled or self.pbar_color_filled,
867
+ color_empty=color_empty or self.pbar_color_empty,
854
868
  description=description,
855
869
  show_throughput=show_throughput if show_throughput is not None else self.pbar_show_throughput,
856
870
  show_progress=show_progress if show_progress is not None else self.pbar_show_progress,
@@ -872,7 +886,8 @@ class TableProgressBar:
872
886
  *,
873
887
  table,
874
888
  total,
875
- color,
889
+ color_filled,
890
+ color_empty,
876
891
  position,
877
892
  static,
878
893
  description,
@@ -891,7 +906,8 @@ class TableProgressBar:
891
906
  self.position: int = position
892
907
  self.static: bool = static
893
908
 
894
- self.color: str = maybe_convert_to_colorama(color)
909
+ self.color_filled: str = maybe_convert_to_colorama(color_filled)
910
+ self.color_empty: str = maybe_convert_to_colorama(color_empty)
895
911
  self.table: ProgressTableV1 = table
896
912
  self.description: str = description
897
913
  self.show_throughput: bool = show_throughput
@@ -998,10 +1014,12 @@ class TableProgressBar:
998
1014
  [
999
1015
  self.table.table_style.vertical,
1000
1016
  infobar,
1001
- self.color,
1017
+ self.color_filled,
1002
1018
  filled_part,
1003
- Style.RESET_ALL if self.color else "",
1019
+ Style.RESET_ALL if self.color_filled else "",
1020
+ self.color_empty,
1004
1021
  empty_part,
1022
+ Style.RESET_ALL if self.color_empty else "",
1005
1023
  self.table.table_style.vertical,
1006
1024
  ]
1007
1025
  )
@@ -52,6 +52,13 @@ class PbarStyleNormal(PbarStyleBase):
52
52
  head = "◩"
53
53
 
54
54
 
55
+ class PbarStyleShort(PbarStyleBase):
56
+ name = "short"
57
+ filled = "▬"
58
+ empty = "▭"
59
+ head = "▬"
60
+
61
+
55
62
  class PbarStyleNormalClean(PbarStyleBase):
56
63
  name = "normal clean"
57
64
  filled = "■"
@@ -60,7 +67,7 @@ class PbarStyleNormalClean(PbarStyleBase):
60
67
 
61
68
 
62
69
  class PbarStyleCircle(PbarStyleBase):
63
- name = "cirlce"
70
+ name = "circle"
64
71
  filled = "●"
65
72
  empty = "○"
66
73
  head = "◉"
@@ -94,6 +101,13 @@ class PbarStyleEmbed(PbarStyleBase):
94
101
  head = ">"
95
102
 
96
103
 
104
+ class PbarStyleRich(PbarStyleBase):
105
+ name = "rich"
106
+ filled = "━"
107
+ empty = " "
108
+ head = "━"
109
+
110
+
97
111
  class PbarStyleNone(PbarStyleBase):
98
112
  name = "hidden"
99
113
  filled = " "
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: progress-table
3
- Version: 2.0.0
3
+ Version: 2.1.0
4
4
  Summary: Display progress as a pretty table in the command line.
5
5
  Home-page: https://github.com/gahaalt/progress-table.git
6
6
  Author: Szymon Mikler
@@ -118,8 +118,8 @@ Progress Table works correctly in most consoles, but there are some exceptions:
118
118
  * Some consoles like `PyCharm Python Console` or `IDLE` don't support cursor movement.
119
119
  You can still use ProgressTable, but with `interactive=1` option. This mode displays only 1 progress bar at once.
120
120
 
121
- > By default `interactive=2`. You can change the default `interactive` by
122
- > setting `PTABLE_INTERACTIVE` environment variable, e.g. `PTABLE_INTERACTIVE=1`.
121
+ > By default `interactive=2`. You can change the default `interactive` with an argument when creating the table object
122
+ > or by setting `PTABLE_INTERACTIVE` environment variable, e.g. `PTABLE_INTERACTIVE=1`.
123
123
 
124
124
  ## Installation
125
125
 
@@ -8,7 +8,7 @@ from io import StringIO
8
8
 
9
9
  EXPECTED_OUTPUTS = {
10
10
  "examples.training": "14af860a37118c16aec4604e5629e5ed",
11
- "examples.tictactoe": "056841a6cbf7456cd3daacbff356088a",
11
+ "examples.tictactoe": "378133fb7804a678282564d751068531",
12
12
  "examples.brown2d": "c0f37fdfcfc2db6ef465473c67c05d83",
13
13
  }
14
14
 
@@ -27,7 +27,7 @@ def capture_example_stdout(main_fn):
27
27
  # We will replace stdout with custom StringIO and check whether example stdout is as expected
28
28
  out_buffer = StringIO()
29
29
  sys.stdout = out_buffer
30
- main_fn(random_seed=42, **override_kwds)
30
+ main_fn(random_seed=42, sleep_duration=0, **override_kwds)
31
31
  sys.stdout = sys.__stdout__
32
32
  return out_buffer.getvalue()
33
33
 
File without changes
File without changes