dune icon indicating copy to clipboard operation
dune copied to clipboard

rfc(pkg): progress indicator for downloads

Open Alizter opened this issue 2 years ago • 2 comments

Problem

When we do:

dune pkg lock

it typically take some time because we are fetching or cloning in the background.

Proposal

We could have a download indicator that looks like the following:

[0.1/5.2 MiB] <spinny thing> Downloading opam-repository https://opam.ocaml.org

This would give users a much better experience when waiting.

Implementation

We use opam libraries to fetch and clone repos. We could modify the calls to git by parsing from git fetch and git clone:

--progress
           Progress status is reported on the standard error stream by default when
           it is attached to a terminal, unless -q is specified. This flag forces
           progress status even if the standard error stream is not directed to a
           terminal.

When we have these we then parse and display a nice status.

Related PRs

  • Progress indicators on jobs: #8601
  • Download friendly byte units: #8618

Alizter avatar Oct 04 '23 15:10 Alizter

Looks like a good idea to me. I think this might need modifications to action execution in the engine that will allow progress reporting.

rgrinberg avatar Oct 04 '23 20:10 rgrinberg

FYI, a couple years ago I had a look at the various HTTP clients and I don't think any had a progress callback. (though that's more of a concern for the opam libs)

emillon avatar Oct 25 '23 12:10 emillon