Subject: [bug#60941] [PATCH 1/2] gnu: Add python-pypdf.

From: Maxim Cournoyer <[email-masked]>
Date: Wed, 18 Jan 2023 20:42:11 -0500

Hello,

Vagrant Cascadian <[email-masked]> writes:

> From e2082819efee20a72b026eebcfc14af279e424c7 Mon Sep 17 00:00:00 2001
> From: Vagrant Cascadian <[email-masked]>
> Date: Wed, 18 Jan 2023 16:26:41 -0800
> Subject: [PATCH 1/2] gnu: Add python-pypdf.
>
> * gnu/packages/pdf.scm (python-pypdf): New varaible.
> ---
>  gnu/packages/pdf.scm | 39 +++++++++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
>
> diff --git a/gnu/packages/pdf.scm b/gnu/packages/pdf.scm
> index 4b9d0623fe..cb94c29bde 100644
> --- a/gnu/packages/pdf.scm
> +++ b/gnu/packages/pdf.scm
> @@ -1260,6 +1260,45 @@ (define-public pdf2svg
>  converter using the Poppler and Cairo libraries.")
>      (license license:gpl2+)))
>  
> +(define-public python-pypdf
> +  (package
> +    (name "python-pypdf")
> +    (version "3.2.1")
> +    (source (origin
> +              (method url-fetch)
> +              (uri (pypi-uri "pypdf" version))
> +              (sha256
> +               (base32
> +                "1pdq4nbkknx61pk8w75jvx5j921m2676wfkyizsrap5mj92cssxc"))))
> +    (build-system python-build-system)

You should use pyproject-build-system, which knows how to build a
project from a PEP 517 build system.

> +    (arguments
> +     (list #:tests? #f ;pypi source does not contains tests

When this occurs, you can fetch from git instead.  Typically Python
packages come with test suites, and this one is no exception.

> +           #:phases #~(modify-phases %standard-phases
> +                        (replace 'build
> +                          (lambda _
> +                            (invoke "flit" "build")))
> +                        (replace 'install
> +                          (lambda* (#:key inputs outputs #:allow-other-keys)
> +                            (add-installed-pythonpath inputs outputs)
> +                            (for-each (lambda (wheel)
> +                                        (invoke "python"
> +                                                "-m"
> +                                                "pip"
> +                                                "install"
> +                                                wheel
> +                                                (string-append "--prefix="
> +                                                               #$output)))
> +                                      (find-files "dist" "\\.whl$")))))))
> +    (native-inputs (list python-flit))
> +    (propagated-inputs (list python-typing-extensions))
> +    (home-page "https://github.com/py-pdf/pypdf")
> +    (synopsis
> +     "A pure-python PDF library")

guix lint should complain about the leading determinant ("A").

> +    (description
> +     "This package provides a pure-python PDF library capable of splitting, merging,
> +cropping, and transforming PDF files")

Missing period, and "pure-python" is odd.  Perhaps just "This package
provides a Python PDF library [...]"

-- 
Thanks,
Maxim