From a8d007848447c5228ba47992ce1e8517ebc1accc Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 08:30:27 -0400 Subject: [PATCH 01/12] Update deps --- .github/workflows/test.yml | 7 +++--- gleam.toml | 8 +++---- manifest.toml | 43 +++++++++++++++++----------------- test/python/python_parse.gleam | 4 ++-- test/python_parse_test.gleam | 32 ++++++++++++------------- 5 files changed, 48 insertions(+), 46 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6038a2d..fe5c793 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,13 +14,14 @@ jobs: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: - otp-version: "27.2.0" - gleam-version: "1.7.0" + otp-version: "27" + gleam-version: "1.12.0" rebar3-version: "3" - name: Install uv - uses: astral-sh/setup-uv@v3 + uses: astral-sh/setup-uv@v6 with: version: "latest" + python-version: "3.13" - run: gleam deps download - name: Run JavaScript tests run: gleam test --target javascript diff --git a/gleam.toml b/gleam.toml index 1377ece..c24f66f 100644 --- a/gleam.toml +++ b/gleam.toml @@ -6,12 +6,12 @@ licences = ["Apache-2.0"] repository = { type = "github", user = "JosephTLyons", repo = "lenient_parse" } [dependencies] -bigi = ">= 3.2.0 and < 4.0.0" +bigi = ">= 3.2.0 and < 5.0.0" gleam_deque = ">= 1.0.0 and < 2.0.0" -gleam_stdlib = ">= 0.52.0 and < 1.0.0" +gleam_stdlib = ">= 0.52.0 and < 2.0.0" [dev-dependencies] -gleam_json = ">= 2.3.0 and < 3.0.0" +gleam_json = ">= 2.3.0 and < 4.0.0" shellout = ">= 1.6.0 and < 2.0.0" simplifile = ">= 2.2.0 and < 3.0.0" -startest = ">= 0.6.0 and < 1.0.0" +startest = ">= 0.7.0 and < 1.0.0" diff --git a/manifest.toml b/manifest.toml index f8d0a76..4a57b3c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -3,35 +3,36 @@ packages = [ { name = "argv", version = "1.0.2", build_tools = ["gleam"], requirements = [], otp_app = "argv", source = "hex", outer_checksum = "BA1FF0929525DEBA1CE67256E5ADF77A7CDDFE729E3E3F57A5BDCAA031DED09D" }, - { name = "bigben", version = "1.0.0", build_tools = ["gleam"], requirements = ["birl", "gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "bigben", source = "hex", outer_checksum = "8E5A98FA6E981EEEF016C40F1CDFADA095927CAF6CAAA0C7E295EED02FC95947" }, - { name = "bigi", version = "3.2.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "bigi", source = "hex", outer_checksum = "FB1263FCF052C8A8331965C91688D91D79C158ED01549B9E6F1FD866DA90EAA4" }, + { name = "bigben", version = "1.0.1", build_tools = ["gleam"], requirements = ["birl", "gleam_erlang", "gleam_otp", "gleam_stdlib"], otp_app = "bigben", source = "hex", outer_checksum = "190E489610A80D76C48BACC75EB8314BD184FF0220AB0F251ABE760B993B91BB" }, + { name = "bigi", version = "4.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "bigi", source = "hex", outer_checksum = "1B95328C598546D86132A06B84202C1F4FFA9D32EE4D680763C0309861CB6A4A" }, { name = "birl", version = "1.8.0", build_tools = ["gleam"], requirements = ["gleam_regexp", "gleam_stdlib", "ranger"], otp_app = "birl", source = "hex", outer_checksum = "2AC7BA26F998E3DFADDB657148BD5DDFE966958AD4D6D6957DD0D22E5B56C400" }, - { name = "exception", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "F5580D584F16A20B7FCDCABF9E9BE9A2C1F6AC4F9176FA6DD0B63E3B20D450AA" }, - { name = "filepath", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "67A6D15FB39EEB69DD31F8C145BB5A421790581BD6AA14B33D64D5A55DBD6587" }, - { name = "gleam_community_ansi", version = "1.4.2", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "479DEDC748D08B310C9FEB9C4CBEC46B95C874F7F4F2844304D6D20CA78A8BB5" }, - { name = "gleam_community_colour", version = "1.4.1", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "386CB9B01B33371538672EEA8A6375A0A0ADEF41F17C86DDCB81C92AD00DA610" }, + { name = "exception", version = "2.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "exception", source = "hex", outer_checksum = "329D269D5C2A314F7364BD2711372B6F2C58FA6F39981572E5CA68624D291F8C" }, + { name = "filepath", version = "1.1.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "filepath", source = "hex", outer_checksum = "B06A9AF0BF10E51401D64B98E4B627F1D2E48C154967DA7AF4D0914780A6D40A" }, + { name = "gleam_community_ansi", version = "1.4.3", build_tools = ["gleam"], requirements = ["gleam_community_colour", "gleam_regexp", "gleam_stdlib"], otp_app = "gleam_community_ansi", source = "hex", outer_checksum = "8A62AE9CC6EA65BEA630D95016D6C07E4F9973565FA3D0DE68DC4200D8E0DD27" }, + { name = "gleam_community_colour", version = "2.0.2", build_tools = ["gleam"], requirements = ["gleam_json", "gleam_stdlib"], otp_app = "gleam_community_colour", source = "hex", outer_checksum = "E34DD2C896AC3792151EDA939DA435FF3B69922F33415ED3C4406C932FBE9634" }, { name = "gleam_deque", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_deque", source = "hex", outer_checksum = "64D77068931338CF0D0CB5D37522C3E3CCA7CB7D6C5BACB41648B519CC0133C7" }, - { name = "gleam_erlang", version = "0.33.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "A1D26B80F01901B59AABEE3475DD4C18D27D58FA5C897D922FCB9B099749C064" }, - { name = "gleam_javascript", version = "0.13.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "F98328FCF573DA6F3A35D7F6CB3F9FF19FD5224CCBA9151FCBEAA0B983AF2F58" }, - { name = "gleam_json", version = "2.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "C55C5C2B318533A8072D221C5E06E5A75711C129E420DD1CE463342106012E5D" }, - { name = "gleam_otp", version = "0.16.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "FA0EB761339749B4E82D63016C6A18C4E6662DA05BAB6F1346F9AF2E679E301A" }, - { name = "gleam_regexp", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "A3655FDD288571E90EE9C4009B719FEF59FA16AFCDF3952A76A125AF23CF1592" }, - { name = "gleam_stdlib", version = "0.52.0", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "50703862DF26453B277688FFCDBE9DD4AC45B3BD9742C0B370DB62BC1629A07D" }, + { name = "gleam_erlang", version = "1.3.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_erlang", source = "hex", outer_checksum = "1124AD3AA21143E5AF0FC5CF3D9529F6DB8CA03E43A55711B60B6B7B3874375C" }, + { name = "gleam_javascript", version = "1.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_javascript", source = "hex", outer_checksum = "EF6C77A506F026C6FB37941889477CD5E4234FCD4337FF0E9384E297CB8F97EB" }, + { name = "gleam_json", version = "3.0.2", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_json", source = "hex", outer_checksum = "874FA3C3BB6E22DD2BB111966BD40B3759E9094E05257899A7C08F5DE77EC049" }, + { name = "gleam_otp", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_erlang", "gleam_stdlib"], otp_app = "gleam_otp", source = "hex", outer_checksum = "7987CBEBC8060B88F14575DEF546253F3116EBE2A5DA6FD82F38243FCE97C54B" }, + { name = "gleam_regexp", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_regexp", source = "hex", outer_checksum = "9C215C6CA84A5B35BB934A9B61A9A306EC743153BE2B0425A0D032E477B062A9" }, + { name = "gleam_stdlib", version = "0.62.1", build_tools = ["gleam"], requirements = [], otp_app = "gleam_stdlib", source = "hex", outer_checksum = "0080706D3A5A9A36C40C68481D1D231D243AF602E6D2A2BE67BA8F8F4DFF45EC" }, + { name = "gleam_time", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_time", source = "hex", outer_checksum = "DCDDC040CE97DA3D2A925CDBBA08D8A78681139745754A83998641C8A3F6587E" }, { name = "gleam_yielder", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "gleam_yielder", source = "hex", outer_checksum = "8E4E4ECFA7982859F430C57F549200C7749823C106759F4A19A78AEA6687717A" }, - { name = "glint", version = "1.2.0", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "EA4B47B5A6147CA524AE81862EE1BE1C5A194757B26897233BD26BD3F7A54930" }, + { name = "glint", version = "1.2.1", build_tools = ["gleam"], requirements = ["gleam_community_ansi", "gleam_community_colour", "gleam_stdlib", "snag"], otp_app = "glint", source = "hex", outer_checksum = "2214C7CEFDE457CEE62140C3D4899B964E05236DA74E4243DFADF4AF29C382BB" }, { name = "ranger", version = "1.4.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_yielder"], otp_app = "ranger", source = "hex", outer_checksum = "C8988E8F8CDBD3E7F4D8F2E663EF76490390899C2B2885A6432E942495B3E854" }, - { name = "shellout", version = "1.6.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "E2FCD18957F0E9F67E1F497FC9FF57393392F8A9BAEAEA4779541DE7A68DD7E0" }, - { name = "simplifile", version = "2.2.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0DFABEF7DC7A9E2FF4BB27B108034E60C81BEBFCB7AB816B9E7E18ED4503ACD8" }, + { name = "shellout", version = "1.7.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "shellout", source = "hex", outer_checksum = "1BDC03438FEB97A6AF3E396F4ABEB32BECF20DF2452EC9A8C0ACEB7BDDF70B14" }, + { name = "simplifile", version = "2.3.0", build_tools = ["gleam"], requirements = ["filepath", "gleam_stdlib"], otp_app = "simplifile", source = "hex", outer_checksum = "0A868DAC6063D9E983477981839810DC2E553285AB4588B87E3E9C96A7FB4CB4" }, { name = "snag", version = "1.1.0", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "snag", source = "hex", outer_checksum = "7E9F06390040EB5FAB392CE642771484136F2EC103A92AE11BA898C8167E6E17" }, - { name = "startest", version = "0.6.0", build_tools = ["gleam"], requirements = ["argv", "bigben", "birl", "exception", "gleam_community_ansi", "gleam_erlang", "gleam_javascript", "gleam_regexp", "gleam_stdlib", "glint", "simplifile", "tom"], otp_app = "startest", source = "hex", outer_checksum = "58BFAB468D588D83720A678138EAF47B3F8F84CE19910EAFFB2FC5D0F48F046A" }, - { name = "tom", version = "1.1.1", build_tools = ["gleam"], requirements = ["gleam_stdlib"], otp_app = "tom", source = "hex", outer_checksum = "0910EE688A713994515ACAF1F486A4F05752E585B9E3209D8F35A85B234C2719" }, + { name = "startest", version = "0.7.0", build_tools = ["gleam"], requirements = ["argv", "bigben", "birl", "exception", "gleam_community_ansi", "gleam_erlang", "gleam_javascript", "gleam_regexp", "gleam_stdlib", "glint", "simplifile", "tom"], otp_app = "startest", source = "hex", outer_checksum = "71B9CB82C4B8779A4BD54C7151DF7D0B0F778D0DDE805B782B44EFA7BA8F50DA" }, + { name = "tom", version = "2.0.0", build_tools = ["gleam"], requirements = ["gleam_stdlib", "gleam_time"], otp_app = "tom", source = "hex", outer_checksum = "74D0C5A3761F7A7D06994755D4D5AD854122EF8E9F9F76A3E7547606D8C77091" }, ] [requirements] -bigi = { version = ">= 3.2.0 and < 4.0.0" } +bigi = { version = ">= 3.2.0 and < 5.0.0" } gleam_deque = { version = ">= 1.0.0 and < 2.0.0" } -gleam_json = { version = ">= 2.3.0 and < 3.0.0" } -gleam_stdlib = { version = ">= 0.52.0 and < 1.0.0" } +gleam_json = { version = ">= 2.3.0 and < 4.0.0" } +gleam_stdlib = { version = ">= 0.52.0 and < 2.0.0" } shellout = { version = ">= 1.6.0 and < 2.0.0" } simplifile = { version = ">= 2.2.0 and < 3.0.0" } -startest = { version = ">= 0.6.0 and < 1.0.0" } +startest = { version = ">= 0.7.0 and < 1.0.0" } diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 2b289e0..23fb307 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -1,4 +1,4 @@ -import gleam/dynamic +import gleam/dynamic/decode import gleam/json import gleam/list import python/python_error.{type PythonError, ValueError} @@ -47,7 +47,7 @@ fn parse( shellout.command(run: "uv", with: arguments, in: ".", opt: []) let assert Ok(parsed_strings) = - json.decode(output_json_string, dynamic.list(of: dynamic.string)) + json.parse(output_json_string, decode.list(of: decode.string)) parsed_strings |> list.map(fn(value) { diff --git a/test/python_parse_test.gleam b/test/python_parse_test.gleam index a7b9319..7dd52a5 100644 --- a/test/python_parse_test.gleam +++ b/test/python_parse_test.gleam @@ -36,17 +36,17 @@ pub fn check_against_python_tests() { } Ok(output), Error(python_error) -> { panic as form_panic_message( - input_printable_text, - output |> float.to_string, - python_error.message, - ) + input_printable_text, + output |> float.to_string, + python_error.message, + ) } Error(output), Ok(python_output) -> { panic as form_panic_message( - input_printable_text, - output |> helpers.error_to_string, - python_output, - ) + input_printable_text, + output |> helpers.error_to_string, + python_output, + ) } } @@ -94,17 +94,17 @@ pub fn check_against_python_tests() { } Ok(output), Error(python_error) -> { panic as form_panic_message( - input_printable_text, - output |> int.to_string, - python_error.message, - ) + input_printable_text, + output |> int.to_string, + python_error.message, + ) } Error(output), Ok(python_output) -> { panic as form_panic_message( - input_printable_text, - output |> helpers.error_to_string, - python_output, - ) + input_printable_text, + output |> helpers.error_to_string, + python_output, + ) } } From 98960f1a182853028aeda4de987ced99c9225a66 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 15:39:25 -0400 Subject: [PATCH 02/12] Bump OTP --- .github/workflows/test.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index fe5c793..fe3fd81 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -14,7 +14,7 @@ jobs: - uses: actions/checkout@v4 - uses: erlef/setup-beam@v1 with: - otp-version: "27" + otp-version: "28" gleam-version: "1.12.0" rebar3-version: "3" - name: Install uv From 1a0485c9aeeb4631042c77229618ed2eac894648 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 16:12:13 -0400 Subject: [PATCH 03/12] Improve error logging when shellout receives bad data --- test/python/python_parse.gleam | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 23fb307..3b36401 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -1,4 +1,6 @@ import gleam/dynamic/decode +import gleam/int +import gleam/io import gleam/json import gleam/list import python/python_error.{type PythonError, ValueError} @@ -43,17 +45,25 @@ fn parse( input_json_string, ] - let assert Ok(output_json_string) = - shellout.command(run: "uv", with: arguments, in: ".", opt: []) - - let assert Ok(parsed_strings) = - json.parse(output_json_string, decode.list(of: decode.string)) + case shellout.command(run: "uv", with: arguments, in: ".", opt: []) { + Error(error) -> { + io.print_error("Error code: " <> int.to_string(error.0)) + io.print_error("Error message: " <> error.1) + io.print_error("With data...") + io.print_error(input_json_string) + panic as "Shellout received bad data" + } + Ok(output_json_string) -> { + let assert Ok(parsed_strings) = + json.parse(output_json_string, decode.list(of: decode.string)) - parsed_strings - |> list.map(fn(value) { - case value { - "ValueError: " <> error_message -> Error(ValueError(error_message)) - _ -> Ok(value) + parsed_strings + |> list.map(fn(value) { + case value { + "ValueError: " <> error_message -> Error(ValueError(error_message)) + _ -> Ok(value) + } + }) } - }) + } } From af14d2ea3a738e46c2dd4e47a751fd6aa5f97668 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 16:17:58 -0400 Subject: [PATCH 04/12] Check for missing executables --- test/python/python_parse.gleam | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 3b36401..8d594d2 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -45,6 +45,22 @@ fn parse( input_json_string, ] + case shellout.which("uv") { + Error(error) -> { + io.print_error(error) + panic as "uv was not found" + } + Ok(_) -> Nil + } + + case shellout.which("python") { + Error(error) -> { + io.print_error(error) + panic as "python was not found" + } + Ok(_) -> Nil + } + case shellout.command(run: "uv", with: arguments, in: ".", opt: []) { Error(error) -> { io.print_error("Error code: " <> int.to_string(error.0)) From 5d7fd9f9e5a122d4238bb5d759a8ed9e88742b84 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 16:29:19 -0400 Subject: [PATCH 05/12] Add more debug logging --- test/python/python_parse.gleam | 34 ++++++++++++++++++++++------------ 1 file changed, 22 insertions(+), 12 deletions(-) diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 8d594d2..ec48ad8 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -61,25 +61,35 @@ fn parse( Ok(_) -> Nil } - case shellout.command(run: "uv", with: arguments, in: ".", opt: []) { + let output_json_string = case + shellout.command(run: "uv", with: arguments, in: ".", opt: []) + { Error(error) -> { io.print_error("Error code: " <> int.to_string(error.0)) io.print_error("Error message: " <> error.1) - io.print_error("With data...") + io.print_error("With input_json_string...") io.print_error(input_json_string) panic as "Shellout received bad data" } - Ok(output_json_string) -> { - let assert Ok(parsed_strings) = - json.parse(output_json_string, decode.list(of: decode.string)) + Ok(output_json_string) -> output_json_string + } - parsed_strings - |> list.map(fn(value) { - case value { - "ValueError: " <> error_message -> Error(ValueError(error_message)) - _ -> Ok(value) - } - }) + let parsed_strings = case + json.parse(output_json_string, decode.list(of: decode.string)) + { + Error(_) -> { + io.print_error("With json string...") + io.print_error(output_json_string) + panic as "output_json_string failed to decode" } + Ok(parsed_strings) -> parsed_strings } + + parsed_strings + |> list.map(fn(value) { + case value { + "ValueError: " <> error_message -> Error(ValueError(error_message)) + _ -> Ok(value) + } + }) } From fe76e32e08910176fd6a26bf3e480fea649404cb Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 16:34:25 -0400 Subject: [PATCH 06/12] More debugging --- test/data.gleam | 2 +- test/python/python_parse.gleam | 12 ++++++------ 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/test/data.gleam b/test/data.gleam index 6646b56..0b5202b 100644 --- a/test/data.gleam +++ b/test/data.gleam @@ -18,7 +18,7 @@ pub fn integer_test_data() -> List(IntegerTestData) { // To prevent error code 7 (argument list too long) when passing large datasets // to the Python programs, we divide the data into smaller lists. -const test_data_chunk_size = 200 +const test_data_chunk_size = 100 pub fn python_processed_float_data() { let float_test_data = float_test_data() diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index ec48ad8..1f2e8b6 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -65,10 +65,10 @@ fn parse( shellout.command(run: "uv", with: arguments, in: ".", opt: []) { Error(error) -> { - io.print_error("Error code: " <> int.to_string(error.0)) - io.print_error("Error message: " <> error.1) - io.print_error("With input_json_string...") - io.print_error(input_json_string) + io.println_error("Error code: " <> int.to_string(error.0)) + io.println_error("Error message: " <> error.1) + io.println_error("With input_json_string...") + io.println_error(input_json_string) panic as "Shellout received bad data" } Ok(output_json_string) -> output_json_string @@ -78,8 +78,8 @@ fn parse( json.parse(output_json_string, decode.list(of: decode.string)) { Error(_) -> { - io.print_error("With json string...") - io.print_error(output_json_string) + io.println_error("With json string...") + io.println_error(output_json_string) panic as "output_json_string failed to decode" } Ok(parsed_strings) -> parsed_strings From cedb113617f198b8fd46ff5ef956ca931e850bff Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 16:36:01 -0400 Subject: [PATCH 07/12] Smaller batches --- test/data.gleam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/data.gleam b/test/data.gleam index 0b5202b..9b7aa2f 100644 --- a/test/data.gleam +++ b/test/data.gleam @@ -18,7 +18,7 @@ pub fn integer_test_data() -> List(IntegerTestData) { // To prevent error code 7 (argument list too long) when passing large datasets // to the Python programs, we divide the data into smaller lists. -const test_data_chunk_size = 100 +const test_data_chunk_size = 10 pub fn python_processed_float_data() { let float_test_data = float_test_data() From dd1c42c770a7db13d955da3fe30fa68baad88741 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 17:01:50 -0400 Subject: [PATCH 08/12] Surpress uv download messages --- test/python/python_parse.gleam | 1 + 1 file changed, 1 insertion(+) diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 1f2e8b6..27bd0a2 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -38,6 +38,7 @@ fn parse( ) -> List(Result(String, PythonError)) { let arguments = [ "run", + "--quiet", "-p", "3.13", "python", From 0b3627f133ec43a9e243688f0d01b105bfa8993c Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 17:03:43 -0400 Subject: [PATCH 09/12] Remove some debug code --- test/python/python_parse.gleam | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 27bd0a2..022192d 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -46,22 +46,6 @@ fn parse( input_json_string, ] - case shellout.which("uv") { - Error(error) -> { - io.print_error(error) - panic as "uv was not found" - } - Ok(_) -> Nil - } - - case shellout.which("python") { - Error(error) -> { - io.print_error(error) - panic as "python was not found" - } - Ok(_) -> Nil - } - let output_json_string = case shellout.command(run: "uv", with: arguments, in: ".", opt: []) { From b0862be1d1b6dc8f856e44321ff51d98ce5d8dc3 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 17:03:52 -0400 Subject: [PATCH 10/12] Revert chunk_size --- test/data.gleam | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/test/data.gleam b/test/data.gleam index 9b7aa2f..6646b56 100644 --- a/test/data.gleam +++ b/test/data.gleam @@ -18,7 +18,7 @@ pub fn integer_test_data() -> List(IntegerTestData) { // To prevent error code 7 (argument list too long) when passing large datasets // to the Python programs, we divide the data into smaller lists. -const test_data_chunk_size = 10 +const test_data_chunk_size = 200 pub fn python_processed_float_data() { let float_test_data = float_test_data() From 024b4e52bc86fc6615dada13fd989f21ec08c19b Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 17:13:57 -0400 Subject: [PATCH 11/12] Clean up error messages --- test/python/python_parse.gleam | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/test/python/python_parse.gleam b/test/python/python_parse.gleam index 022192d..c4e1ba5 100644 --- a/test/python/python_parse.gleam +++ b/test/python/python_parse.gleam @@ -52,9 +52,8 @@ fn parse( Error(error) -> { io.println_error("Error code: " <> int.to_string(error.0)) io.println_error("Error message: " <> error.1) - io.println_error("With input_json_string...") io.println_error(input_json_string) - panic as "Shellout received bad data" + panic as "Shellout received bad data from `input_json_string`" } Ok(output_json_string) -> output_json_string } @@ -63,9 +62,8 @@ fn parse( json.parse(output_json_string, decode.list(of: decode.string)) { Error(_) -> { - io.println_error("With json string...") io.println_error(output_json_string) - panic as "output_json_string failed to decode" + panic as "`output_json_string` failed to decode" } Ok(parsed_strings) -> parsed_strings } From 8c8d5da415742fbb341841a1a45c9cac6dddc587 Mon Sep 17 00:00:00 2001 From: "Joseph T. Lyons" Date: Fri, 22 Aug 2025 17:21:21 -0400 Subject: [PATCH 12/12] Don't introduce breaking changes --- gleam.toml | 2 +- manifest.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/gleam.toml b/gleam.toml index c24f66f..7f47d43 100644 --- a/gleam.toml +++ b/gleam.toml @@ -14,4 +14,4 @@ gleam_stdlib = ">= 0.52.0 and < 2.0.0" gleam_json = ">= 2.3.0 and < 4.0.0" shellout = ">= 1.6.0 and < 2.0.0" simplifile = ">= 2.2.0 and < 3.0.0" -startest = ">= 0.7.0 and < 1.0.0" +startest = ">= 0.6.0 and < 1.0.0" diff --git a/manifest.toml b/manifest.toml index 4a57b3c..5db2b4c 100644 --- a/manifest.toml +++ b/manifest.toml @@ -35,4 +35,4 @@ gleam_json = { version = ">= 2.3.0 and < 4.0.0" } gleam_stdlib = { version = ">= 0.52.0 and < 2.0.0" } shellout = { version = ">= 1.6.0 and < 2.0.0" } simplifile = { version = ">= 2.2.0 and < 3.0.0" } -startest = { version = ">= 0.7.0 and < 1.0.0" } +startest = { version = ">= 0.6.0 and < 1.0.0" }