codeplain 0.3.11.dev6__py3-none-any.whl → 0.3.11.dev8__py3-none-any.whl

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.5
2
2
  Name: codeplain
3
- Version: 0.3.11.dev6
3
+ Version: 0.3.11.dev8
4
4
  Summary: Transform plain language specifications into working code
5
5
  License-File: LICENSE
6
6
  Classifier: Environment :: Console
@@ -8,7 +8,7 @@ Classifier: Intended Audience :: Developers
8
8
  Classifier: Operating System :: OS Independent
9
9
  Classifier: Topic :: Software Development :: Code Generators
10
10
  Requires-Python: ==3.11.*
11
- Requires-Dist: gitpython==3.1.55
11
+ Requires-Dist: gitpython==3.1.59
12
12
  Requires-Dist: mistletoe==1.6.0
13
13
  Requires-Dist: networkx==3.6.1
14
14
  Requires-Dist: python-frontmatter==1.3.0
@@ -13,7 +13,7 @@ partial_rendering.py,sha256=uzZc2j4d3pAXzfiHw_y1TK4yLRsLOb1Mm21570AGxJ8,13837
13
13
  path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
14
14
  plain2code.py,sha256=v8xBTv3mQjntpBTBJUvl5naGnSPFAzhEQTqpeRr40ow,18072
15
15
  plain2code_arguments.py,sha256=xMK-R13Vu005bHz3MUDY8F0Cf3ED9hCPqNsC6jGZmkk,17620
16
- plain2code_console.py,sha256=5N4_GIV8qE-2zvFh6qoOHhhsuwCF_3r7jG19S-YWtfk,5906
16
+ plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
17
17
  plain2code_events.py,sha256=rgDF5PDtNr_lEPvJmd1tIQXZrzwgzZW5b-_pykugqe4,1587
18
18
  plain2code_exceptions.py,sha256=rtFEQbs1ruzSlGXIGJZoZry9sjYzmhPKHiUQIECcbL0,2567
19
19
  plain2code_logger.py,sha256=YQ-ENYBHKXROVv6Q52xh7eXrFkj_3Lex__N9zfxlw9Y,5729
@@ -73,7 +73,7 @@ tests/test_arg_provenance.py,sha256=d_J7aCeHMXBpctBWTt60WU-I8pEKN7XRXRTJZZGCdo0,
73
73
  tests/test_change_detection.py,sha256=jH8SEhndX400DNqIKmcYLzxHqq9WFdgmuvY3XPq-ZFc,13534
74
74
  tests/test_cli_output.py,sha256=ZV2F1NNW4EiZvMNkhF9XUZH6bFJbddfkZof5qAFxe3Y,18885
75
75
  tests/test_conformance_fix_journal.py,sha256=olTeAuxXgFwQ8LSQyt0FqtBy9_XY_gK-Ei_pUuJ0C3M,10389
76
- tests/test_console_log_styles.py,sha256=63DQWiwWNhe_rMP70bW9DAB6-EPaqU3Wpwyh8eR09pc,4080
76
+ tests/test_console_log_styles.py,sha256=sxlhynMAP-kmqhBn1-pKvZXdCnlKSyCGJqwYKrh6sQ0,6468
77
77
  tests/test_distill_conformance_test_memory.py,sha256=Tftw9l-gLVwIU6QttY03h2VedvuFxpIsCmZIzvWfxMA,5481
78
78
  tests/test_dry_run_link_validation.py,sha256=ivvYXQPqUkQ8glbFyUrdCninCxF2mg-rAsDcfjcB7MM,2140
79
79
  tests/test_file_utils.py,sha256=R_ZIhrTtwlhHxgmbBtA8PFEU5-QB4Fi5skJ7PS2KzdU,3614
@@ -112,8 +112,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
112
112
  tui/state_handlers.py,sha256=zbUS_D9eU8qIwVpaxPEp9zL9bpg8gXsWNoUaqg9TLrQ,16664
113
113
  tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
114
114
  tui/widget_helpers.py,sha256=ToO9MV2bF2Rp-XMNcjIYclnB_qmgO5sLw4UtQ2CyTMg,6652
115
- codeplain-0.3.11.dev6.dist-info/METADATA,sha256=R_gO4pJAF6hs5De_MsOrekkrm9Eax1Wgfuf6aNNvLpw,7256
116
- codeplain-0.3.11.dev6.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
117
- codeplain-0.3.11.dev6.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
118
- codeplain-0.3.11.dev6.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
119
- codeplain-0.3.11.dev6.dist-info/RECORD,,
115
+ codeplain-0.3.11.dev8.dist-info/METADATA,sha256=9r_WxBfrgLF-5wU5-kRNUSJ7OWsN4O8bostaXLZc5N4,7256
116
+ codeplain-0.3.11.dev8.dist-info/WHEEL,sha256=zOwg4jB6zX2kU910N-cMawjivD6tO8NEWvE12je1bVk,87
117
+ codeplain-0.3.11.dev8.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
118
+ codeplain-0.3.11.dev8.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
119
+ codeplain-0.3.11.dev8.dist-info/RECORD,,
plain2code_console.py CHANGED
@@ -27,7 +27,7 @@ class Plain2CodeConsole(Console):
27
27
  DEBUG_STYLE = Style(color="purple")
