[PATCH] gnu: Add python-pypandoc.

  • Done
  • quality assurance status badge
Details
2 participants
  • Konrad Hinsen
  • Ricardo Wurmus
Owner
unassigned
Submitted by
Konrad Hinsen
Severity
normal
K
K
Konrad Hinsen wrote on 16 Sep 2020 11:59
(address . guix-patches@gnu.org)
m1ft7iyrd5.fsf@khs-macbook.home
* gnu/packages/python-xyz.scm (python-pypandoc): New variable.
---
gnu/packages/python-xyz.scm | 37 +++++++++++++++++++++++++++++++++++++
1 file changed, 37 insertions(+)

Toggle diff (54 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 593bb3f468..24fc512178 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -129,6 +129,7 @@
#:use-module (gnu packages gsasl)
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages imagemagick)
@@ -21979,3 +21980,39 @@ dates in almost any string formats commonly found on web pages.")
(description "Safety checks installed dependencies for known vulnerabilities.
By default it uses the open Python vulnerability database Safety DB.")
(license license:expat)))
+
+(define-public python-pypandoc
+ (package
+ (name "python-pypandoc")
+ (version "1.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "pypandoc" version))
+ (sha256
+ (base32
+ "1zvn9764cf7kkjkmr9gw6wc8adpk06qxr1rhxwa9pg0zmdvrk90l"))))
+ (build-system python-build-system)
+ (inputs
+ `(("pandoc" ,ghc-pandoc)
+ ("pandoc-citeproc" ,ghc-pandoc-citeproc)))
+ (propagated-inputs
+ `(("pip" ,python-pip)
+ ("setuptools" ,python-setuptools)
+ ("wheel" ,python-wheel)))
+ (native-inputs
+ `(("texlive" ,texlive)))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'disable-tests
+ (lambda _
+ ;; Disable test requiring network access
+ (substitute* "tests.py"
+ (("test_basic_conversion_from_http_url")
+ "skip_test_basic_conversion_from_http_url"))
+ #t)))))
+ (home-page "https://github.com/bebraw/pypandoc")
+ (synopsis "Python wrapper for pandoc.")
+ (description "Thin Python wrapper for pandoc.")
+ (license license:expat)))
--
2.28.0
R
R
Ricardo Wurmus wrote on 16 Sep 2020 12:09
(name . Konrad Hinsen)(address . konrad.hinsen@fastmail.net)(address . 43443@debbugs.gnu.org)
878sdavxrp.fsf@elephly.net
Hi Konrad,

Toggle quote (1 lines)
> * gnu/packages/python-xyz.scm (python-pypandoc): New variable.
[…]

Toggle quote (4 lines)
> + (inputs
> + `(("pandoc" ,ghc-pandoc)
> + ("pandoc-citeproc" ,ghc-pandoc-citeproc)))

Should this really be the Haskell library variants? Or just the
executables? If it’s just the executables you can use the “pandoc” and
“pandoc-citeproc” packages.

Toggle quote (7 lines)
> + (propagated-inputs
> + `(("pip" ,python-pip)
> + ("setuptools" ,python-setuptools)
> + ("wheel" ,python-wheel)))
> + (native-inputs
> + `(("texlive" ,texlive)))

It would be better to avoid this huge monolithic package. Does
texlive-tiny work? If it doesn’t: what else does it need that could be
added to a texlive-union?

Toggle quote (2 lines)
> + (synopsis "Python wrapper for pandoc.")

There should be no trailing period.

Toggle quote (2 lines)
> + (description "Thin Python wrapper for pandoc.")

This should be a complete sentence.
<
--
Ricardo
K
K
Konrad Hinsen wrote on 16 Sep 2020 16:57
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 43443@debbugs.gnu.org)
m17dstzs44.fsf@khs-macbook.home
Hi Ricardo,

Thanks for your comments!

Toggle quote (4 lines)
> Should this really be the Haskell library variants? Or just the
> executables? If it’s just the executables you can use the “pandoc” and
> “pandoc-citeproc” packages.

Ooops, I didn't know there were distinct packages for that! The binaries
are sufficient here.

Toggle quote (4 lines)
> It would be better to avoid this huge monolithic package. Does
> texlive-tiny work? If it doesn’t: what else does it need that could be
> added to a texlive-union?

texlive-tiny doesn't work, and after experimenting for about an hour
I have given up on finding a small combination of packages for
a texlive-union. It needs ifluatex.sty which apparently is part of
texlive-latex-oberdiek, but if I add that package the test fails
in creating a temporary directory for whatever reason.

Another shortcut is disabling the one test case that depends
on LaTeX, and thus completely remove texlive from native-inputs.
Does that sound like an acceptable solution?

Cheers,
Konrad
R
R
Ricardo Wurmus wrote on 16 Sep 2020 17:18
(name . Konrad Hinsen)(address . konrad.hinsen@fastmail.net)(address . 43443@debbugs.gnu.org)
875z8dwy00.fsf@elephly.net
Konrad Hinsen <konrad.hinsen@fastmail.net> writes:

