uv icon indicating copy to clipboard operation
uv copied to clipboard

`uv add` should roll back changes to `pyproject.toml` if the automatic sync is cancelled

Open akx opened this issue 1 year ago • 1 comments

uv 0.4.0, macOS.

A minimal code snippet that reproduces the issue:

$ uv init foo
$ cd foo
$ uv add pyobjc
💭 oh crud, I don't need every single pyobjc framework! that's a lot of framework!
^C
$ uv add pyobjc-core
💭 oh crud, it's still downloading all frameworks! what's happening?!
^C
$ cat pyproject.toml
[...]
dependencies = [
    "pyobjc",
    "pyobjc-core",
]
$

IOW, I'd expect that if I cancel the uv add operation (even if it's made up of add and implicit sync afterwards), pyproject.toml was back to the state it was before uv add.

akx avatar Aug 29 '24 15:08 akx

(We correctly do this if lock or sync fail, but not if the program is interrupted.)

charliermarsh avatar Aug 29 '24 20:08 charliermarsh