From mboxrd@z Thu Jan 1 00:00:00 1970 From: Catonano Subject: Re: Package graph queries Date: Thu, 11 Aug 2016 06:37:50 +0200 Message-ID: References: <8737mxflz4.fsf@gnu.org> <87twf6ahvj.fsf_-_@gnu.org> Mime-Version: 1.0 Content-Type: multipart/alternative; boundary=001a113946581ff42f0539c454a0 Return-path: Received: from eggs.gnu.org ([2001:4830:134:3::10]:46142) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bXhkj-00015g-TE for guix-devel@gnu.org; Thu, 11 Aug 2016 00:37:59 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bXhki-0006lq-FZ for guix-devel@gnu.org; Thu, 11 Aug 2016 00:37:57 -0400 In-Reply-To: <87twf6ahvj.fsf_-_@gnu.org> List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: =?UTF-8?Q?Ludovic_Court=C3=A8s?= Cc: guix-devel --001a113946581ff42f0539c454a0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable 2016-07-31 0:19 GMT+02:00 Ludovic Court=C3=A8s : > Jelle Licht skribis: > > > On Jul 29, 2016 16:53, "Catonano" wrote: > > [...] > > >> For example: which are the packages with less or no dependencies (and = a > >> lot of dependants) ? > >> Because those should be imported first, in my opinion. > > [...] > > > ^ This, I like. Does anyone have any suggestions on tools that could he= lp > > me do this in guile? > > I understand you want to perform these queries on NPM packages, not Guix > packages, but if you could hook your NPM package representation in (guix > graph)=C2=B9, you could do the same as this: > > --8<---------------cut here---------------start------------->8--- > scheme@(guile-user)> ,use(guix graph) > scheme@(guile-user)> ,use(guix scripts graph) > scheme@(guile-user)> ,use(gnu packages) > scheme@(guile-user)> ,use(guix monad-repl) > scheme@(guile-user)> ,enter-store-monad > store-monad@(guile-user) [1]> (node-back-edges %bag-node-type > (fold-packages cons '())) > $4 =3D # > store-monad@(guile-user) [1]> ,q > scheme@(guile-user)> ,use(srfi srfi-1) > scheme@(guile-user)> (filter (lambda (p) > (> (node-reachable-count (list p) $4) > 600)) > (fold-packages cons '())) > My concern, here, would be an equivalent of "fold-packages" for registry.npmjs.com. The API seems a bit cloudy to me. See this question https://stackoverflow.com/questions/34071621/query-npmjs-registry-via-api --001a113946581ff42f0539c454a0 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable


2016-07-31 0:19 GMT+02:00 Ludovic Court=C3=A8s <ludo@gnu.org>= :
Jelle Licht <jlicht@fsfe.org> skribis:

> On Jul 29, 2016 16:53, "Catonano" <catonano@gmail.com> wrote:

[...]

>> For example: which are the packages with less or no dependencies (= and a
>> lot of dependants) ?
>> Because those should be imported first, in my opinion.

[...]

> ^ This, I like. Does anyone have any suggestions on tools that could h= elp
> me do this in guile?

I understand you want to perform these queries on NPM packages, not Guix packages, but if you could hook your NPM package representation in (guix graph)=C2=B9, you could do the same as this:

--8<---------------cut here---------------start------------->8--= -
scheme@(guile-user)> ,use(guix graph)
scheme@(guile-user)> ,use(guix scripts graph)
scheme@(guile-user)> ,use(gnu packages)
scheme@(guile-user)> ,use(guix monad-repl)
scheme@(guile-user)> ,enter-store-monad
store-monad@(guile-user) [1]> (node-back-edges %bag-node-type (fold-pack= ages cons '()))
$4 =3D #<procedure 59ac880 at guix/graph.scm:87:17 (node)>
store-monad@(guile-user) [1]> ,q
scheme@(guile-user)> ,use(srfi srfi-1)
scheme@(guile-user)> (filter (lambda (p)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(> (node-reachable-count (list p) = $4)
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 600))
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2= =A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(fold-packages cons '()))

My concern, here, would be an equivalent of "fol= d-packages" for registry.npmjs.c= om.

The API seems a bit cloudy to me.
= =C2=A0
See this question
https://stackoverflow.com/quest= ions/34071621/query-npmjs-registry-via-api


--001a113946581ff42f0539c454a0--