peek-python 25.0.5.post3__tar.gz → 25.0.6__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: peek-python
3
- Version: 25.0.5.post3
3
+ Version: 25.0.6
4
4
  Summary: peek - debugging and benchmarking made easy
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/peek
@@ -694,8 +694,29 @@ Of course, color and color_value may be specified in a peek.toml file, to make a
694
694
  > [!NOTE]
695
695
  >
696
696
  > The color and color_value attributes are only applied when using stdout as output.
697
- >
698
- > Colors can be ignored completely by using `peek.output = "stdout_nocolor`.
697
+ >
698
+ > Colors can be ignored completely by using `peek.output = "stdout_nocolor"`.
699
+
700
+ ------
701
+
702
+ Bonus feature
703
+
704
+ peek offers direct access to ANSI color escape sequences with `peek.ANSI.black`, `peek.ANSI.white`, `peek.ANSI.red`, `peek.ANSI.green`, `peek.ANSI.blue`, `peek.ANSI.cyan`, `peek.ANSI.magenta`, `peek.ANSI.yellow`, `peek.ANSI.light_black`, `peek.ANSI.light_white`, `peek.ANSI.light_red`, `peek.ANSI.light_green`, `peek.ANSI.light_blue`, `peek.ANSI.light_cyan`, `peek.ANSI.light_magenta`, `peek.ANSI.light_yellow` and `peek.reset`.
705
+
706
+ E.g.
707
+
708
+ ```
709
+ peek(repr(peek.ANSI.red))
710
+ ```
711
+
712
+ will show
713
+
714
+ ```
715
+ repr(peek.ANSI.red)='\x1b[1;31m'
716
+ ```
717
+
718
+ ------
719
+
699
720
 
700
721
  ## compact
701
722
  This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
@@ -1059,7 +1080,7 @@ You can also use peek.print (see below).
1059
1080
  > Of course, print_only can be put in a **peek.toml** file.
1060
1081
 
1061
1082
  # Use peek.print to use peek like print with extras
1062
- The method `peek.print` allows peek to be used as alternative to print. Note that `peek.print` applies the `color`, `context_separator`, `enabled`, `filter` and `output`, `show_delta` and `show_time`. It is also possible to redirect the output to as string with `as_str`.
1083
+ The method `peek.print` allows peek to be used as alternative to print. Note that `peek.print` applies the `color`, `context_separator`, `enabled`, `end`, `filter` and `output`, `separator_print`, `show_delta` and `show_time`. It is also possible to redirect the output to a string with `as_str`.
1063
1084
 
1064
1085
  So,
1065
1086
 
@@ -1071,21 +1092,19 @@ peek.print(f"{min(1, 2)=}", color="red", level=1)
1071
1092
 
1072
1093
  will print
1073
1094
 
1074
- ```
1095
+ ```
1075
1096
  min(1, 2)=1
1076
- ```
1097
+ ```
1077
1098
 
1078
1099
  in red, but only if peek.enabled is True (which is the default).
1079
1100
 
1080
- The `peek.print`() method applies the prefix, show_delta, show_line_number, show_time, show_ end attributes to the output.
1081
-
1082
1101
  In order to behave similar to print, `peek` has an extra attribute, `separator_print` (alias: `sepp`). This attribute (default " ") will be used when `peek.printing`.
1083
1102
  When calling `peek.print`, `sep` may be used instead. So
1084
1103
 
1085
- ```
1104
+ ```
1086
1105
  peek.sepp = "|"
1087
1106
  peek.print("test")
1088
- ```
1107
+ ```
1089
1108
 
1090
1109
  Has the same effect as
1091
1110
 
@@ -674,8 +674,29 @@ Of course, color and color_value may be specified in a peek.toml file, to make a
674
674
  > [!NOTE]
675
675
  >
676
676
  > The color and color_value attributes are only applied when using stdout as output.
