Skip to content

Add suspendable REPL execution#126

Open
ex3ndr wants to merge 8 commits intopydantic:mainfrom
ex3ndr:main
Open

Add suspendable REPL execution#126
ex3ndr wants to merge 8 commits intopydantic:mainfrom
ex3ndr:main

Conversation

@ex3ndr
Copy link

@ex3ndr ex3ndr commented Feb 9, 2026

Hello!

I will be straight - it was generated by codex, i reviewed it and seemed fine - it clones compiled functions, internal states but keeps heap untouched.

This is a pretty much a must for RLM implementations which monty is perfect for.

@codspeed-hq
Copy link

codspeed-hq bot commented Feb 9, 2026

Merging this PR will not alter performance

✅ 13 untouched benchmarks


Comparing ex3ndr:main (0d942d2) with main (fc2f154)

Open in CodSpeed

@codecov
Copy link

codecov bot commented Feb 9, 2026

Codecov Report

❌ Patch coverage is 81.14407% with 89 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
crates/monty/src/repl.rs 77.55% 74 Missing and 14 partials ⚠️
crates/monty/src/prepare.rs 97.56% 0 Missing and 1 partial ⚠️

📢 Thoughts on this report? Let us know!

Copy link
Member

@samuelcolvin samuelcolvin left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

overall this looks good, let's not bloat run.rs too much - the new stuff can go into a new repl.rs.

@davidhewitt should review this too.

@samuelcolvin
Copy link
Member

Also required (could be done in this PR or a followup):

  • add support to monty-cli
  • add support to python
  • add support to js

@ex3ndr
Copy link
Author

ex3ndr commented Feb 9, 2026

Thanks! I am on the edge splitting run.rs to two modules, do you want me to replicate similar structure (ie executors and all kind of plumbing) in separate file? it kind of makes sense since it is a different execution model, but it will produce mostly duplicated code, is it ok?

@ex3ndr
Copy link
Author

ex3ndr commented Feb 10, 2026

Updated:

  1. move repl out of run.rs - latter now matches the origin completely
  2. added js, cli and python implementations
  3. fixed other comments

Copy link
Collaborator

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a huge PR, I will probably review in multiple rounds. I have some initial questions which might affect the content here, so let's address those first before I review further.

fn main() -> ExitCode {
let args: Vec<String> = env::args().collect();
let file_path = if args.len() > 1 { &args[1] } else { "example.py" };
let repl_mode = matches!(args.get(1).map(String::as_str), Some("--repl" | "-r"));
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This feels brittle, I would recommend we convert argument parsing to clap. (Might be better to do that as a separate precursor PR.)

@ex3ndr
Copy link
Author

ex3ndr commented Feb 11, 2026

Resolved all comments, except arg parsing, but it is robust.

Copy link
Collaborator

@davidhewitt davidhewitt left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks - some follow up questions / thoughts. This is a big PR so please forgive if it takes me multiple reviews to fully digest.

@ex3ndr
Copy link
Author

ex3ndr commented Feb 12, 2026

Changed it, to use "-i" instead, also multiline support, i am not 100% sure if this is a good way to parse code and see if block is completed, aren't this too flimsy? on other side it is CLI probably wont be used in production anyway

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants