diff mbox series

[bug#68159] gnu: Add python-camb.

Message ID 8734vjz2j7.fsf@troyfigiel.com
State New
Headers show
Series [bug#68159] gnu: Add python-camb. | expand

Commit Message

Troy Figiel Dec. 30, 2023, 11:23 p.m. UTC
* gnu/packages/astronomy.scm (python-camb): New variable.
---
 gnu/packages/astronomy.scm | 53 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 53 insertions(+)


base-commit: b8aea26c4f45dfb34deefe980c6d6002d6aa12f3

Comments

Troy Figiel Dec. 30, 2023, 11:49 p.m. UTC | #1
This package definition has been lying around in my channel for a while,
because of its license. It seems to be a rather complicated situation
with licenses coming from three different programs. The license for
CMBFAST is directly included in the CAMB software, since CAMB is its
successor. COSMICS, however, seems to be a completely separate program.

I managed to track down the original COSMICS program and added a link to
the patch. It has an MIT license I do not recognize though. The license
is a free license and reminiscent of the Expat license, but seems to
have an additional advertising clause near the end.

Any ideas/comments are more than welcome!

Best wishes,

Troy
Sharlatan Hellseher Jan. 16, 2024, 6:56 p.m. UTC | #2
Hi Troy,

Thank you for the patch.

I could build it locally and all tests passed just fine. The license
question might need to be checked with our license team.

How about to pack the tests git checkout as internal package with
copy-build-system, thinking if it would be usefully in some others?

Thanks,
Oleg
Sharlatan Hellseher Jan. 16, 2024, 7:09 p.m. UTC | #3
Hi,

I would appreciate your expertise in this license case. It is a maintained
fork of an older project written in Python and Fortran.

Thanks,
Oleg
Troy Figiel Jan. 17, 2024, 11:14 a.m. UTC | #4
Hi Oleg,

Perfect! I wasn't aware there was a license team that could look into this.

I think it would make sense a lot of sense to have the git checkout of
HMCode_test_outputs as a separate package. It seems more HMCode-type
packages exist, which might need access to that repo. I would be more
than happy making these changes.

It does bring up a point I hadn't thought about before: What is the
license of the data? It is only used in the build process, but that data
will be saved by the Software Heritage if I understand correctly. What
do you think?

Secondly, there is a dependency on a git submodule called forutils. I
originally assumed this was code specifically used for python-camb, but
it is included on the Fortran wiki as a separate library (and has an
expat license only, no LGLP3 components).

I have no experience using/packaging Fortran, but it has a Makefile, so
could give it a shot. Should we turn this into a separate package as well?


Best wishes,

Troy


On 2024-01-16 19:56, Sharlatan Hellseher wrote:
> Hi Troy,
> 
> Thank you for the patch.
> 
> I could build it locally and all tests passed just fine. The license
> question might need to be checked with our license team.
> 
> How about to pack the tests git checkout as internal package with
> copy-build-system, thinking if it would be usefully in some others?
> 
> Thanks,
> Oleg
Simon Tournier Jan. 17, 2024, 3:19 p.m. UTC | #5
Hi,

On Tue, 16 Jan 2024 at 19:09, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:

> I would appreciate your expertise in this license case. It is a maintained
> fork of an older project written in Python and Fortran.

Well, I do not feel an expert on the topic.  From my point of view,
there is two points:

 1. As mentioned, an unclear license of the current product because it
    is adapted from previous codes.

--8<---------------cut here---------------start------------->8---
Portions of this software were originally based on
CMBFAST  by  Uros Seljak and Matias Zaldarriaga, itself based on Boltzmann code written by Edmund
Bertschinger, Chung-Pei Ma and Paul Bode.

Original CMBFAST copyright and disclaimer:

Copyright 1996 by Harvard-Smithsonian Center for Astrophysics and
the Massachusetts Institute of Technology.  All rights reserved.

THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. OR C.f.A. MAKE NO
REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
By way of example, but not limitation,
M.I.T. AND C.f.A MAKE NO REPRESENTATIONS OR WARRANTIES OF
MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
THE USE OF THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.

portions of this software are based on the COSMICS package of
E. Bertschinger.  See the LICENSE file of the COSMICS distribution
for restrictions on the modification and distribution of this software.
--8<---------------cut here---------------end--------------->8---

For this point #1, my understanding is:

 a) The license applied by copyright holders is not clear.  However,
    since the license of the modifications is LGPL (with exceptions), we
    could assume that people modifying (and redistributing) the code
    have the right to do.

 b) It is not dual-licensed and not explicitly ’expat’.  Somehow, MIT is
    the copyright holder but that does not imply the license is ’expat’.


 2. It is not plain LGPL but considering 3 exceptions.

--8<---------------cut here---------------start------------->8---
LICENSING
-------------------------------

You are licensed to use this software free of charge within the terms of the LGPL (see below), with
these additional conditions:

