diff mbox series

[bug#49170,v2] : gnu: Add python-fire

Message ID 6F62A6C8-CD81-49A0-BCC1-E1F733B31A61@ubuntu.com
State Accepted
Headers show
Series [bug#49170,v2] : gnu: Add python-fire | expand

Checks

Context Check Description
cbaines/comparison success View comparision
cbaines/git branch success View Git branch
cbaines/applying patch fail View Laminar job
cbaines/issue success View issue

Commit Message

Danial Behzadi June 26, 2021, 7:52 p.m. UTC
Sorry. The previous one was malformed. This is the correct one.

Comments

M June 28, 2021, 9:30 p.m. UTC | #1
> +    (arguments
> +     '(#:phases
> +       (modify-phases %standard-phases
> +         (replace 'check
> +           (lambda _ (invoke "pytest"))))))

I'm a bit late, as this has already been merged,
but this should have been something like:

> +         (replace 'check
> +           (lambda* (#:key tests? #:allow-other-keys)
> +             (when tests?
> +               (invoke "pytest")))))))

That way, tests can be disabled with "--without-tests".
Try "./pre-inst-env guix build pytest --without-tests=pytests".
Respecting #:tests? can also be important for cross-compilation.

Could you send a follow-up patch, or could someone directly
commit such a change?

Greetings,
Maxime.
Raghav Gururajan June 28, 2021, 9:50 p.m. UTC | #2
Hi Maxim!

> I'm a bit late, as this has already been merged,
> but this should have been something like:
> 
>> +         (replace 'check
>> +           (lambda* (#:key tests? #:allow-other-keys)
>> +             (when tests?
>> +               (invoke "pytest")))))))

Ah my bad to miss it. Thanks for catching it.

> That way, tests can be disabled with "--without-tests".
> Try "./pre-inst-env guix build pytest --without-tests=pytests".
> Respecting #:tests? can also be important for cross-compilation.
> 
> Could you send a follow-up patch, or could someone directly
> commit such a change?

I pushed as e61874a598.

Regards,
RG.
Danial Behzadi June 28, 2021, 9:57 p.m. UTC | #3
This is awesome. I think Guix really lacks a very detailed document on packaging. Every patch I wrote is vastly based on apriority assumptions and lots of try and fails.

در 28 ژوئن 2021 21:30:46 (UTC)، Maxime Devos <maximedevos@telenet.be> نوشت:
>> +    (arguments
>> +     '(#:phases
>> +       (modify-phases %standard-phases
>> +         (replace 'check
>> +           (lambda _ (invoke "pytest"))))))
>
>I'm a bit late, as this has already been merged,
>but this should have been something like:
>
>> +         (replace 'check
>> +           (lambda* (#:key tests? #:allow-other-keys)
>> +             (when tests?
>> +               (invoke "pytest")))))))
>
>That way, tests can be disabled with "--without-tests".
>Try "./pre-inst-env guix build pytest --without-tests=pytests".
>Respecting #:tests? can also be important for cross-compilation.
>
>Could you send a follow-up patch, or could someone directly
>commit such a change?
>
>Greetings,
>Maxime.
M June 29, 2021, 8:06 a.m. UTC | #4
دانیال بهزادی schreef op ma 28-06-2021 om 21:57 [+0000]:
> This is awesome. I think Guix really lacks a very detailed document on packaging.
> Every patch I wrote is vastly based on apriority assumptions and lots of try and fails.

Yes, not everything is in the manual.

FWIW, there should be a linter soonish verifying that #:tests? is respected:
<https://issues.guix.gnu.org/48320>. A sample of
'./pre-inst-env guix lint --no-network --exclude=derivation'
output ('derivation' is slow):

gnu/packages/astronomy.scm:898:5: python-jplephem@2.15: the 'check' phase should respect #:tests?
gnu/packages/astronomy.scm:690:5: missfits@2.8.0: sentences in description should be followed by two spaces; possible infraction at 268
gnu/packages/attr.scm:43:5: attr@2.4.48: the 'check' phase should respect #:tests?
gnu/packages/audio.scm:5208:5: ableton-link@3.0.2: the 'check' phase should respect #:tests?
gnu/packages/audio.scm:2484:2: audio-to-midi@2020.7: 'python-cython' should probably be a native input
gnu/packages/audio.scm:2488:6: audio-to-midi@2020.7: the source file name should contain the package name

Greetings,
Maxime.
diff mbox series

Patch

From d5bebceecb3e15313fadb59686303a4a46afa1ce Mon Sep 17 00:00:00 2001
From: Danial Behzadi <dani.behzi@ubuntu.com>
Date: Sat, 26 Jun 2021 15:28:49 -0400
Subject: [PATCH] gnu: Add python-fire.

* gnu/packages/python-xyz.scm (python-fire): New variable.
---
 gnu/packages/python-xyz.scm | 41 +++++++++++++++++++++++++++++++++++++
 1 file changed, 41 insertions(+)

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 6b92200beb..9d5065acd8 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -101,6 +101,9 @@ 
 ;;; Copyright © 2021 LibreMiami <packaging-guix@libremiami.org>
 ;;; Copyright © 2021 Xinglu Chen <public@yoctocell.xyz>
 ;;; Copyright © 2021 Raghav Gururajan <rg@raghavgururajan.name>
+;;; Copyright © 2021 Danial Behzadi <dani.behzi@ubuntu.com>
+;;;
+;;; Copyright 
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -220,6 +223,44 @@ 
   #:use-module (srfi srfi-1)
   #:use-module (srfi srfi-26))
 
+(define-public python-fire
+  (package
+    (name "python-fire")
+    (version "0.4.0")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "fire" version))
+       (sha256
+        (base32
+         "0qka44n88y3qcj7xz0k0f3qb4phcg4z0wvd4jcii9lcr6rvbiqn5"))))
+    (build-system python-build-system)
+    (native-inputs
+     `(("python-pytest", python-pytest)))
+    (arguments
+     '(#:phases
+       (modify-phases %standard-phases
+         (replace 'check
+           (lambda _ (invoke "pytest"))))))
+    (inputs
+     `(("python-six", python-six)
+       ("python-termcolor", python-termcolor)))
+    (synopsis "Library for automatically generating command line interfaces")
+    (description
+     "Fire is a library for automatically generating command line interfaces
+from absolutely any Python object.  The following are the advantages:
+@itemize
+@item A simple way to create a CLI in Python.
+@item A helpful tool for developing and debugging Python code.
+@item Helps with exploring existing code or turning other people's code into a
+command line interface.
+@item Makes transitioning between Bash and Python easier.
+@item Makes using a Python REPL easier by setting up the REPL with the modules
+and variables you'll need already imported and created.
+@end itemize")
+    (home-page "https://github.com/google/python-fire")
+    (license license:asl2.0)))
+
 (define-public python-twodict
   (package
     (name "python-twodict")
-- 
2.32.0