diff mbox series

[bug#53656,2/2] gnu: Add julia-optim.

Message ID 93a51e504cd30094511b1eac3957e10ff800cdf0.1643625386.git.efraim@flashner.co.il
State Accepted
Headers show
Series 2 Julia packages | expand

Checks

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

Commit Message

Efraim Flashner Jan. 31, 2022, 10:40 a.m. UTC
* gnu/packages/julia-xyz.scm (julia-optim): New variable.
---
 gnu/packages/julia-xyz.scm | 48 ++++++++++++++++++++++++++++++++++++++
 1 file changed, 48 insertions(+)

Comments

Simon Tournier Feb. 10, 2022, 4:22 p.m. UTC | #1
Hi Efraim,

Both patches look good to me.


I notice this warning:

--8<---------------cut here---------------start------------->8---
┌ Warning: Package OptimTestProblems does not have LinearAlgebra in its dependencies:
│ - If you have OptimTestProblems checked out for development and have
│   added LinearAlgebra as a dependency but haven't updated your primary
│   environment's manifest file, try `Pkg.resolve()`.
│ - Otherwise you may need to report an issue with OptimTestProblems
└ Loading LinearAlgebra into OptimTestProblems from project dependency, future warnings for OptimTestProblems are suppressed.
--8<---------------cut here---------------end--------------->8---

and...


On Mon, 31 Jan 2022 at 12:40, Efraim Flashner <efraim@flashner.co.il> wrote:

> * gnu/packages/julia-xyz.scm (julia-optim): New variable.

[...]

> +  #:use-module (guix gexp)

[...]

> +       #:phases
> +       #~(modify-phases %standard-phases
> +           (add-after 'unpack 'adjust-tests
> +             (lambda _
> +               ;; TODO: Figure out why this test fails.
> +               (substitute* "test/runtests.jl"
> +                 ((".*l_bfgs.*") "")))))))

...I am thinking loudly if this gexp is required.  There are other many
similar patter without a gexp.  Therefore, for consistency with the
rest, I would be in favor to switch to regular modification of phases.
Or let me know if this is becoming the new patter and I would adapt for
the others.


Cheers,
simom
Efraim Flashner Feb. 13, 2022, 10:23 a.m. UTC | #2
On Thu, Feb 10, 2022 at 05:22:33PM +0100, zimoun wrote:
> Hi Efraim,
> 
> Both patches look good to me.
> 
> 
> I notice this warning:
> 
> --8<---------------cut here---------------start------------->8---
> ┌ Warning: Package OptimTestProblems does not have LinearAlgebra in its dependencies:
> │ - If you have OptimTestProblems checked out for development and have
> │   added LinearAlgebra as a dependency but haven't updated your primary
> │   environment's manifest file, try `Pkg.resolve()`.
> │ - Otherwise you may need to report an issue with OptimTestProblems
> └ Loading LinearAlgebra into OptimTestProblems from project dependency, future warnings for OptimTestProblems are suppressed.
> --8<---------------cut here---------------end--------------->8---

It ends up not being a problem, but I'm left wondering if we should
extend the #:julia-package-foo arguments to add more fields or if we
should just add a custom phase to build a Package.toml that includes all
the fields needed.

> and...
> 
> 
> On Mon, 31 Jan 2022 at 12:40, Efraim Flashner <efraim@flashner.co.il> wrote:
> 
> > * gnu/packages/julia-xyz.scm (julia-optim): New variable.
> 
> [...]
> 
> > +  #:use-module (guix gexp)
> 
> [...]
> 
> > +       #:phases
> > +       #~(modify-phases %standard-phases
> > +           (add-after 'unpack 'adjust-tests
> > +             (lambda _
> > +               ;; TODO: Figure out why this test fails.
> > +               (substitute* "test/runtests.jl"
> > +                 ((".*l_bfgs.*") "")))))))
> 
> ...I am thinking loudly if this gexp is required.  There are other many
> similar patter without a gexp.  Therefore, for consistency with the
> rest, I would be in favor to switch to regular modification of phases.
> Or let me know if this is becoming the new patter and I would adapt for
> the others.

It's definitely the new pattern we're using now. I suppose it's not
really necessary here, but having more instances of it throughout the
codebase also makes it easier to search for examples when others are
looking to use or modify gexps.
diff mbox series

Patch

diff --git a/gnu/packages/julia-xyz.scm b/gnu/packages/julia-xyz.scm
index 7de0c32113..2fcc4cf83e 100644
--- a/gnu/packages/julia-xyz.scm
+++ b/gnu/packages/julia-xyz.scm
@@ -23,6 +23,7 @@ 
 (define-module (gnu packages julia-xyz)
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (gnu packages)
+  #:use-module (guix gexp)
   #:use-module (guix utils)
   #:use-module (guix packages)
   #:use-module (guix git-download)
@@ -3650,6 +3651,53 @@  (define-public julia-nnlib
 doesn't provide any other \"high-level\" functionality like layers or AD.")
     (license license:expat)))
 
+(define-public julia-optim
+  (package
+    (name "julia-optim")
+    (version "1.6.0")
+    (source
+      (origin
+        (method git-fetch)
+        (uri (git-reference
+               (url "https://github.com/JuliaNLSolvers/Optim.jl")
+               (commit (string-append "v" version))))
+        (file-name (git-file-name name version))
+        (sha256
+         (base32 "0nvl3xp9c6r80y9n7fic4zyq2443apfmbcpnx0wvgkv4vsy08x5j"))))
+    (build-system julia-build-system)
+    (arguments
+     (list
+       #:phases
+       #~(modify-phases %standard-phases
+           (add-after 'unpack 'adjust-tests
+             (lambda _
+               ;; TODO: Figure out why this test fails.
+               (substitute* "test/runtests.jl"
+                 ((".*l_bfgs.*") "")))))))
+    (propagated-inputs
+     (list julia-compat
+           julia-fillarrays
+           julia-forwarddiff
+           julia-linesearches
+           julia-nanmath
+           julia-nlsolversbase
+           julia-parameters
+           julia-positivefactorizations
+           julia-statsbase))
+    (native-inputs
+     (list julia-linesearches
+           julia-measurements
+           julia-nlsolversbase
+           julia-optimtestproblems
+           julia-positivefactorizations
+           julia-recursivearraytools
+           julia-stablerngs))
+    (home-page "https://github.com/JuliaNLSolvers/Optim.jl")
+    (synopsis "Optimization functions for Julia")
+    (description "@code{Optim.jl} is a package for univariate and multivariate
+optimization of functions.")
+    (license license:expat)))
+
 (define-public julia-optimtestproblems
   (package
     (name "julia-optimtestproblems")