[Tooling] Port of generate_tests.py to Julia#1111
[Tooling] Port of generate_tests.py to Julia#1111BethanyG wants to merge 9 commits intoexercism:mainfrom
generate_tests.py to Julia#1111Conversation
|
This PR touches files which potentially affect the outcome of the tests of an exercise. This will cause all students' solutions to affected exercises to be re-tested. If this PR does not affect the result of the test (or, for example, adds an edge case that is not worth rerunning all tests for), please add the following to the merge-commit message which will stops student's tests from re-running. Please copy-paste to avoid typos. For more information, refer to the documentation. If you are unsure whether to add the message or not, please ping |
|
This sounds like we inflicted unintended pain on you. Apologies! I'm pretty frazzled at this point, so defusing the bomb will need to wait for tomorrow: another day, hopefully more awake. Please don't expect miracles... |
No worries. Now that things are set up, I expect a whole lot less drama. But VSCode and I are NOT friends right now. |
|
Oof, reviewing this properly is going to take a while, and a clearer head than I currently have. All in good time... Some initial observations (beyond the obvious "thank you for doing this"):
I'm tempted to suggest that we approve and merge this fairly quickly, then keep kicking the tyres/tires to really get a feel for it. None of this is student-facing. |
|
I haven't explored this yet, but I find myself wondering how reproducible the slowness is. In Julia, the first call to any function hits a delay for JIT-compilation (serious, optimizing-compiler stuff). Subsequent calls should be much faster, though I don't know how that plays with Python. |
|
Updated the air refs (😊). Putting it in "ready to review" status. I can always experiment with Python subprocess on a different branch.
FWIW, this is the same code the Python track uses and the R track uses ..... with the change of |
|
I'm still getting It's installed in my system Julia, it's installed through Any other suggestions? |
FWIW, my . As you suggested, this is very off-pissing. |
|
Current workaround is to install |
|
AARGH. So sorry this is getting you too. Very frustrating. I am trying to think what I did for JuliaFormatter that might be different. Lemme check my paths...perhaps I added something there and then forgot? I was able to have things called fine from the script, so something is different.... 🤔 |
|
Hummmm....I think I introduced a bug. I am getting the same error you are! 😱 sigh. Hold, plz while I un-F*&k the code....... |
|
No rush. My old, tired head is telling me I'm done for the day. |
|
Just a question (this is not my expertise): would shelling out from Python to the command line to run |
I would have to try it using BTW: fixed the issue. I will push an update here in a sec. I had named the check for the app "JuliaFormatter", but it turns out it needs to be "jlfmt" -- since that's the app that has the CLI. So the CLI as well as the lib need to be installed. Sorry about that! |
…LI that is checked for.
|
Nope, I'm still getting the same error. Something that will need to wait till tomorrow. I'll approve it meanwhile, without merging. I'd like to give @depial a chance to comment (if he's around). |
|
Shelling out works and it's not slower. But it is much simpler - so expect an update here shortly. Extra bonus because we wouldn't need a config file at all this way - we just need to figure out the options we want to pass on to the formatter CLI! 🎉 The only thing that's now bugging me is that the newline removal is really aggressive - so we'll have to tune it probably. |
colinleach
left a comment
There was a problem hiding this comment.
Provisionally approved, accepting that there are still some formatting tweaks to sort out.
That is seriously weird. Can't figure out what might be the difference. I am going to push an update to do the shell out instead (but I'll leave the Juliacall code in commented out). Let's not merge until we figure it out. |
|
I think it's a $PATH problem at my end. My All fixable, I'm sure. Just not today. |
I am using I should be around tomm, should you find more bugs. 😄 |
|
Sorry... It's getting down to crunch time for me here, so I'm not likely to have much time to review thoroughly. Let me see how much I can get done on what I'm working on today, and I'll see if I can start exploring soon. Of course, since you feel ready to merge, feel free to do so. I agree we can work out any details/bugs as we go. In the meantime, I did take a quick look and noticed:
|
Good luck!
Yes, kind of a known problem. We need to think how we might improve it, but meanwhile it's not a deal-breaker. When I get chance, I'll restart a few things on my machine and see if I can get it working (with everything findable on a suitable path). Given that, I hope to merge later today. |
|
Working now, I'm happy to say! I'll press the Big Green Button once @BethanyG gives the OK (unless Erik manages to add maintainer rights before then). |
|
Tuning the formatter might be the cleanest solution, but if that goes badly one fallback is a quick regex replace. For unnested tests, we just need a newline added after |
I think we can also turn off the newline removal in JuliaFormatter by passing |
|
Should I merge meanwhile, or would you prefer to wait? |
|
I have some stuff to do this morning, but can make that change this afternoon. If you'd like to experiment, the line that calls JuliaFormatter is 296 in The template I made for |
Let's wait a couple hours. I want to make sure things are a little tighter, and it's easier for me to push changes before we merge - if that's OK? |
| @testset "{{ case["description"]}}" begin | ||
| @test acronym("{{ case["input"]["phrase"] }}") == "{{ case["expected"] }}" | ||
| end | ||
| {%- endmacro %} |
There was a problem hiding this comment.
Suggested change: {%- endmacro to {% endmacro to create a blank line between testsets.
|
As far as I can tell, Delightfully simple, if true. |

ooof. This was less of an exercise in programming and more an Epic Yak Shaving experience(TM)
Still not totally confident in everything, hence the "draft" status. I am also displeased with the performance, which is slowed considerably by
juliacall. Will experiment with alternatives, but I don't think precompiling the formatter is exactly the way we want to go. But we might want to try using Python'ssubprocessmodule to call Julia directly and invoke the Formatter. My "googling" said that would be slower ... but as it stands it feels slow to me. So.We may also need to add more functions/macros/filters as we make more complicated templates.
I am also not confident that the Formatter is really adding value. Despite passing in what I think are the correct arguments, newlines are not always stripped. I resorted to JinJa foo to remove newlines, and so I can't really say that the formatter is going to format the way we want. Sigh. Definitely a WIP.
Added the following scripts/files:
This was an irritating experience. I ran the tests from my Exercism Python conda env, and despite Julia and JuliaFormatter being on my path, juliacall saw fit to install its own Julia into the env. Total waste of disk space. 😡
Open to suggestions around JuliaFormatter, juliacall, and anything else you can think of. Oh - -and this uses Python 3.13.5, although you can probably use 3.14.