677
- >
678
- > Colors can be ignored completely by using `peek.output = "stdout_nocolor`.
677
+ >
678
+ > Colors can be ignored completely by using `peek.output = "stdout_nocolor"`.
679
+
680
+ ------
681
+
682
+ Bonus feature
683
+
684
+ peek offers direct access to ANSI color escape sequences with `peek.ANSI.black`, `peek.ANSI.white`, `peek.ANSI.red`, `peek.ANSI.green`, `peek.ANSI.blue`, `peek.ANSI.cyan`, `peek.ANSI.magenta`, `peek.ANSI.yellow`, `peek.ANSI.light_black`, `peek.ANSI.light_white`, `peek.ANSI.light_red`, `peek.ANSI.light_green`, `peek.ANSI.light_blue`, `peek.ANSI.light_cyan`, `peek.ANSI.light_magenta`, `peek.ANSI.light_yellow` and `peek.reset`.
685
+
686
+ E.g.
687
+
688
+ ```
689
+ peek(repr(peek.ANSI.red))
690
+ ```
691
+
692
+ will show
693
+
694
+ ```
695
+ repr(peek.ANSI.red)='\x1b[1;31m'
696
+ ```
697
+
698
+ ------
699
+
679
700
 
680
701
  ## compact
681
702
  This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
@@ -1039,7 +1060,7 @@ You can also use peek.print (see below).
1039
1060
  > Of course, print_only can be put in a **peek.toml** file.
1040
1061
 
1041
1062
  # Use peek.print to use peek like print with extras
1042
- The method `peek.print` allows peek to be used as alternative to print. Note that `peek.print` applies the `color`, `context_separator`, `enabled`, `filter` and `output`, `show_delta` and `show_time`. It is also possible to redirect the output to as string with `as_str`.
1063
+ The method `peek.print` allows peek to be used as alternative to print. Note that `peek.print` applies the `color`, `context_separator`, `enabled`, `end`, `filter` and `output`, `separator_print`, `show_delta` and `show_time`. It is also possible to redirect the output to a string with `as_str`.
1043
1064
 
1044
1065
  So,
1045
1066
 
@@ -1051,21 +1072,19 @@ peek.print(f"{min(1, 2)=}", color="red", level=1)
1051
1072
 
1052
1073
  will print
1053
1074
 
1054
- ```
1075
+ ```
1055
1076
  min(1, 2)=1
1056
- ```
1077
+ ```
1057
1078
 
1058
1079
  in red, but only if peek.enabled is True (which is the default).
1059
1080
 
1060
- The `peek.print`() method applies the prefix, show_delta, show_line_number, show_time, show_ end attributes to the output.
1061
-
1062
1081
  In order to behave similar to print, `peek` has an extra attribute, `separator_print` (alias: `sepp`). This attribute (default " ") will be used when `peek.printing`.
1063
1082
  When calling `peek.print`, `sep` may be used instead. So
1064
1083
 
1065
- ```
1084
+ ```
1066
1085
  peek.sepp = "|"
1067
1086
  peek.print("test")
1068
- ```
1087
+ ```
1069
1088
 
1070
1089
  Has the same effect as
1071
1090
 
@@ -4,7 +4,7 @@
4
4
  # | .__/ \___| \___||_|\_\
5
5
  # |_| like print, but easy.
6
6
 
7
- __version__ = "25.0.5"
7
+ __version__ = "25.0.6"
8
8
 