28
28
 
29
29
  def __init__(self):
30
- super().__init__()
30
+ super().__init__(emoji=False)
31
31
  try:
32
32
  import tiktoken
33
33
 
@@ -66,9 +66,10 @@ class Plain2CodeConsole(Console):
66
66
  """
67
67
  logger.log(level, " ".join(map(str, args)), extra={"log_color": color})
68
68
  style = base_style + Style(color=color) if color else base_style
69
- # Log messages must render exactly as logged: don't interpret square brackets
70
- # in interpolated content (error texts, file names) as Rich markup, and don't
71
- # let the repr highlighter restyle brackets and numbers inside them.
69
+ # Messages must render exactly as logged and not pick its own styling:
70
+ # -- no Rich markup (via square brackets) in interpolated content (error texts, file names)
71
+ # -- no repr highlighter restyling brackets and numbers inside them.
72
+ # -- no emoji substitution, but it's set False in __init__, otherwise it won't reach renderables like Trees
72
73
  kwargs.setdefault("markup", False)
73
74
  kwargs.setdefault("highlight", False)
74
75
  super().print(*args, **kwargs, style=style)
@@ -70,14 +70,70 @@ class TestConsoleColorParam:
70
70
 
71
71
  assert handler.records[0].log_color is None
72
72
 
73
- def test_bracketed_error_text_prints_verbatim(self):
74
- console, handler = make_console_with_capture()
75
- console.quiet = False
73
+
74
+ class TestTerminalTextRendersVerbatim:
75
+ """
76
+ Message text must reach the terminal unchanged, and must not influence its own
77
+ styling. Colors are still applied but they are chosen by the call, never parsed
78
+ out of the text:
79
+ - Rich markup tags must not be interpreted
80
+ - the repr highlighter must not restyle brackets and numbers
81
+ - emoji shortcodes must not be substituted by glyphs
82
+ """
83
+
84
+ def test_markup_closing_tag_prints_verbatim(self):
85
+ console = Plain2CodeConsole()
76
86
  with console.capture() as capture:
77
- console.info("Error: [Errno 8] failed [/closing] tag", color=RETRY_COLOR)
78
- assert "[Errno 8]" in capture.get()
87
+ console.error("Error: [/closing] tag")
88
+ # markup=True raises MarkupError on an unmatched closing tag
79
89
  assert "[/closing]" in capture.get()
80
90
 
91
+ def test_markup_style_tag_prints_verbatim(self):
92
+ console = Plain2CodeConsole()
93
+ with console.capture() as capture:
94
+ console.error("Error: [bold]important text")
95
+ # markup=True silently consumes the tag and styles the rest
96
+ assert "[bold]" in capture.get()
97
+
98
+ def test_bracketed_number_prints_verbatim(self, monkeypatch):
99
+ # Rich emits no ANSI unless it believes it is writing to a colored terminal
100
+ # (FORCE_COLOR alone is not enough: TERM=dumb still resolves to no colors)
101
+ monkeypatch.setenv("FORCE_COLOR", "1")
102
+ monkeypatch.setenv("TERM", "xterm-256color")
103
+ console = Plain2CodeConsole()
104
+ assert console.color_system is not None # should fail test immediately if no colors
105
+
106
+ with console.capture() as capture:
107
+ console.error("Error: [Errno 8] failed")
108
+ # highlight=True breaks this up with colour codes
109
+ assert "[Errno 8]" in capture.get()
110
+
111
+ def test_concept_name_matching_emoji_prints_verbatim(self):
112
+ console = Plain2CodeConsole()
113
+ with console.capture() as capture:
114
+ console.error("Syntax error: Invalid concept: :Package:")
115
+ assert ":Package:" in capture.get()
116
+ assert "📦" not in capture.get()
117
+
118
+
119
+ class TestPrintHelpersDoNotSubstituteEmoji:
120
+ """
121
+ Same rule as TestTerminalTextRendersVerbatim, for the two helpers that bypass _log_and_print.
122
+ Only emoji is covered here, markup and highlighting still apply to them.
123
+ """
124
+
125
+ def test_print_list_does_not_substitute_emoji(self):
126
+ console = Plain2CodeConsole()
127
+ with console.capture() as capture:
128
+ console.print_list(["The :Package: is a concept"])
129
+ assert ":Package:" in capture.get()
130
+
131
+ def test_print_files_does_not_substitute_emoji_in_tree_labels(self):
132
+ console = Plain2CodeConsole()
133
+ with console.capture() as capture:
134
+ console.print_files("Files added:", "build", {":Package:.py": "x"})
135
+ assert ":Package:" in capture.get()
136
+
81
137
 
82
138
  class TestLoggingHandlerForwardsColor:
83
139
  """LoggingHandler must forward the log_color record attribute into LogMessageEmitted."""