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

Message ID 06a250000a633c62b5d806c8849b94ed7b84fb3d.1713203110.git.jpieper@mailbox.org
State New
Headers
Series [bug#70400,1/7] gnu: Add python-docstring-to-markdown. |

Commit Message

Jonathan Pieper April 15, 2024, 5:45 p.m. UTC
* gnu/packages/python-xyz.scm (python-pytoolconfig): New variable.
---
 gnu/packages/python-xyz.scm | 52 +++++++++++++++++++++++++++++++++++++
 1 file changed, 52 insertions(+)
  

Comments

Nicolas Graves June 15, 2024, 10:45 p.m. UTC | #1
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
  

Patch

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")))))))
+    (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")
+    (description
+     "This module manages configuration for python tools,
+such as rope and add support for a pyproject.toml configuration file.")
+    (license license:lgpl3+)))
+
 ;;;
 ;;; 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