How to use the REPL to speed up modular development by dynamically replacing function definitions

Yes, that’s correct.

In theory yes. Actually I intend to do one better than this. Build an entire “UAT system” (aka another server, just not the same one as the prod data lives on).

Since only the statistical properties of the data are relevant, it should be easy to generate some MC data which isn’t sensitive in the same way as the prod data is.

But again, this is not a quick job. It will probably take longer than anyone might anticipate because of the validation which will need to be done on the MC data samples.

When I say should be easy that actually depends a lot on the method used to simulate the data. We might not be permitted to do the most and straightforward simple thing.

This package was registered a few days ago: GitHub - vdayanand/Txtar.jl: package to handle text archives

That looks like it might be helpful with transferring a whole bunch of files at the same time via pasting via vim.

So, develop locally, when you want to deploy, package up all your code into a txtar file, and copy the content of that file to your clipboard. On the remote, have a REPL open (with Revise), use edit in the REPL to open vim, paste in the txtar data, “untar” it after returning to the REPL, let Revise automatically reload your code.

OP is saying the REPL and vim can’t be open at the same time on the server. Though I am curious what happens when edit is attempted. Does vim fail to open entirely? Does vim open but it’s impossible to switch to it from an active REPL?

If resorting to copying whole files instead of small edits and saves (which isn’t scalable but one problem at a time), then it’s possible to over-write a whole file with a multiline String with pasted text before include. Could skip a step with include_string, but at that point you might as well just paste into the REPL directly (caveat: different soft scope behavior) and saving a file on the server seems important. A reason I don’t like this massive text pasting is the parser doesn’t play nice with >1 blank lines in one String (you do "\n" instead) or expression (check begin or quote); include works because it breaks up text into serially parsed expressions.

Not quite.

There is only one terminal session which can be open at once.

You can open a REPL, press ; and then run vim.

Oh so there’s no desktop to open multiple windows in or terminal multiplexer, you just have the one active terminal to interact with, old-school workflow.

Sounds good, you can exit vim to switch back to the same Revise-able REPL session. At least I can do that on Windows, downloaded vim to be sure:

julia> x = 1
1

shell> cd Downloads
C:\Users\redacted\Downloads

shell> powershell vim blah.txt

julia> include("blah.txt") # I wrote y = 2
2

julia> x, y
(1, 2)

Obviously loses out on features and ergonomics of an IDE or other editors, and I have to write powershell vim in Julia’s shell mode. But you can do that stuff locally and already can paste in the remote vim as a workaround if a remote desktop or multiplexer is a no-go.

Is the command rz running on your machine, or can it be installed? rz and sz use the ZMODEM protocol to send files through a single serial terminal. It was popular in pre-internet times with modem connections :slight_smile:. The linux package is sometimes called lrzsz.

Another thing: instead of using vim, maybe you can simply run from julia run(`bash -c "cat > target.jl"`), then paste your code and end with control-D. You’ll save some keystrokes! (the above command will remain in your history of course)

1 Like

This has been already answered here I think

1 Like