unofficial mirror of guix-devel@gnu.org 
 help / color / mirror / code / Atom feed
* [PATCH] gnu: python-matplotlib: Don't propagate python-numpy-bootstrap.
@ 2017-01-27 15:05 Thomas Danckaert
  2017-01-27 19:57 ` Marius Bakke
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Danckaert @ 2017-01-27 15:05 UTC (permalink / raw)
  To: guix-devel

[-- Attachment #1: Type: Text/Plain, Size: 658 bytes --]

Hi,

when a profile contains both python-numpy and python-matplotlib
(either installed directly or by propagation, e.g. when from
python-ipython), a lot of warnings about conflicts between
python-numpy and python-nympy-bootstrap appear, because matplotlib
propagates its python-numpy-bootstrap dependency.

This patch works around it by creating an intermediate
python-matplotlib-bootstrap package as well, which is then used as a
native input to generate the documentation of python-numpy.
python-numpy is then used as a propagated input of python-matplotlib,
so python-numpy-bootstrap doesn't appear in user's profiles anymore.

What do you think?

Thomas

[-- Attachment #2: 0001-gnu-python-matplotlib-Don-t-propagate-python-numpy-b.patch --]
[-- Type: Text/X-Patch, Size: 3197 bytes --]

From 56a9c4d0f86308fe7bdec1345998c0142c444a4b Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <thomas.danckaert@gmail.com>
Date: Fri, 27 Jan 2017 12:12:42 +0100
Subject: [PATCH] gnu: python-matplotlib: Don't propagate
 python-numpy-bootstrap.

* gnu/packages/python.scm (python-matplotlib-bootstrap,python2-matplotlib-bootstrap):
  New variables.
  (python-matplotlib, python2-matplotlib) [propagated-inputs]: Use
  python-numpy instead of python-numpy-bootstrap.
  (python-numpy, python2-numpy) [propagated-inputs,native-inputs]: Replace
  matplotlib by native inputs matplotlib-bootstrap.
---
 gnu/packages/python.scm | 21 ++++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 1a56008a6..73a940548 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -3404,11 +3404,11 @@ association studies (GWAS) on extremely large data sets.")
      `(("which" ,which)
        ,@(package-inputs python-numpy-bootstrap)))
     (propagated-inputs
-     `(("python-matplotlib" ,python-matplotlib)
-       ("python-pyparsing" ,python-pyparsing)
+     `(("python-pyparsing" ,python-pyparsing)
        ,@(package-propagated-inputs python-numpy-bootstrap)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
+       ("python-matplotlib" ,python-matplotlib-bootstrap) ; to build documentation
        ("python-sphinx" ,python-sphinx)
        ("python-numpydoc" ,python-numpydoc)
        ("texlive" ,texlive)
@@ -3458,7 +3458,11 @@ association studies (GWAS) on extremely large data sets.")
               ,phases)))))))
 
 (define-public python2-numpy
-  (package-with-python2 python-numpy))
+  (let ((numpy (package-with-python2 python-numpy)))
+    (package (inherit numpy)
+             (native-inputs
+              `(("python-matplotlib" ,python2-matplotlib-bootstrap)
+                ,@(alist-delete "python-matplotlib" (package-native-inputs numpy)))))))
 
 (define-public python-pygit2
   (package
@@ -3623,7 +3627,7 @@ transcendental functions).")
        ("gobject-introspection" ,gobject-introspection)
        ("python-tkinter" ,python "tk")
        ("python-dateutil" ,python-dateutil-2)
-       ("python-numpy" ,python-numpy-bootstrap)
+       ("python-numpy" ,python-numpy)
        ("python-pillow" ,python-pillow)
        ("python-pytz" ,python-pytz)
        ("python-six" ,python-six)
@@ -3740,8 +3744,15 @@ toolkits.")
        `(("python2-pycairo" ,python2-pycairo)
          ("python2-pygobject-2" ,python2-pygobject-2)
          ("python2-tkinter" ,python-2 "tk")
+         ("python2-numpy" ,python2-numpy)
          ,@(fold alist-delete (package-propagated-inputs matplotlib)
-                 '("python-pycairo" "python-pygobject" "python-tkinter")))))))
+                 '("python-pycairo" "python-pygobject" "python-tkinter" "python-numpy")))))))
+
+(define python-matplotlib-bootstrap
+  ((package-input-rewriting `((,python-numpy . ,python-numpy-bootstrap))) python-matplotlib))
+
+(define python2-matplotlib-bootstrap
+  ((package-input-rewriting `((,python2-numpy . ,python2-numpy-bootstrap))) python2-matplotlib))
 
 (define-public python2-pysnptools
   (package
-- 
2.11.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: python-matplotlib: Don't propagate python-numpy-bootstrap.
  2017-01-27 15:05 [PATCH] gnu: python-matplotlib: Don't propagate python-numpy-bootstrap Thomas Danckaert
@ 2017-01-27 19:57 ` Marius Bakke
  2017-01-30 10:26   ` Thomas Danckaert
  0 siblings, 1 reply; 3+ messages in thread
From: Marius Bakke @ 2017-01-27 19:57 UTC (permalink / raw)
  To: Thomas Danckaert, guix-devel

[-- Attachment #1: Type: text/plain, Size: 937 bytes --]

Hi Thomas,

Thomas Danckaert <post@thomasdanckaert.be> writes:

> Hi,
>
> when a profile contains both python-numpy and python-matplotlib
> (either installed directly or by propagation, e.g. when from
> python-ipython), a lot of warnings about conflicts between
> python-numpy and python-nympy-bootstrap appear, because matplotlib
> propagates its python-numpy-bootstrap dependency.

Ouch.

> This patch works around it by creating an intermediate
> python-matplotlib-bootstrap package as well, which is then used as a
> native input to generate the documentation of python-numpy.
> python-numpy is then used as a propagated input of python-matplotlib,
> so python-numpy-bootstrap doesn't appear in user's profiles anymore.
>
> What do you think?

This sounds sensible. Does numpy not require any matplotlib functions at
runtime? If so, this patch LGTM. The new matplotlib-bootstrap variables
should have an explaining comment though :)

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 487 bytes --]

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] gnu: python-matplotlib: Don't propagate python-numpy-bootstrap.
  2017-01-27 19:57 ` Marius Bakke
@ 2017-01-30 10:26   ` Thomas Danckaert
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Danckaert @ 2017-01-30 10:26 UTC (permalink / raw)
  To: mbakke; +Cc: guix-devel

[-- Attachment #1: Type: Text/Plain, Size: 1026 bytes --]

From: Marius Bakke <mbakke@fastmail.com>
Subject: Re: [PATCH] gnu: python-matplotlib: Don't propagate 
python-numpy-bootstrap.
Date: Fri, 27 Jan 2017 20:57:12 +0100

>> This patch works around it by creating an intermediate
>> python-matplotlib-bootstrap package as well, which is then used as 
>> a
>> native input to generate the documentation of python-numpy.
>> python-numpy is then used as a propagated input of 
>> python-matplotlib,
>> so python-numpy-bootstrap doesn't appear in user's profiles 
>> anymore.
>>
>> What do you think?
>
> This sounds sensible. Does numpy not require any matplotlib 
> functions at
> runtime?

No. It's just used for the documentation.  With the attached patch, 
the dependency chain is this:

matplotlib -> numpy -> matplotlib-bootstrap -> numpy-bootstrap 
(=“numpy-without-docs”)

> If so, this patch LGTM. The new matplotlib-bootstrap variables
> should have an explaining comment though :)

I've added a comment and fixed some long lines.

Thomas

[-- Attachment #2: 0001-gnu-python-matplotlib-Don-t-propagate-python-numpy-b.patch --]
[-- Type: Text/X-Patch, Size: 3833 bytes --]

From 8a9584dd196dae3520fe2ac4b050a9e0c88503f8 Mon Sep 17 00:00:00 2001
From: Thomas Danckaert <thomas.danckaert@gmail.com>
Date: Fri, 27 Jan 2017 12:12:42 +0100
Subject: [PATCH] gnu: python-matplotlib: Don't propagate
 python-numpy-bootstrap.

* gnu/packages/python.scm (python-matplotlib-bootstrap,python2-matplotlib-bootstrap):
  New variables.
  (python-matplotlib, python2-matplotlib) [propagated-inputs]: Use
  python-numpy instead of python-numpy-bootstrap.
  (python-numpy, python2-numpy) [propagated-inputs,native-inputs]: Replace
  matplotlib by native inputs matplotlib-bootstrap.
---
 gnu/packages/python.scm | 26 ++++++++++++++++++++------
 1 file changed, 20 insertions(+), 6 deletions(-)

diff --git a/gnu/packages/python.scm b/gnu/packages/python.scm
index 81f9200..14d2e23 100644
--- a/gnu/packages/python.scm
+++ b/gnu/packages/python.scm
@@ -33,7 +33,7 @@
 ;;; Copyright © 2016 Arun Isaac <arunisaac@systemreboot.net>
 ;;; Copyright © 2016 Julien Lepiller <julien@lepiller.eu>
 ;;; Copyright © 2016, 2017 Tobias Geerinckx-Rice <me@tobias.gr>
-;;; Copyright © 2016 Thomas Danckaert <post@thomasdanckaert.be>
+;;; Copyright © 2016, 2017 Thomas Danckaert <post@thomasdanckaert.be>
 ;;; Copyright © 2017 Carlo Zancanaro <carlo@zancanaro.id.au>
 ;;;
 ;;; This file is part of GNU Guix.
@@ -3404,11 +3404,11 @@ association studies (GWAS) on extremely large data sets.")
      `(("which" ,which)
        ,@(package-inputs python-numpy-bootstrap)))
     (propagated-inputs
-     `(("python-matplotlib" ,python-matplotlib)
-       ("python-pyparsing" ,python-pyparsing)
+     `(("python-pyparsing" ,python-pyparsing)
        ,@(package-propagated-inputs python-numpy-bootstrap)))
     (native-inputs
      `(("pkg-config" ,pkg-config)
+       ("python-matplotlib" ,python-matplotlib-bootstrap) ; to build documentation
        ("python-sphinx" ,python-sphinx)
        ("python-numpydoc" ,python-numpydoc)
        ("texlive" ,texlive)
@@ -3458,7 +3458,11 @@ association studies (GWAS) on extremely large data sets.")
               ,phases)))))))
 
 (define-public python2-numpy
-  (package-with-python2 python-numpy))
+  (let ((numpy (package-with-python2 python-numpy)))
+    (package (inherit numpy)
+             (native-inputs
+              `(("python-matplotlib" ,python2-matplotlib-bootstrap)
+                ,@(alist-delete "python-matplotlib" (package-native-inputs numpy)))))))
 
 (define-public python-pygit2
   (package
@@ -3623,7 +3627,7 @@ transcendental functions).")
        ("gobject-introspection" ,gobject-introspection)
        ("python-tkinter" ,python "tk")
        ("python-dateutil" ,python-dateutil-2)
-       ("python-numpy" ,python-numpy-bootstrap)
+       ("python-numpy" ,python-numpy)
        ("python-pillow" ,python-pillow)
        ("python-pytz" ,python-pytz)
        ("python-six" ,python-six)
@@ -3740,8 +3744,18 @@ toolkits.")
        `(("python2-pycairo" ,python2-pycairo)
          ("python2-pygobject-2" ,python2-pygobject-2)
          ("python2-tkinter" ,python-2 "tk")
+         ("python2-numpy" ,python2-numpy)
          ,@(fold alist-delete (package-propagated-inputs matplotlib)
-                 '("python-pycairo" "python-pygobject" "python-tkinter")))))))
+                 '("python-pycairo" "python-pygobject" "python-tkinter"
+                   "python-numpy")))))))
+
+;; Use `bootstrap` versions of matplotlib to build numpy documentation.
+(define python-matplotlib-bootstrap
+  ((package-input-rewriting `((,python-numpy . ,python-numpy-bootstrap)))
+   python-matplotlib))
+(define python2-matplotlib-bootstrap
+  ((package-input-rewriting `((,python2-numpy . ,python2-numpy-bootstrap)))
+   python2-matplotlib))
 
 (define-public python2-pysnptools
   (package
-- 
2.7.4


^ permalink raw reply related	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2017-01-30 10:26 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-01-27 15:05 [PATCH] gnu: python-matplotlib: Don't propagate python-numpy-bootstrap Thomas Danckaert
2017-01-27 19:57 ` Marius Bakke
2017-01-30 10:26   ` Thomas Danckaert

Code repositories for project(s) associated with this public inbox

	https://git.savannah.gnu.org/cgit/guix.git

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).