- Any publication using results of the code must be submitted
  to arXiv.org at the same time as, or before, submitting to a
  journal. arXiv must be updated with a version equivalent to
  that accepted by the journal on journal acceptance.

- If you identify any bugs you report them as soon as confirmed

- This license, the above copyright notices and disclaimer appear
  on ALL copies of the software and documentation, including
  modifications that you make for internal use or for distribution
--8<---------------cut here---------------end--------------->8---

And from my understanding, these exceptions make the software license
non-free.

Well, I am not a lawyer (IANAL). :-)

Cheers,
simon
Sharlatan Hellseher Jan. 18, 2024, 11:04 a.m. UTC | #6
Hi,

Thank you Simon for details licence check!

Troy, if you still want to contribute your patch for wide audience of Guix
users, please take a look at maintained by Ricardo channels for
Scientific software:

https://github.com/guix-science/guix-science
https://github.com/guix-science/guix-science-nonfree

Thanks,
Oleg

On Wed, 17 Jan 2024 at 20:25, Simon Tournier <zimon.toutoune@gmail.com> wrote:
>
> Hi,
>
> On Tue, 16 Jan 2024 at 19:09, Sharlatan Hellseher <sharlatanus@gmail.com> wrote:
>
> > I would appreciate your expertise in this license case. It is a maintained
> > fork of an older project written in Python and Fortran.
>
> Well, I do not feel an expert on the topic.  From my point of view,
> there is two points:
>
>  1. As mentioned, an unclear license of the current product because it
>     is adapted from previous codes.
>
> --8<---------------cut here---------------start------------->8---
> Portions of this software were originally based on
> CMBFAST  by  Uros Seljak and Matias Zaldarriaga, itself based on Boltzmann code written by Edmund
> Bertschinger, Chung-Pei Ma and Paul Bode.
>
> Original CMBFAST copyright and disclaimer:
>
> Copyright 1996 by Harvard-Smithsonian Center for Astrophysics and
> the Massachusetts Institute of Technology.  All rights reserved.
>
> THIS SOFTWARE IS PROVIDED "AS IS", AND M.I.T. OR C.f.A. MAKE NO
> REPRESENTATIONS OR WARRANTIES, EXPRESS OR IMPLIED.
> By way of example, but not limitation,
> M.I.T. AND C.f.A MAKE NO REPRESENTATIONS OR WARRANTIES OF
> MERCHANTABILITY OR FITNESS FOR ANY PARTICULAR PURPOSE OR THAT
> THE USE OF THE LICENSED SOFTWARE OR DOCUMENTATION WILL NOT INFRINGE
> ANY THIRD PARTY PATENTS, COPYRIGHTS, TRADEMARKS OR OTHER RIGHTS.
>
> portions of this software are based on the COSMICS package of
> E. Bertschinger.  See the LICENSE file of the COSMICS distribution
> for restrictions on the modification and distribution of this software.
> --8<---------------cut here---------------end--------------->8---
>
> For this point #1, my understanding is:
>
>  a) The license applied by copyright holders is not clear.  However,
>     since the license of the modifications is LGPL (with exceptions), we
>     could assume that people modifying (and redistributing) the code
>     have the right to do.
>
>  b) It is not dual-licensed and not explicitly ’expat’.  Somehow, MIT is
>     the copyright holder but that does not imply the license is ’expat’.
>
>
>  2. It is not plain LGPL but considering 3 exceptions.
>
> --8<---------------cut here---------------start------------->8---
> LICENSING
> -------------------------------
>
> You are licensed to use this software free of charge within the terms of the LGPL (see below), with
> these additional conditions:
>
> - Any publication using results of the code must be submitted
>   to arXiv.org at the same time as, or before, submitting to a
>   journal. arXiv must be updated with a version equivalent to
>   that accepted by the journal on journal acceptance.
>
> - If you identify any bugs you report them as soon as confirmed
>
> - This license, the above copyright notices and disclaimer appear
>   on ALL copies of the software and documentation, including
>   modifications that you make for internal use or for distribution
> --8<---------------cut here---------------end--------------->8---
>
> And from my understanding, these exceptions make the software license
> non-free.
>
> Well, I am not a lawyer (IANAL). :-)
>
> Cheers,
> simon
Troy Figiel Jan. 18, 2024, 11:42 a.m. UTC | #7
Hi both of you,

Thank you for the review and the investigative work! That sounds like a
good idea, I will have a look at guix-science and guix-science-nonfree
instead.

Best wishes,

Troy
Sharlatan Hellseher Jan. 21, 2024, 10:42 a.m. UTC | #8
Hi,

I've tried to check the license in project upstream and I'm not sure
what to replay on the answer:

https://github.com/cmbant/CAMB/issues/152#issuecomment-1902283690

> Probably not. But it's a python program, and on pypi, so it can usually
> just be listed as a dependence. I didn't understand why you wanted to
> distribute it separately?

