unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
From: ludo@gnu.org (Ludovic Courtès)
To: David Thompson <dthompson2@worcester.edu>
Cc: guix-devel@gnu.org
Subject: Re: [PATCH] import: Add PyPI importer.
Date: Sat, 27 Sep 2014 23:49:18 +0200	[thread overview]
Message-ID: <87eguwentt.fsf@gnu.org> (raw)
In-Reply-To: <8761g8ojde.fsf@izanagi.i-did-not-set--mail-host-address--so-tickle-me> (David Thompson's message of "Sat, 27 Sep 2014 17:15:25 -0400")

David Thompson <dthompson2@worcester.edu> skribis:

> I spent my day working on generalizing the 'guix import' UI to allow for
> using a PyPI importer in addition to the pre-existing Nix importer.
> It's now at the point where I stop coding and open it up for review. :)

Heheh, cool! :-)

Overall looks good to me.  Some comments below:

> From b3ec259fd097034631cf311040af7aa12f7c5ebc Mon Sep 17 00:00:00 2001
> From: David Thompson <dthompson2@worcester.edu>
> Date: Sat, 27 Sep 2014 10:16:23 -0400
> Subject: [PATCH] import: Add PyPI importer.
>
> * guix/snix.scm: Delete.
> * guix/import/snix.scm: New file.
> * guix/scripts/import/nix.scm: New file.

This is good.

> * guix/import/pypi.scm: New file.
> * guix/scripts/import/pypi.scm: New file.

Nice too.  I wonder if there may be shared options between all the
importers (like an option for import & live build.)

That can still be addressed by exporting an option list from (guix
scripts import), like (guix scripts build) does, I think.

> * Makefile.am (MODULES): Add new files and remove 'guix/snix.scm'.
> * guix/scripts/import.scm (%default-options, %options): Delete.
>   (importers): New variable.
>   (show-help): List importers.
>   (guix-import): Factor out Nix-specific logic.  Delegate to correct importer
>   based upon first argument.

Make sure to adjust tests/snix.scm.

Also, it’d be cool to have tests for (guix import pypi), at least for
the part that is concerned with parsing JSON and producing a package
object.

> +(define tarball-url->string-append
> +  (let ((tar.gz-regex (make-regexp "\\.tar\\.gz$"))
> +        (tarball-regex (make-regexp ".*-(.*)\\.tar\\.gz")))
> +    (lambda (url name version)
> +      "Return a `string-append' s-expression used for building a generic form
> +of URL for the package NAME where VERSION is replaced by a `version'
> +variable."

This is similar to what snix has, and i think it should be shared (see
below.)

> +(define (make-pypi-sexp name version source-url home-page synopsis
> +                        description license)
> +  "Return the `package' s-expression for a python package with the given NAME,

Namely, what do you think of having importers return directly a
‘package’ object?  Then there could be a shared ‘package->sexp’
procedure, that would to the fancy ‘string-append’ thing like above.

And, eventually, we can add an option to do live builds of the generated
package objects.

That can also be done in the next iteration, though.

> +(define (factorize-uri uri version)
> +  "Factorize URI, a package tarball URI as a string, such that any occurrences
> +of the string VERSION is replaced by the symbol 'version."

This one from snix is redundant with ‘tarball-url->string-append’ (and
maybe less sophisticated?).

Thanks!

Ludo’.

  parent reply	other threads:[~2014-09-27 21:49 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-09-27 21:15 [PATCH] import: Add PyPI importer David Thompson
2014-09-27 21:19 ` David Thompson
2014-09-27 21:35   ` Ludovic Courtès
2014-09-29 11:23     ` David Thompson
2014-09-29 12:24       ` Ludovic Courtès
2014-09-29 23:31         ` David Thompson
2014-09-30  5:49           ` Alex Kost
2014-09-30  7:13             ` Ludovic Courtès
2014-09-30 11:55             ` David Thompson
2014-09-27 21:49 ` Ludovic Courtès [this message]
2014-09-28 23:48   ` David Thompson
2014-09-29  7:04     ` Ludovic Courtès

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

  List information: https://guix.gnu.org/

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=87eguwentt.fsf@gnu.org \
    --to=ludo@gnu.org \
    --cc=dthompson2@worcester.edu \
    --cc=guix-devel@gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).