gleam-lang / gleam

⭐️ A friendly language for building type-safe, scalable systems!
https://gleam.run
Apache License 2.0
18.1k stars 759 forks source link

`gleam remove` requires a working network connection #3887

Open joshi-monster opened 2 days ago

joshi-monster commented 2 days ago

While on a train, I noticed that I cannot remove packages while being offline:

$ gleam remove gleam_stdlib
Resolving versions
error: Dependency resolution failed

An error occurred while determining what dependency packages and
versions should be downloaded.
The error from the version resolver library was:

Unable to determine package versions: error sending request for url
(https://repo.hex.pm/packages/gleeunit)

I can't think of a case where deleting a package would change the resolved versions of the other installed packages, since all their versions are locked in the manifest anyways. Dependencies are also recorded in the manifest, so removing transitive packages should also be possible without calling hex again. ~ :purple_heart:

lpil commented 1 day ago

I think we can now use for this the new dependency trimming code that was added for gleam update <specific-package>.

joshi-monster commented 1 day ago

Oh that's great, I'll look into this tomorrow/this week then!

GiregL commented 23 hours ago

It looks like the remove command first read the dependences from gleam.toml, removes the given ones, rewrites the gleam.toml file and then downloads again the new dependencies to generate a new manifest.

Can't we provide an "offline" option that could update the manifest locally ?

lpil commented 23 hours ago

We want to never use the network, we don't want to make it configurable.

GiregL commented 23 hours ago

I'm not sure to understand, gleam remove already uses the network ( compiler-cli/src/dependencies.rs#download, used by remove.rs#command)

lpil commented 8 hours ago

This ticket is for removing the network usage.