codeplain 0.2.1__py3-none-any.whl → 0.2.3__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.
- {codeplain-0.2.1.dist-info → codeplain-0.2.3.dist-info}/METADATA +1 -1
- {codeplain-0.2.1.dist-info → codeplain-0.2.3.dist-info}/RECORD +8 -8
- plain2code.py +21 -2
- plain2code_arguments.py +0 -4
- plain2code_exceptions.py +4 -0
- {codeplain-0.2.1.dist-info → codeplain-0.2.3.dist-info}/WHEEL +0 -0
- {codeplain-0.2.1.dist-info → codeplain-0.2.3.dist-info}/entry_points.txt +0 -0
- {codeplain-0.2.1.dist-info → codeplain-0.2.3.dist-info}/licenses/LICENSE +0 -0
|
@@ -7,11 +7,11 @@ git_utils.py,sha256=gTRps6RIzJJkyy9amaDxP38FPoxYulZViBWr9V0IPQg,12414
|
|
|
7
7
|
hash_key.py,sha256=lMKgKpOhPeC4UpFf9e7eCNK20FEaDsXTCJ8j3eCWidE,837
|
|
8
8
|
memory_management.py,sha256=ABrM6PhOsalP_PBq2hCazQvQX9C5rpPHhgT35l68RM4,4357
|
|
9
9
|
module_renderer.py,sha256=LLjLb34phSJlF2YblwGDy5HKWVdi9mo57rr7s-Hj3RA,6261
|
|
10
|
-
plain2code.py,sha256=
|
|
11
|
-
plain2code_arguments.py,sha256=
|
|
10
|
+
plain2code.py,sha256=cIxPkxfxZkPlen5RG5H_rvo22sSGYQ9PnqSlw3ECVkY,9841
|
|
11
|
+
plain2code_arguments.py,sha256=PdQjd3orklrtlEyz7-Qdz_m2SvjZtZp6dmbkqXgglSU,11826
|
|
12
12
|
plain2code_console.py,sha256=-QorOFimS1AWYK7dmFqI3uhjc51cPtEWsaK4DhFibIw,4139
|
|
13
13
|
plain2code_events.py,sha256=5fPhpRzgJ02xWh0MXqrMv9A4curr2UOE68Y1uKlAcqQ,1347
|
|
14
|
-
plain2code_exceptions.py,sha256=
|
|
14
|
+
plain2code_exceptions.py,sha256=Y_2Jmv9rLE5xMqlzp_mDcAIIYsIfS0yR1U3scXUzUng,760
|
|
15
15
|
plain2code_logger.py,sha256=xSDGN8QAWpA4J6YKyj-kfNWSO-jBl0sfUCFRs7Tflf0,4067
|
|
16
16
|
plain2code_nodes.py,sha256=Om624mfb5MB1Z09c0Zqtb9G1gGkUY9x-v2hzAf3A2gw,3818
|
|
17
17
|
plain2code_read_config.py,sha256=QnpbW_Bi9LzDIOubM5x7fVXH1HgiFL3-5Oa_O1EUoE4,2449
|
|
@@ -74,8 +74,8 @@ tui/plain2code_tui.py,sha256=7agVU0NnaCuF1LuOSEmjx-XfEOQ6HHr1HlWe_b1Tses,11695
|
|
|
74
74
|
tui/state_handlers.py,sha256=HbjgaV-9xGhp3E-3X114zOqPkeNcCjT-R1PbVRxVdso,12674
|
|
75
75
|
tui/styles.css,sha256=Umm2TLePmywizZGV4Nd8UezZRiK5pFyibYRbpRvGqbs,3056
|
|
76
76
|
tui/widget_helpers.py,sha256=VJorEM2PjRBzN-jIDmKJPolFgo2d8-2NmTumgC5xeNo,5229
|
|
77
|
-
codeplain-0.2.
|
|
78
|
-
codeplain-0.2.
|
|
79
|
-
codeplain-0.2.
|
|
80
|
-
codeplain-0.2.
|
|
81
|
-
codeplain-0.2.
|
|
77
|
+
codeplain-0.2.3.dist-info/METADATA,sha256=8GLBTQ7B-NEivsGSRPlOqsTvnFnvkAsF6qyjAAQ0yRc,4278
|
|
78
|
+
codeplain-0.2.3.dist-info/WHEEL,sha256=WLgqFyCfm_KASv4WHyYy0P3pM_m7J5L9k2skdKLirC8,87
|
|
79
|
+
codeplain-0.2.3.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
|
|
80
|
+
codeplain-0.2.3.dist-info/licenses/LICENSE,sha256=wsFi5dpbJurnRNfBj8q2RCcF3ryrmdRIfxc3lPcmc4c,1069
|
|
81
|
+
codeplain-0.2.3.dist-info/RECORD,,
|
plain2code.py
CHANGED
|
@@ -17,7 +17,7 @@ from event_bus import EventBus
|
|
|
17
17
|
from module_renderer import ModuleRenderer
|
|
18
18
|
from plain2code_arguments import parse_arguments
|
|
19
19
|
from plain2code_console import console
|
|
20
|
-
from plain2code_exceptions import PlainSyntaxError
|
|
20
|
+
from plain2code_exceptions import MissingAPIKey, PlainSyntaxError
|
|
21
21
|
from plain2code_logger import (
|
|
22
22
|
CrashLogHandler,
|
|
23
23
|
IndentedFormatter,
|
|
@@ -161,6 +161,17 @@ def render(args, run_state: RunState, codeplain_api, event_bus: EventBus): # no
|
|
|
161
161
|
|
|
162
162
|
console.info(f"Rendering {args.filename} to target code.")
|
|
163
163
|
|
|
164
|
+
# Compute render range from either --render-range or --render-from
|
|
165
|
+
render_range = None
|
|
166
|
+
if args.render_range or args.render_from:
|
|
167
|
+
# Parse the plain file to get the plain_source for FRID extraction
|
|
168
|
+
_, plain_source, _ = plain_file.plain_file_parser(args.filename, template_dirs)
|
|
169
|
+
|
|
170
|
+
if args.render_range:
|
|
171
|
+
render_range = get_render_range(args.render_range, plain_source)
|
|
172
|
+
elif args.render_from:
|
|
173
|
+
render_range = get_render_range_from(args.render_from, plain_source)
|
|
174
|
+
|
|
164
175
|
codeplainAPI = codeplain_api.CodeplainAPI(args.api_key, console)
|
|
165
176
|
codeplainAPI.verbose = args.verbose
|
|
166
177
|
assert args.api is not None and args.api != "", "API URL is required"
|
|
@@ -169,7 +180,7 @@ def render(args, run_state: RunState, codeplain_api, event_bus: EventBus): # no
|
|
|
169
180
|
module_renderer = ModuleRenderer(
|
|
170
181
|
codeplainAPI,
|
|
171
182
|
args.filename,
|
|
172
|
-
|
|
183
|
+
render_range,
|
|
173
184
|
template_dirs,
|
|
174
185
|
args,
|
|
175
186
|
run_state,
|
|
@@ -208,6 +219,12 @@ def main():
|
|
|
208
219
|
run_state = RunState(spec_filename=args.filename, replay_with=args.replay_with)
|
|
209
220
|
|
|
210
221
|
try:
|
|
222
|
+
# Validate API key is present
|
|
223
|
+
if not args.api_key:
|
|
224
|
+
raise MissingAPIKey(
|
|
225
|
+
"API key is required. Please set the CODEPLAIN_API_KEY environment variable or provide it with the --api-key argument."
|
|
226
|
+
)
|
|
227
|
+
|
|
211
228
|
render(args, run_state, codeplain_api, event_bus)
|
|
212
229
|
except InvalidFridArgument as e:
|
|
213
230
|
console.error(f"Error rendering plain code: {str(e)}.\n")
|
|
@@ -237,6 +254,8 @@ def main():
|
|
|
237
254
|
console.error(f"Error rendering plain code: {str(e)}\n")
|
|
238
255
|
console.debug(f"Render ID: {run_state.render_id}")
|
|
239
256
|
dump_crash_logs(args)
|
|
257
|
+
except MissingAPIKey as e:
|
|
258
|
+
console.error(f"Missing API key: {str(e)}\n")
|
|
240
259
|
except Exception as e:
|
|
241
260
|
console.error(f"Error rendering plain code: {str(e)}\n")
|
|
242
261
|
console.debug(f"Render ID: {run_state.render_id}")
|
plain2code_arguments.py
CHANGED
|
@@ -5,10 +5,6 @@ import re
|
|
|
5
5
|
from plain2code_read_config import get_args_from_config
|
|
6
6
|
|
|
7
7
|
CODEPLAIN_API_KEY = os.getenv("CODEPLAIN_API_KEY")
|
|
8
|
-
if not CODEPLAIN_API_KEY:
|
|
9
|
-
CLAUDE_API_KEY = os.getenv("CLAUDE_API_KEY")
|
|
10
|
-
if not CLAUDE_API_KEY:
|
|
11
|
-
raise ValueError("CODEPLAIN_API_KEY or CLAUDE_API_KEY environment variable is not set")
|
|
12
8
|
|
|
13
9
|
|
|
14
10
|
DEFAULT_BUILD_FOLDER = "plain_modules"
|
plain2code_exceptions.py
CHANGED
|
File without changes
|
|
File without changes
|
|
File without changes
|