Thanks
Oleg
Troy Figiel Jan. 21, 2024, 12:11 p.m. UTC | #9
Hi Oleg,

I noticed that the problem is actually bigger than trying to package it
for Guix: On PyPI the license is explicitly stated to be the LGPLv3.

If that is the case, it would be incompatible with the additional
conditions, as those make the license non-free. I added a comment asking
for clarification on the author's intentions.

In principle, I could always package it for guix-science-nonfree. Just
haven't had the time to go there yet :-)

Best wishes,

Troy

On 2024-01-21 11:42, Sharlatan Hellseher wrote:
> 
> Hi,
> 
> I've tried to check the license in project upstream and I'm not sure
> what to replay on the answer:
> 
> https://github.com/cmbant/CAMB/issues/152#issuecomment-1902283690
> 
>> Probably not. But it's a python program, and on pypi, so it can usually
>> just be listed as a dependence. I didn't understand why you wanted to
>> distribute it separately?
> 
> Thanks
> Oleg
Maxim Cournoyer Jan. 24, 2024, 3:07 p.m. UTC | #10
Hi Troy,

Troy Figiel <troy@troyfigiel.com> writes:

> Hi both of you,
>
> Thank you for the review and the investigative work! That sounds like a
> good idea, I will have a look at guix-science and guix-science-nonfree
> instead.

Thanks to Simon for reviewing the license details, which indeed appear
non-free.
diff mbox series

Patch

diff --git a/gnu/packages/astronomy.scm b/gnu/packages/astronomy.scm
index da15283ef3..82643510df 100644
--- a/gnu/packages/astronomy.scm
+++ b/gnu/packages/astronomy.scm
@@ -12,6 +12,7 @@ 
 ;;; Copyright © 2023 Iliya Tikhonenko <tikhonenko@mpe.mpg.de>
 ;;; Copyright © 2023 Andreas Enge <andreas@enge.fr>
 ;;; Copyright © 2023 Simon Tournier <zimon.toutoune@gmail.com>
+;;; Copyright © 2023 Troy Figiel <troy@troyfigiel.com>
 ;;;
 ;;; This file is part of GNU Guix.
 ;;;
@@ -1732,6 +1733,58 @@  (define-public python-bayesicfitting
 Herschel.")
     (license license:gpl3+)))
 
+(define-public python-camb
+  ;; The test outputs that are compared against the outputs of the tests in
+  ;; hmcode_test.py are part of an unreleased git repository.
+  (let* ((url "https://github.com/alexander-mead/HMcode_test_outputs")
+         (commit "03cfe3e8bda9335332cbdbd10785f425b4275820")
+         (hash "15092c96layjzp3k3g7cv5kzs42i7dkgmszhkjhch9hl8rdyhp4d")
+         (test-outputs (origin
+                         (method git-fetch)
+                         (uri (git-reference (url url)
+                                             (commit commit)))
+                         (sha256 (base32 hash)))))
+    (package
+      (name "python-camb")
+      (version "1.5.2")
+      (source
+       (origin
+         (method url-fetch)
+         (uri (pypi-uri "camb" version))
+         (sha256
+          (base32 "1li20qj1qfcg6i9l71ijgd5s2saii5bvszbaq72pn8q7d4q5w29m"))))
+      (build-system python-build-system)
+      (arguments
+       (list
+        #:phases #~(modify-phases %standard-phases
+                     (add-before 'check 'copy-test-outputs
+                       (lambda _
+                         ;; hmcode_test.py expects the test output in the
+                         ;; HMcode_test_outputs directory.
+                         (copy-recursively #$(this-package-native-input
+                                              "test-outputs")
+                                           "HMcode_test_outputs"))))))
+      (propagated-inputs (list python-packaging python-scipy python-sympy))
+      (native-inputs `(("gfortran" ,gfortran)
+                       ;; The which command is used to check whether ifort or
+                       ;; gfortran exist.
+                       ("which" ,which)
+                       ("test-outputs" ,test-outputs)))
+      (home-page "https://camb.info/")
+      (synopsis "Code for Anisotropies in the Microwave Background")
+      (description
+       "@code{python-camb} is a Python package that can be used to calculate
+the cosmic microwave background, lensing, galaxy count, dark-age 21cm power
+spectra, matter power spectra and transfer functions.  There are also general
+utility functions for cosmological calculations such as the background
+expansion and distances.")
+      ;; This package is dual-licensed, because it is also based on the older
+      ;; programs CMBFAST and COSMICS. Notices can be found in the appropriate
+      ;; source files. The original CMBFAST copyright notice can be found in
+      ;; LICENSE.txt. See https://web.mit.edu/edbert/cosmics-1.04.tar.gz for
+      ;; the original COSMICS license.
+      (license (list license:expat license:lgpl3+)))))
+
 (define-public python-casa-formats-io
   (package
     (name "python-casa-formats-io")