Subject: [bug#70400] [PATCH 2/7] gnu: Add python-pytoolconfig.

From: Nicolas Graves <[email-masked]>
Date: Sun, 16 Jun 2024 00:45:04 +0200

On 2024-04-15 19:45, Jonathan Pieper via Guix-patches via wrote:

> * gnu/packages/python-xyz.scm (python-pytoolconfig): New variable.
> ---
>  gnu/packages/python-xyz.scm | 52 +++++++++++++++++++++++++++++++++++++
>  1 file changed, 52 insertions(+)
>
> diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
> index 9521119a84..27107c3d8f 100644
> --- a/gnu/packages/python-xyz.scm
> +++ b/gnu/packages/python-xyz.scm
> @@ -36309,6 +36309,58 @@ (define-public python-zeroc-ice-3.6
>                 (base32
>                  "0mikjfvq26kh8asnn9v55z41pap4c5ypymqnwwi4xkavc3mzyda2"))))))
>  
> +(define-public python-pytoolconfig
> +  (package
> +    (name "python-pytoolconfig")
> +    (version "1.2.2")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (pypi-uri "pytoolconfig" version))
> +       (sha256
> +        (base32 "18isxi4ijarl949d0zmf0b4606r6hihpi3p5yb7763m4c7ra24i5"))))
> +    (build-system pyproject-build-system)
> +    (arguments
> +     '(#:phases (modify-phases %standard-phases
> +                  (add-after 'unpack 'update-license
> +                    (lambda _
> +                      (substitute* "pyproject.toml"
> +                        (("license-expression = (\"[^\"]*\")" all license)
> +                         (string-append "license = {text = " license "}")))))
> +                  (add-after 'unpack 'remove-mypy
> +                    (lambda _
> +                      (substitute* "pyproject.toml"
> +                        (("^.*mypy.*")
> +                         "")
> +                        (("strict = true")
> +                         ""))))
> +                  (add-after 'unpack 'use-pdm-backend-instead-of-pep517
> +                    (lambda _
> +                      (substitute* "pyproject.toml"
> +                        (("pdm-pep517")
> +                         "pdm-backend")
> +                        (("pdm\\.pep517\\.api")
> +                         "pdm.backend"))))
> +                  (replace 'check
> +                    (lambda* (#:key tests? #:allow-other-keys)
> +                      (when tests?
> +                        ;; Disable failing test.
> +                        (invoke "python" "-m" "pytest" "-k"
> +                                "not test_documentation")))))))

Instead of replacing the 'check phase here, you can use the #:test-flags
option with (list "-k" "not test_documentation).

> +    (native-inputs (list python-pdm-backend
> +                         python-tomli
> +                         python-pytest
> +                         python-docutils
> +                         python-sphinx
> +                         python-tabulate))
> +    (propagated-inputs (list python-appdirs))
> +    (home-page "https://github.com/bagel897/pytoolconfig")
> +    (synopsis "Python Tool Configuration")

I see that the name of the project, but it doesn't seem correct english.
maybe "Configure Python tools" is a better alternative, WDYT?

> +    (description
> +     "This module manages configuration for python tools,

"package" is much more used than "module" here

> +such as rope and add support for a pyproject.toml configuration file.")
> +    (license license:lgpl3+)))

Otherwise LGTM.
> +
>  ;;;
>  ;;; Avoid adding new packages to the end of this file. To reduce the chances
>  ;;; of a merge conflict, place them above by existing packages with similar

-- 
Best regards,
Nicolas Graves