Toggle quote (10 lines)
>> It would be better to avoid this huge monolithic package. Does
>> texlive-tiny work? If it doesn’t: what else does it need that could be
>> added to a texlive-union?
>
> texlive-tiny doesn't work, and after experimenting for about an hour
> I have given up on finding a small combination of packages for
> a texlive-union. It needs ifluatex.sty which apparently is part of
> texlive-latex-oberdiek, but if I add that package the test fails
> in creating a temporary directory for whatever reason.

The attached thing works for me:
Toggle diff (36 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 24fc512178..7f724bc907 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -21994,14 +21994,19 @@ By default it uses the open Python vulnerability database Safety DB.")
"1zvn9764cf7kkjkmr9gw6wc8adpk06qxr1rhxwa9pg0zmdvrk90l"))))
(build-system python-build-system)
(inputs
- `(("pandoc" ,ghc-pandoc)
- ("pandoc-citeproc" ,ghc-pandoc-citeproc)))
+ `(("pandoc" ,pandoc)
+ ("pandoc-citeproc" ,pandoc-citeproc)))
(propagated-inputs
`(("pip" ,python-pip)
("setuptools" ,python-setuptools)
("wheel" ,python-wheel)))
(native-inputs
- `(("texlive" ,texlive)))
+ `(("texlive" ,(texlive-union (list texlive-amsfonts
+ texlive-fonts-ec
+ texlive-latex-hyperref
+ texlive-latex-oberdiek
+ texlive-lm
+ texlive-xcolor)))))
(arguments
`(#:phases
(modify-phases %standard-phases
@@ -22011,6 +22016,8 @@ By default it uses the open Python vulnerability database Safety DB.")
(substitute* "tests.py"
(("test_basic_conversion_from_http_url")
"skip_test_basic_conversion_from_http_url"))
+ ;; XXX: Needed by texlive-union to generate fonts
+ (setenv "HOME" "/tmp")
#t)))))
(home-page "https://github.com/bebraw/pypandoc")
(synopsis "Python wrapper for pandoc.")
--
Ricardo
K
K
Konrad Hinsen wrote on 16 Sep 2020 18:36
(name . Ricardo Wurmus)(address . rekado@elephly.net)(address . 43443@debbugs.gnu.org)
m11rj1znj5.fsf@khs-macbook.home
Ricardo Wurmus <rekado@elephly.net> writes:

Toggle quote (2 lines)
> The attached thing works for me:

OK, so the trick was to set $HOME!

I'll send an updated complete patch in a second...

Cheers,
Konrad
K
K
Konrad Hinsen wrote on 16 Sep 2020 18:37
[PATCH] gnu: Add python-pypandoc.
(address . 43443@debbugs.gnu.org)
m1y2l9y8x8.fsf@khs-macbook.home
* gnu/packages/python-xyz.scm (python-pypandoc): New variable.
---
gnu/packages/python-xyz.scm | 45 +++++++++++++++++++++++++++++++++++++
1 file changed, 45 insertions(+)

Toggle diff (62 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 593bb3f468..2f66e3ff31 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -129,6 +129,7 @@
#:use-module (gnu packages gsasl)
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages imagemagick)
@@ -21979,3 +21980,47 @@ dates in almost any string formats commonly found on web pages.")
(description "Safety checks installed dependencies for known vulnerabilities.
By default it uses the open Python vulnerability database Safety DB.")
(license license:expat)))
+
+(define-public python-pypandoc
+ (package
+ (name "python-pypandoc")
+ (version "1.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "pypandoc" version))
+ (sha256
+ (base32
+ "1zvn9764cf7kkjkmr9gw6wc8adpk06qxr1rhxwa9pg0zmdvrk90l"))))
+ (build-system python-build-system)
+ (inputs
+ `(("pandoc" ,pandoc)
+ ("pandoc-citeproc" ,pandoc-citeproc)))
+ (propagated-inputs
+ `(("pip" ,python-pip)
+ ("setuptools" ,python-setuptools)
+ ("wheel" ,python-wheel)))
+ (native-inputs
+ `(("texlive" ,(texlive-union (list texlive-amsfonts
+ texlive-fonts-ec
+ texlive-latex-hyperref
+ texlive-latex-oberdiek
+ texlive-lm
+ texlive-xcolor)))))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'disable-tests
+ (lambda _
+ ;; Disable test requiring network access
+ (substitute* "tests.py"
+ (("test_basic_conversion_from_http_url")
+ "skip_test_basic_conversion_from_http_url"))
+ ;; Needed by texlive-union to generate fonts
+ (setenv "HOME" "/tmp")
+ #t)))))
+ (home-page "https://github.com/bebraw/pypandoc")
+ (synopsis "Python wrapper for pandoc")
+ (description "pypandoc is a thin Python wrapper around pandoc
+and pandoc-citeproc.")
+ (license license:expat)))
--
2.28.0
R
R
Ricardo Wurmus wrote on 16 Sep 2020 21:31
(name . Konrad Hinsen)(address . konrad.hinsen@fastmail.net)
87lfh9v7pv.fsf@elephly.net
Konrad Hinsen <konrad.hinsen@fastmail.net> writes:

Toggle quote (2 lines)
> * gnu/packages/python-xyz.scm (python-pypandoc): New variable.

Looks good to me. “guix lint python-pypandoc” says that we don’t need
pip and setuptools as propagated-inputs, and I can confirm that the
package builds fine without them.

Is it okay to remove them?

--
Ricardo
K
K
Konrad Hinsen wrote on 17 Sep 2020 07:54
(name . Ricardo Wurmus)(address . rekado@elephly.net)
m1ft7hx816.fsf@ordinateur-de-catherine--konrad.home
Ricardo Wurmus <rekado@elephly.net> writes:

Toggle quote (6 lines)
> Looks good to me. “guix lint python-pypandoc” says that we don’t need
> pip and setuptools as propagated-inputs, and I can confirm that the
> package builds fine without them.
>
> Is it okay to remove them?

Sure! And I have to admit that I completely forgot to run lint.
Summer vacation made me forget some good habits!

Konrad.
K
K
Konrad Hinsen wrote on 17 Sep 2020 09:24
Re: [PATCH] gnu: Add python-pypandoc.
(address . 43443@debbugs.gnu.org)
m1v9gcyieu.fsf@khs-macbook.home
* gnu/packages/python-xyz.scm (python-pypandoc): New variable.
---
gnu/packages/python-xyz.scm | 43 +++++++++++++++++++++++++++++++++++++
1 file changed, 43 insertions(+)

Toggle diff (60 lines)
diff --git a/gnu/packages/python-xyz.scm b/gnu/packages/python-xyz.scm
index 593bb3f468..147c3bccb8 100644
--- a/gnu/packages/python-xyz.scm
+++ b/gnu/packages/python-xyz.scm
@@ -129,6 +129,7 @@
#:use-module (gnu packages gsasl)
#:use-module (gnu packages gstreamer)
#:use-module (gnu packages gtk)
+ #:use-module (gnu packages haskell-xyz)
#:use-module (gnu packages icu4c)
#:use-module (gnu packages image)
#:use-module (gnu packages imagemagick)
@@ -21979,3 +21980,45 @@ dates in almost any string formats commonly found on web pages.")
(description "Safety checks installed dependencies for known vulnerabilities.
By default it uses the open Python vulnerability database Safety DB.")
(license license:expat)))
+
+(define-public python-pypandoc
+ (package
+ (name "python-pypandoc")
+ (version "1.5")
+ (source
+ (origin
+ (method url-fetch)
+ (uri (pypi-uri "pypandoc" version))
+ (sha256
+ (base32
+ "1zvn9764cf7kkjkmr9gw6wc8adpk06qxr1rhxwa9pg0zmdvrk90l"))))
+ (build-system python-build-system)
+ (inputs
+ `(("pandoc" ,pandoc)
+ ("pandoc-citeproc" ,pandoc-citeproc)))
+ (propagated-inputs
+ `(("wheel" ,python-wheel)))
+ (native-inputs
+ `(("texlive" ,(texlive-union (list texlive-amsfonts
+ texlive-fonts-ec
+ texlive-latex-hyperref
+ texlive-latex-oberdiek
+ texlive-lm
+ texlive-xcolor)))))
+ (arguments
+ `(#:phases
+ (modify-phases %standard-phases
+ (add-before 'check 'disable-tests
+ (lambda _
+ ;; Disable test requiring network access
+ (substitute* "tests.py"
+ (("test_basic_conversion_from_http_url")
+ "skip_test_basic_conversion_from_http_url"))
+ ;; Needed by texlive-union to generate fonts
+ (setenv "HOME" "/tmp")
+ #t)))))
+ (home-page "https://github.com/bebraw/pypandoc")
+ (synopsis "Python wrapper for pandoc")
+ (description "The package pypandoc is a thin Python wrapper around
+pandoc and pandoc-citeproc.")
+ (license license:expat)))
--
2.28.0
R
R
Ricardo Wurmus wrote on 17 Sep 2020 11:43
Re: [bug#43443] [PATCH] gnu: Add python-pypandoc.
(name . Konrad Hinsen)(address . konrad.hinsen@fastmail.net)(address . 43443-done@debbugs.gnu.org)
87imccviub.fsf@elephly.net
Konrad Hinsen <konrad.hinsen@fastmail.net> writes:

Toggle quote (11 lines)
> Ricardo Wurmus <rekado@elephly.net> writes:
>
>> Looks good to me. “guix lint python-pypandoc” says that we don’t need
>> pip and setuptools as propagated-inputs, and I can confirm that the
>> package builds fine without them.
>>
>> Is it okay to remove them?
>
> Sure! And I have to admit that I completely forgot to run lint.
> Summer vacation made me forget some good habits!

Heh, no problem!

I pushed it with these changes to the “master” branch with commit
731354b8d7.

--
Ricardo
Closed
?