codeplain 0.3.13.dev46__py3-none-any.whl → 0.3.13.dev47__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.3.13.dev46.dist-info → codeplain-0.3.13.dev47.dist-info}/METADATA +1 -1
- {codeplain-0.3.13.dev46.dist-info → codeplain-0.3.13.dev47.dist-info}/RECORD +12 -12
- {codeplain-0.3.13.dev46.dist-info → codeplain-0.3.13.dev47.dist-info}/WHEEL +1 -1
- plain2code.py +1 -1
- plain2code_arguments.py +30 -0
- plain2code_state.py +6 -2
- tests/test_arg_provenance.py +20 -0
- tests/test_plain2code_state.py +5 -0
- tests/test_render_finished_report.py +1 -0
- tests/test_terminal_attachment.py +1 -0
- {codeplain-0.3.13.dev46.dist-info → codeplain-0.3.13.dev47.dist-info}/entry_points.txt +0 -0
- {codeplain-0.3.13.dev46.dist-info → codeplain-0.3.13.dev47.dist-info}/licenses/LICENSE +0 -0
|
@@ -12,15 +12,15 @@ metadata_utils.py,sha256=YO17o7IAma5TT1ZN0pTwrLVr_KxFQ8APv02KqKPpI5k,1641
|
|
|
12
12
|
module_renderer.py,sha256=OvIgAorSxGwrdTZcKy4hdmNgkdJGh6z6-VzzqrTlRHs,6966
|
|
13
13
|
partial_rendering.py,sha256=uzZc2j4d3pAXzfiHw_y1TK4yLRsLOb1Mm21570AGxJ8,13837
|
|
14
14
|
path_resolution.py,sha256=0tMqU0a1g4DYhTOp7QjLVSEkv_cgasb4NI1mK809dUM,2233
|
|
15
|
-
plain2code.py,sha256=
|
|
16
|
-
plain2code_arguments.py,sha256=
|
|
15
|
+
plain2code.py,sha256=vQ5qjPZ1KXbl4s-QZtyrVrqnE_tu7GrzhjjDM_hI4bU,21305
|
|
16
|
+
plain2code_arguments.py,sha256=7TS2P351jmmyi-l8QKCHG732O3TtQ0kh4qbh14_4oLw,18634
|
|
17
17
|
plain2code_console.py,sha256=YGBONkQtwZUkrjxTKhqcBoRzW0EmSfYHPH8P4_FM60I,6040
|
|
18
18
|
plain2code_events.py,sha256=rgDF5PDtNr_lEPvJmd1tIQXZrzwgzZW5b-_pykugqe4,1587
|
|
19
19
|
plain2code_exceptions.py,sha256=rtFEQbs1ruzSlGXIGJZoZry9sjYzmhPKHiUQIECcbL0,2567
|
|
20
20
|
plain2code_logger.py,sha256=YQ-ENYBHKXROVv6Q52xh7eXrFkj_3Lex__N9zfxlw9Y,5729
|
|
21
21
|
plain2code_nodes.py,sha256=IwjQqJxRSJKgP6eEnkYGy3VQHIyoazgkFxAEkxkjfJ8,4426
|
|
22
22
|
plain2code_read_config.py,sha256=D5CxnmTRjddupecWvstcUm0kIJWWzq5-Zmk6sU0wbIg,2235
|
|
23
|
-
plain2code_state.py,sha256=
|
|
23
|
+
plain2code_state.py,sha256=jIo4knKI99C1xkX1E_OaD3pdS9pczI2h9wofDjifMvE,3348
|
|
24
24
|
plain2code_telemetry.py,sha256=e4UCAoFklJMDWGQsL50i7nTLiOBy8gs86A0XO4WLgPo,4597
|
|
25
25
|
plain2code_utils.py,sha256=unOxuqSQRpwG8YF6uoQhnZ3ZSTJRIUCPLdJ-1lRZR5M,1534
|
|
26
26
|
plain_file.py,sha256=yzdHYBZye1UjI6K-vcod5u9hPqQ_zBQS050yypdmB3M,37614
|
|
@@ -72,7 +72,7 @@ standard_template_library/typescript-react-app-template.plain,sha256=DN5wEJcT8Zq
|
|
|
72
72
|
tests/__init__.py,sha256=Wk73Io62J15BtlLVIzxmASDWaaJkQLevS4BLK5LDAQg,16
|
|
73
73
|
tests/conftest.py,sha256=QZcp08htUlJGgmHDlRWFgsWXZ8o8IBWTD5QqJaUMlU8,790
|
|
74
74
|
tests/test_agent_tools.py,sha256=1WQjKlDd1kna5D4fvlLJ1o5DxyjW0wy-9tx8tRPv6Sw,7840
|
|
75
|
-
tests/test_arg_provenance.py,sha256=
|
|
75
|
+
tests/test_arg_provenance.py,sha256=kUqTcaCxMgbwY0-k_aHf40X1TN-5p7DhLHYrfcgX9N0,4252
|
|
76
76
|
tests/test_change_detection.py,sha256=jH8SEhndX400DNqIKmcYLzxHqq9WFdgmuvY3XPq-ZFc,13534
|
|
77
77
|
tests/test_cli_output.py,sha256=9yTk0pD2w6vkiSdSkYwneUmEtNqX4x64F6PzYShUEcw,19331
|
|
78
78
|
tests/test_conformance_fix_journal.py,sha256=olTeAuxXgFwQ8LSQyt0FqtBy9_XY_gK-Ei_pUuJ0C3M,10389
|
|
@@ -92,21 +92,21 @@ tests/test_logging_config_path_resolution.py,sha256=avz_ehRd18INwIXvAy1AwVzNNUz0
|
|
|
92
92
|
tests/test_partial_rendering.py,sha256=r0RUUd1pI4-2ZkRrM1j8_kUqv-70hrOGjuKBhZoRmH0,22758
|
|
93
93
|
tests/test_path_resolution.py,sha256=yQpd-Unq1lwNv0wkRPwVs5pDT8JmyyDgbpiTQsyt--Y,2615
|
|
94
94
|
tests/test_plain2code.py,sha256=lyb7iYK8XHu1dmTFh9Q31YgX0faNlCHiyI5M35VQwOg,3780
|
|
95
|
-
tests/test_plain2code_state.py,sha256=
|
|
95
|
+
tests/test_plain2code_state.py,sha256=O-sDt4F_lF6XtanWKWfh5IsNmDdfuJP_JoGagujzdfM,1440
|
|
96
96
|
tests/test_plain2code_utils.py,sha256=-W8a7FquMJQ_pTdBoBF1XprzNL2G555QhdtXCy6BDyQ,1237
|
|
97
97
|
tests/test_plain_modules.py,sha256=Fn3FeH-M4exnyFJDZzc9YWaLEfBmiqPH5TpiBT9jgAs,33033
|
|
98
98
|
tests/test_plainfile.py,sha256=wZ_PN4GULPWIpl_AK_r_6jkgtX0Ch8EHmN5IhX7huOE,11027
|
|
99
99
|
tests/test_plainfileparser.py,sha256=OY7dCilaUEeM4vAOShQYsZXKQzzUOi7nGYBaROu8Te8,26606
|
|
100
100
|
tests/test_plainspec.py,sha256=ng55E8ajrH2-gPC1p_QDIe_zXplPvoqHJ-d57UWKFTw,3577
|
|
101
101
|
tests/test_prepare_repositories_layout.py,sha256=PhJQLnHfjfjo6CTWoicyEKgL0_GtjwB2OKYAWSBVHtk,14638
|
|
102
|
-
tests/test_render_finished_report.py,sha256=
|
|
102
|
+
tests/test_render_finished_report.py,sha256=1OaL6S4LSRJ0JwDFu8HFEM02o4ZEn6oPtDpXPasNEVo,7670
|
|
103
103
|
tests/test_render_stop_reason.py,sha256=13oRRGrZKNyJFD2iDxDrD7VFvmobbtfAFcnKKdiCJT8,8550
|
|
104
104
|
tests/test_requires.py,sha256=6tnHYaKudxN-RiQjSFoi9nHe_x0ze3QF-f-j67zAE74,1250
|
|
105
105
|
tests/test_resolve_config_file.py,sha256=b87tDOvyzbsnE-QRWbZ97ou7NuyaAgskv-dbYBum31c,2830
|
|
106
106
|
tests/test_script_path_resolution.py,sha256=tiEqMevQRXr9YpfHN0xldOOQpLAUgnSqTzeZWkKHaUY,4156
|
|
107
107
|
tests/test_system_config.py,sha256=gH5qs9q4lh5CljAdz28HUrJzuKqCvkZherFuv7enMak,2787
|
|
108
108
|
tests/test_telemetry.py,sha256=LINvx1_Oz1OJ3ho2RcIcAA29IsNfUbkVVCbFaQcrBaA,8133
|
|
109
|
-
tests/test_terminal_attachment.py,sha256=
|
|
109
|
+
tests/test_terminal_attachment.py,sha256=mAJIKr0rXFytytZZm1XENV0T9kPYblhwkRTTtT4SzPs,10485
|
|
110
110
|
tests/test_tui_components.py,sha256=O_PB6z_Xt7YWebsD21b99PVgFtqq5c03lVtYytIT5Ps,6200
|
|
111
111
|
tests/test_tui_usage.py,sha256=sfiAGTpRrT3MRr0-8DH3qjuECSxjODVgwzrK_K3iPXs,7959
|
|
112
112
|
tests/test_usage_summary.py,sha256=Ps0kVzvmdZYeXrBR-cqkn3szTV5neYKs1PmmURngeIc,1079
|
|
@@ -122,8 +122,8 @@ tui/spinner.py,sha256=Ro6Gd9Przf-whuHqPRY6HwI0T57yJjyNPbhDbigZKZE,2471
|
|
|
122
122
|
tui/state_handlers.py,sha256=zbUS_D9eU8qIwVpaxPEp9zL9bpg8gXsWNoUaqg9TLrQ,16664
|
|
123
123
|
tui/styles.css,sha256=kiC7Og_2G1E7owoiZgV95-3_dSeQnsNj3qzaY04xkDg,6727
|
|
124
124
|
tui/widget_helpers.py,sha256=jitm2WHiKj-NVFL-hULxWzckPreRbUTl9OIZLN31-ek,6997
|
|
125
|
-
codeplain-0.3.13.
|
|
126
|
-
codeplain-0.3.13.
|
|
127
|
-
codeplain-0.3.13.
|
|
128
|
-
codeplain-0.3.13.
|
|
129
|
-
codeplain-0.3.13.
|
|
125
|
+
codeplain-0.3.13.dev47.dist-info/METADATA,sha256=-Nkssjf-eNdmYgy2-dwpAgZiQHPJtRCijnTGWDiitSE,7257
|
|
126
|
+
codeplain-0.3.13.dev47.dist-info/WHEEL,sha256=2iZrJkDIkeDh0k9SikKMqFuRP-ua6mb4Ir1AsER4BEw,87
|
|
127
|
+
codeplain-0.3.13.dev47.dist-info/entry_points.txt,sha256=oDZkBqu9WhtZApb_K6ia8-fn9aojwmAsgnKELceX5T4,46
|
|
128
|
+
codeplain-0.3.13.dev47.dist-info/licenses/LICENSE,sha256=pCeKgQ1mXE5OmNUuKOfOZh1T1vqkeCUxghE7N8qgnzc,11345
|
|
129
|
+
codeplain-0.3.13.dev47.dist-info/RECORD,,
|
plain2code.py
CHANGED
|
@@ -482,7 +482,7 @@ def main(): # noqa: C901
|
|
|
482
482
|
codeplainAPI = codeplain_api.CodeplainAPI(args.api_key, console)
|
|
483
483
|
codeplainAPI.api_url = args.api
|
|
484
484
|
|
|
485
|
-
run_state = RunState(spec_filename=args.filename, replay_with=args.replay_with)
|
|
485
|
+
run_state = RunState(spec_filename=args.filename, replay_with=args.replay_with, job_tag=args.job_tag)
|
|
486
486
|
|
|
487
487
|
# Without a terminal nobody can watch or drive the TUI, so render as --headless does:
|
|
488
488
|
# progress on stdout, and a non-zero exit status when the render stops.
|
plain2code_arguments.py
CHANGED
|
@@ -19,6 +19,7 @@ CODEPLAIN_API_KEY = os.getenv("CODEPLAIN_API_KEY")
|
|
|
19
19
|
DEFAULT_BUILD_FOLDER = "plain_modules"
|
|
20
20
|
DEFAULT_BUILD_DEST = "dist"
|
|
21
21
|
DEFAULT_CONFORMANCE_TESTS_DEST = "dist_conformance_tests"
|
|
22
|
+
MAX_JOB_TAG_LENGTH = 300
|
|
22
23
|
|
|
23
24
|
UNIT_TESTS_SCRIPT_NAME = "unittests_script"
|
|
24
25
|
CONFORMANCE_TESTS_SCRIPT_NAME = "conformance_tests_script"
|
|
@@ -76,6 +77,15 @@ def non_empty_string(s):
|
|
|
76
77
|
return s
|
|
77
78
|
|
|
78
79
|
|
|
80
|
+
def job_tag_string(s):
|
|
81
|
+
s = str(s)
|
|
82
|
+
if not s:
|
|
83
|
+
raise argparse.ArgumentTypeError("The job tag cannot be empty.")
|
|
84
|
+
if len(s) > MAX_JOB_TAG_LENGTH:
|
|
85
|
+
raise argparse.ArgumentTypeError(f"The job tag cannot be longer than {MAX_JOB_TAG_LENGTH} characters.")
|
|
86
|
+
return s
|
|
87
|
+
|
|
88
|
+
|
|
79
89
|
def frid_string(s):
|
|
80
90
|
"""Validate that the FRID is an integer."""
|
|
81
91
|
if not s:
|
|
@@ -363,6 +373,15 @@ def create_parser():
|
|
|
363
373
|
help="",
|
|
364
374
|
)
|
|
365
375
|
|
|
376
|
+
_add_arg(
|
|
377
|
+
parser,
|
|
378
|
+
"--job-tag",
|
|
379
|
+
type=job_tag_string,
|
|
380
|
+
default=None,
|
|
381
|
+
help=f"Tag sent to the server with every request and attached to the render's LangSmith traces "
|
|
382
|
+
f"(max {MAX_JOB_TAG_LENGTH} characters).",
|
|
383
|
+
)
|
|
384
|
+
|
|
366
385
|
_add_arg(
|
|
367
386
|
parser,
|
|
368
387
|
"--template-dir",
|
|
@@ -450,6 +469,15 @@ def create_parser():
|
|
|
450
469
|
return parser
|
|
451
470
|
|
|
452
471
|
|
|
472
|
+
def _validate_job_tag(args, parser):
|
|
473
|
+
# Values from config.yaml bypass argparse's type conversion, so validate them here.
|
|
474
|
+
if args.job_tag is not None:
|
|
475
|
+
try:
|
|
476
|
+
args.job_tag = job_tag_string(args.job_tag)
|
|
477
|
+
except argparse.ArgumentTypeError as e:
|
|
478
|
+
parser.error(f"--job-tag: {e}")
|
|
479
|
+
|
|
480
|
+
|
|
453
481
|
def parse_arguments(command_line: Optional[Sequence[str]] = None):
|
|
454
482
|
parser = create_parser()
|
|
455
483
|
|
|
@@ -496,6 +524,8 @@ def parse_arguments(command_line: Optional[Sequence[str]] = None):
|
|
|
496
524
|
if not args.log_to_file and args.argument_sources.get("log_file_name") != "default":
|
|
497
525
|
parser.error("--log-file-name cannot be used when --log-to-file is False.")
|
|
498
526
|
|
|
527
|
+
_validate_job_tag(args, parser)
|
|
528
|
+
|
|
499
529
|
if args.full_plain and args.dry_run:
|
|
500
530
|
parser.error("--full-plain and --dry-run are mutually exclusive")
|
|
501
531
|
|
plain2code_state.py
CHANGED
|
@@ -8,7 +8,7 @@ from typing import Optional
|
|
|
8
8
|
class RunState:
|
|
9
9
|
"""Contains information about the identifiable state of the rendering process."""
|
|
10
10
|
|
|
11
|
-
def __init__(self, spec_filename: str, replay_with: Optional[str] = None):
|
|
11
|
+
def __init__(self, spec_filename: str, replay_with: Optional[str] = None, job_tag: Optional[str] = None):
|
|
12
12
|
self.replay: bool = replay_with is not None
|
|
13
13
|
self.render_succeeded: bool = False
|
|
14
14
|
self.render_cancelled: bool = False
|
|
@@ -19,6 +19,7 @@ class RunState:
|
|
|
19
19
|
else:
|
|
20
20
|
self.render_id: str = str(uuid.uuid4())
|
|
21
21
|
self.spec_filename: str = spec_filename
|
|
22
|
+
self.job_tag: Optional[str] = job_tag
|
|
22
23
|
self.call_count: int = 0
|
|
23
24
|
self.unittest_batch_id: int = 0
|
|
24
25
|
self.render_time_accumulated: int = 0
|
|
@@ -70,9 +71,12 @@ class RunState:
|
|
|
70
71
|
self.last_render_start_timestamp = time.monotonic()
|
|
71
72
|
|
|
72
73
|
def to_dict(self):
|
|
73
|
-
|
|
74
|
+
state = {
|
|
74
75
|
"render_id": self.render_id,
|
|
75
76
|
"call_count": self.call_count,
|
|
76
77
|
"replay": self.replay,
|
|
77
78
|
"spec_filename": self.spec_filename,
|
|
78
79
|
}
|
|
80
|
+
if self.job_tag is not None:
|
|
81
|
+
state["job_tag"] = self.job_tag
|
|
82
|
+
return state
|
tests/test_arg_provenance.py
CHANGED
|
@@ -87,3 +87,23 @@ def test_mixed_sources(project):
|
|
|
87
87
|
assert srcs["conformance_tests_dest"] == "cli"
|
|
88
88
|
assert srcs["build_folder"] == "config"
|
|
89
89
|
assert srcs["build_dest"] == "default"
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
def test_job_tag_from_cli_and_config(project):
|
|
93
|
+
plain_file = os.path.join(project, "module.plain")
|
|
94
|
+
assert parse_arguments([plain_file]).job_tag is None
|
|
95
|
+
assert parse_arguments([plain_file, "--job-tag", "nightly"]).job_tag == "nightly"
|
|
96
|
+
|
|
97
|
+
(Path(project) / "config.yaml").write_text("job-tag: 123\n")
|
|
98
|
+
assert parse_arguments([plain_file]).job_tag == "123"
|
|
99
|
+
assert parse_arguments([plain_file, "--job-tag", "from_cli"]).job_tag == "from_cli"
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
def test_job_tag_too_long_is_rejected(project):
|
|
103
|
+
plain_file = os.path.join(project, "module.plain")
|
|
104
|
+
with pytest.raises(SystemExit):
|
|
105
|
+
parse_arguments([plain_file, "--job-tag", "x" * 301])
|
|
106
|
+
|
|
107
|
+
(Path(project) / "config.yaml").write_text(f"job-tag: {'x' * 301}\n")
|
|
108
|
+
with pytest.raises(SystemExit):
|
|
109
|
+
parse_arguments([plain_file])
|
tests/test_plain2code_state.py
CHANGED
|
@@ -34,3 +34,8 @@ def test_add_to_render_time_is_cumulative_across_segments():
|
|
|
34
34
|
run_state.add_to_render_time()
|
|
35
35
|
|
|
36
36
|
assert run_state.render_time_accumulated == 7
|
|
37
|
+
|
|
38
|
+
|
|
39
|
+
def test_to_dict_includes_job_tag_only_when_set():
|
|
40
|
+
assert "job_tag" not in RunState(spec_filename="x.plain").to_dict()
|
|
41
|
+
assert RunState(spec_filename="x.plain", job_tag="nightly").to_dict()["job_tag"] == "nightly"
|
|
File without changes
|
|
File without changes
|