diff mbox series

[bug#42087,6/6] gnu: Add python-pre-commit.

Message ID 20200627154645.64264-6-monego@posteo.net
State Accepted
Headers show
Series [bug#42082,1/6] gnu: Add python-covdefaults. | expand

Checks

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

Commit Message

Vinicius Monego June 27, 2020, 3:46 p.m. UTC
* gnu/packages/python-xyz.scm (python-pre-commit): New variable.
---
 gnu/packages/python-xyz.scm | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

Comments

Marius Bakke July 20, 2020, 9:36 p.m. UTC | #1
Vinicius Monego <monego@posteo.net> writes:

> * gnu/packages/python-xyz.scm (python-pre-commit): New variable.

[...]
  
> +(define-public python-pre-commit
> +  (package
> +    (name "python-pre-commit")
> +    (version "2.5.1")
> +    (source
> +     (origin
> +       (method url-fetch)
> +       (uri (pypi-uri "pre_commit" version))
> +       (sha256
> +        (base32 "1ivl921kdk9wga2cix4j9ydvs3dryqaaayq496pzjmz2y3w3qins"))))
> +    (build-system python-build-system)
> +    (arguments
> +     `(#:tests? #f)) ;tests require python-tox >= 3.13

Do they really require Tox directly?  Tox is fairly redundant in Guix,
as all it does is create an isolated environment for running tests,
which Guix already does.  So the usual approach is to copy the command
for running tests out of tox.ini and run it directly in the check
phase.  Is that an option here?

> +    (propagated-inputs
> +     `(("python-cfgv" ,python-cfgv)
> +       ("python-identify" ,python-identify)
> +       ("python-nodeenv" ,python-nodeenv)
> +       ("python-pyyaml" ,python-pyyaml)
> +       ("python-toml" ,python-toml)
> +       ("python-virtualenv" ,python-virtualenv)))

Does this program produce a regular executable?  I.e. it's not intended
for use as a library?  In that case you can simply add these as regular
inputs, and the executable will be "wrapped" with the correct
PYTHONPATH.

Also, maybe we can omit the python- prefix here too, and perhaps place
it in version-control.scm?

> +    (home-page "https://pre-commit.com/")
> +    (synopsis "Framework for managing and maintaining multi-language pre-commit hooks")
> +    (description
> +     "Pre-commit is a multi-language package manager for pre-commit hooks.  You
> +specify a list of hooks you want and pre-commit manages the installation and
> +execution of any hook written in any language before every commit.")

Woow, a package manager for pre-commit hooks, amazing.  LGTM.  :-)

Can you send a v2 series?  By the way, great job at enabling tests for
the other packages.
Vinicius Monego July 21, 2020, 6:57 p.m. UTC | #2
Em seg, 2020-07-20 às 23:36 +0200, Marius Bakke escreveu:

> Do they really require Tox directly?  Tox is fairly redundant in
> Guix,
> as all it does is create an isolated environment for running tests,
> which Guix already does.  So the usual approach is to copy the
> command
> for running tests out of tox.ini and run it directly in the check
> phase.  Is that an option here?

I read CONTRIBUTING.md and those were the instructions. I was running
into weird error messages and assumed the cause was tox not being used.

But, nevermind. It was simply that, like in the previous packages, the
PyPI tarball does not include tests. I downloaded a git checkout and
now the tests are running, though with many deselections.

> Does this program produce a regular executable?  I.e. it's not
> intended
> for use as a library?  In that case you can simply add these as
> regular
> inputs, and the executable will be "wrapped" with the correct
> PYTHONPATH.

That's correct. It provides a regular executable.

> Also, maybe we can omit the python- prefix here too, and perhaps
> place
> it in version-control.scm?

That makes sense to me.

> Can you send a v2 series?

I will bump some versions, enable tests here and send a v2 by the
weekend.
diff mbox series

Patch

diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 9eac0ff74f..972eb64d8e 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -16852,6 +16852,34 @@  Glob2 currently based on the glob code from Python 3.3.1.")
 (define-public python2-glob2
   (package-with-python2 python-glob2))
 
+(define-public python-pre-commit
+  (package
+    (name "python-pre-commit")
+    (version "2.5.1")
+    (source
+     (origin
+       (method url-fetch)
+       (uri (pypi-uri "pre_commit" version))
+       (sha256
+        (base32 "1ivl921kdk9wga2cix4j9ydvs3dryqaaayq496pzjmz2y3w3qins"))))
+    (build-system python-build-system)
+    (arguments
+     `(#:tests? #f)) ;tests require python-tox >= 3.13
+    (propagated-inputs
+     `(("python-cfgv" ,python-cfgv)
+       ("python-identify" ,python-identify)
+       ("python-nodeenv" ,python-nodeenv)
+       ("python-pyyaml" ,python-pyyaml)
+       ("python-toml" ,python-toml)
+       ("python-virtualenv" ,python-virtualenv)))
+    (home-page "https://pre-commit.com/")
+    (synopsis "Framework for managing and maintaining multi-language pre-commit hooks")
+    (description
+     "Pre-commit is a multi-language package manager for pre-commit hooks.  You
+specify a list of hooks you want and pre-commit manages the installation and
+execution of any hook written in any language before every commit.")
+    (license license:expat)))
+
 (define-public python-gipc
   (package
     (name "python-gipc")