spago icon indicating copy to clipboard operation
spago copied to clipboard

`spago registry search` gives false positive result

Open edwardw opened this issue 1 year ago • 8 comments

The package in question is iterable. The spago registry search iterable reports its existence in the package set, but actually adding the said package to the spago.yaml and building the project result in an error:

The following packages do not exist in your package set:
  - iterable

The spago version is the latest 0.93.9 and the spago.yaml is the minimum one after spago init. It also contradicts the result of its own spago ls packages command, which reports no such package.

edwardw avatar Sep 21 '23 12:09 edwardw

spago registry search, as the name suggests, searches for a package in the Registry. Existence of a package in the registry does not guarantee inclusion in the package set.

spago ls packages instead will list all the packages in your current package set, which is only a subset of the packages in the Registry.

Are you able to point out if there's any bit of documentation that's confusing about this? We should make it clearer in the docs.

f-f avatar Sep 21 '23 12:09 f-f

I think something that could help with this would be to enrich the results of spago registry search with a "latest package set" field

f-f avatar Sep 21 '23 12:09 f-f

My confusion was probably stemmed from the help message of spago ls, which says spago ls packages should "List packages available in the local package set". It led me to think a "package set" is a local subset of remote packages, which is a "registry". The fact that other language package managers may work that way doesn't help I suppose.

I agree this is a documentation issue. Spelling out what registry and package set are in the document would be great! My current understanding is:

  • Registry: all (?) purescript packages
  • Package set: has version, a curated subset of registry. spago ls packages list the content of current package set.
  • spago ls deps: after spago install, they are the packages available locally

edwardw avatar Sep 21 '23 13:09 edwardw

There already exists a section of the docs called "what's a package set?"

f-f avatar Sep 21 '23 13:09 f-f

The document exists so I will close the ticket.

I'd argue that spago registry search has limited utility since one may or may not be able to add the result as a dependency. What I'd like to do is searching the package set actually.

edwardw avatar Sep 21 '23 14:09 edwardw

I'll reopen this - it sounds like we have quite a few areas that are ripe for improvement:

  • the command line help strings are not clear enough about what spago registry vs spago ls does
  • the documentation should give more info about the relationship between "package sets" and "the registry"
  • the output of spago registry search should include the latest package set that a package (and every package version) was found in - this will probably require some sort of database so we don't have to re-parse all the package sets all the time
  • the error message from spago install could be more actionable: sure, the package you wanted is not in the set, but maybe it can be found in the registry and it can be installed somehow?
  • ...which we should also allow. We could have a spago install --from-registry flag, that would add that Registry package to the extra_packages so that your local package set includes it

f-f avatar Sep 21 '23 14:09 f-f

I'd argue that spago registry search has limited utility

There is currently no other way of searching the totality of packages that are included in the Registry. In practice most of the folks will use package sets, but e.g. library authors are more likely to not do that, so it is useful to have some way of browsing the Registry

f-f avatar Sep 21 '23 14:09 f-f

I agree that it's still valuable to indicate the package exists in the registry but not in your local package set, because — as you noted, @f-f — there are many reasons a package could be missing from the set you're using and it doesn't mean that the package is inaccessible to you. You could very well install it by adding it to your extra_packages. It would be nice to remind users that they aren't restricted only to packages / versions in their chosen package set.

thomashoneyman avatar Sep 21 '23 15:09 thomashoneyman