rye icon indicating copy to clipboard operation
rye copied to clipboard

Implementing safer self updates

Open cnpryer opened this issue 1 year ago • 5 comments

At work I've had a couple instances where users will run rye self update but it fails prior to completing. They are left with partial updates that break their Rye installations.

I want to submit a bug report for this, but I don't have a good MWE ready. I have a few screenshots available, but I'd need to redact a bunch of personal information.

These users are on Windows machines. One has developer mode enabled and the other user does not.

cnpryer avatar Mar 30 '24 20:03 cnpryer

This basically is the same as the other issues related to concurrency. Rye needs locking for both it's internal ~/.rye folder as well as the .venv.

mitsuhiko avatar Mar 30 '24 21:03 mitsuhiko

(If relevant: uv does lock the venv during install and sync commands.)

charliermarsh avatar Mar 30 '24 21:03 charliermarsh

The concurrency issues have been related, but I'm thinking more generally about the update process.

The last two times I resolved this for coworkers I had only come in after-the-fact. So I was debugging the effect of a recent partial install they experienced.

Although niche, one example that comes to mind that is unrelated to the concurrency issues is when we first rolled out new network infra. For a while we had various traffic issues, so Rye became subject to some network instability.

In this example that I'm thinking of, what happened was the process failed because that infra killed the process before Rye completed its update. But enough of the update completed to partially update Rye.

So I guess my question is if the update is interrupted for any reason, is Rye's update logic designed to prevent partial updates? I haven't reviewed that logic in a while, so I apologize if I'm missing something.

cnpryer avatar Mar 30 '24 22:03 cnpryer

For me a common failure comes from my shell prompt and the editor. Those run python and they can trigger stuff in rye that is not concurrency safe after updates.

mitsuhiko avatar Mar 31 '24 08:03 mitsuhiko

That lines up with what I was thinking happened in these last two instances.

One user had a newer version of Rye and a version of Ruff prior to its minor version bump. And it was with Rye 0.32.0 IIRC. The other user was missing virtualenv.

What I told them was to close out of their editor the next time they update Rye.

cnpryer avatar Mar 31 '24 14:03 cnpryer