9
9
  """
10
10
  See https://github.com/salabim/peek for details
@@ -140,6 +140,8 @@ class _Peek:
140
140
  "\033[0m": (),
141
141
  }
142
142
 
143
+ ANSI=types.SimpleNamespace(**_color_name_to_ANSI)
144
+
143
145
  codes = {}
144
146
 
145
147
  @staticmethod
@@ -294,7 +296,7 @@ class _Peek:
294
296
  def configure(self, **kwargs):
295
297
  self._attributes.update(_Peek.spec_to_attributes(**kwargs))
296
298
 
297
- def __getattr__(self, item, spec=False):
299
+ def __getattr__(self, item):
298
300
  item = _Peek.de_alias(item)
299
301
  if item in _Peek.name_default or item == "delta1":
300
302
  node = self
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: peek-python
3
- Version: 25.0.5.post3
3
+ Version: 25.0.6
4
4
  Summary: peek - debugging and benchmarking made easy
5
5
  Author-email: Ruud van der Ham <rt.van.der.ham@gmail.com>
6
6
  Project-URL: Homepage, https://github.com/salabim/peek
@@ -694,8 +694,29 @@ Of course, color and color_value may be specified in a peek.toml file, to make a
694
694
  > [!NOTE]
695
695
  >
696
696
  > The color and color_value attributes are only applied when using stdout as output.
697
- >
698
- > Colors can be ignored completely by using `peek.output = "stdout_nocolor`.
697
+ >
698
+ > Colors can be ignored completely by using `peek.output = "stdout_nocolor"`.
699
+
700
+ ------
701
+
702
+ Bonus feature
703
+
704
+ peek offers direct access to ANSI color escape sequences with `peek.ANSI.black`, `peek.ANSI.white`, `peek.ANSI.red`, `peek.ANSI.green`, `peek.ANSI.blue`, `peek.ANSI.cyan`, `peek.ANSI.magenta`, `peek.ANSI.yellow`, `peek.ANSI.light_black`, `peek.ANSI.light_white`, `peek.ANSI.light_red`, `peek.ANSI.light_green`, `peek.ANSI.light_blue`, `peek.ANSI.light_cyan`, `peek.ANSI.light_magenta`, `peek.ANSI.light_yellow` and `peek.reset`.
705
+
706
+ E.g.
707
+
708
+ ```
709
+ peek(repr(peek.ANSI.red))
710
+ ```
711
+
712
+ will show
713
+
714
+ ```
715
+ repr(peek.ANSI.red)='\x1b[1;31m'
716
+ ```
717
+
718
+ ------
719
+
699
720
 
700
721
  ## compact
701
722
  This attribute is used to specify the compact parameter for `pformat` (see the pprint documentation
@@ -1059,7 +1080,7 @@ You can also use peek.print (see below).
1059
1080
  > Of course, print_only can be put in a **peek.toml** file.
1060
1081
 
1061
1082
  # Use peek.print to use peek like print with extras
1062
- The method `peek.print` allows peek to be used as alternative to print. Note that `peek.print` applies the `color`, `context_separator`, `enabled`, `filter` and `output`, `show_delta` and `show_time`. It is also possible to redirect the output to as string with `as_str`.
1083
+ The method `peek.print` allows peek to be used as alternative to print. Note that `peek.print` applies the `color`, `context_separator`, `enabled`, `end`, `filter` and `output`, `separator_print`, `show_delta` and `show_time`. It is also possible to redirect the output to a string with `as_str`.
1063
1084
 
1064
1085
  So,
1065
1086
 
@@ -1071,21 +1092,19 @@ peek.print(f"{min(1, 2)=}", color="red", level=1)
1071
1092
 
1072
1093
  will print
1073
1094
 
1074
- ```
1095
+ ```
1075
1096
  min(1, 2)=1
1076
- ```
1097
+ ```
1077
1098
 
1078
1099
  in red, but only if peek.enabled is True (which is the default).
1079
1100
 
1080
- The `peek.print`() method applies the prefix, show_delta, show_line_number, show_time, show_ end attributes to the output.
1081
-
1082
1101
  In order to behave similar to print, `peek` has an extra attribute, `separator_print` (alias: `sepp`). This attribute (default " ") will be used when `peek.printing`.
1083
1102
  When calling `peek.print`, `sep` may be used instead. So
1084
1103
 
1085
- ```
1104
+ ```
1086
1105
  peek.sepp = "|"
1087
1106
  peek.print("test")
1088
- ```
1107
+ ```
1089
1108
 
1090
1109
  Has the same effect as
1091
1110
 
@@ -10,7 +10,7 @@ authors = [
10
10
  { name = "Ruud van der Ham", email = "rt.van.der.ham@gmail.com" },
11
11
  ]
12
12
  description = "peek - debugging and benchmarking made easy"
13
- version = "25.0.5.post3"
13
+ version = "25.0.6"
14
14
  readme = "README.md"
15
15
  requires-python = ">=3.7"
16
16
  dependencies = [