Moving to JSON for CLI?

(David Buchan Swanson) #1

I noticed with the release of the JSON API that it should be very possible now to not have the entire git repo stored locally for every person. It means that people will only need to keep, essentially, a list of every package name, which could be checked for freshness using an ETAG rather than a git pull. Installs will just require a HTTP request for a given package name. To me, it seems to make a lot more sense.

Is this the plan for the future? Is there something like this in the works?

(Sean Molenaar) #2

You can check what’s in the works here:
As for the dependence on git, I think there might be more to it than just a way to fetch formula. (it’s also a pretty good source control tool). Maybe @MikeMcQuaid wants to share an opinion here?

(Mike McQuaid) #3

This is not planned and would be a significant amount of work.

(David Buchan Swanson) #4

Yeah, it’s definitely a great source control tool. But I’m not sure that source needs to be on every person’s machine, right?

Afaict the API doesn’t replace formulas staying in homebrew-core, but it does mean alternative “front-ends” for the CLI are possible, with likely a massively reduced footprint on the user’s system.

(Mike McQuaid) #5

If you’re interested in building one it would be a cool project. We’re not though, I’m afraid.

(David Buchan Swanson) #6

Okay, that’s all good. Is there background reasoning behind the API, if there is no intention to rewrite homebrew/cli?

(Mike McQuaid) #7

It’s useful for people who wish to consume the state of Homebrew’s packages without running Homebrew’s code on their machine.

(Mike McQuaid) #8

Also, as you’re asking a bit more than I expected: for what it’s worth this would not be an easy transition; Homebrew’s entire update process is and has-always been based on Git. This would require writing a new update method entirely from scratch which would then break down for anyone who wanted to e.g. edit a formula and contribute back (which we want to make as easy as possible for everyone, even if that adds some overhead for everyone).

(David Buchan Swanson) #9

Genuine curiosity with all these questions. No judgement here.

That’s a good point and a use case I hadn’t thought of (editing formulae).

Wasn’t suggesting that it should be changed. Just that when I saw a JSON API available, first thing that went through my mind was that it was for a new cli.

(Mike McQuaid) #10

Cool, no worries, hope I’ve answered all your questions and thanks for using Homebrew! <3