MilesCranmer / PySR

High-Performance Symbolic Regression in Python and Julia
https://ai.damtp.cam.ac.uk/pysr
Apache License 2.0
2.44k stars 217 forks source link

Quiet install option #97

Closed patrick-kidger closed 2 years ago

patrick-kidger commented 2 years ago

Something I'd like to use when autogenerating examples in documentation is the ability to pass quiet=True to this julia.install.

https://github.com/MilesCranmer/PySR/blob/d369a9b9ea2fd7b57c3290a0331e828df5269480/pysr/sr.py#L27

MilesCranmer commented 2 years ago

Partly fixed for install and activate, but apparently Pkg.update has no quiet option. Any idea to hack in a quiet mode?

patrick-kidger commented 2 years ago

Hmm, I'm not sure either.

One other thing I can mention is that this line needs gating with an if not quiet though:

https://github.com/MilesCranmer/PySR/blob/96f8639282ec5e2475348ee7a27fcde3fc550467/pysr/sr.py#L54

patrick-kidger commented 2 years ago

Using Julia 1.7.1 then julia> Pkg.update(io=devnull) seems to work for me.

MilesCranmer commented 2 years ago

Thanks! Seems to be working on 0ef4d0599b01417fff26d35bc53ddb0e369f7ce6

patrick-kidger commented 2 years ago

Similarly, what about a quiet runtime option? I'm already passing verbosity=0 but still getting

Activating project at `/tmp/tmpru35511c`
    Updating `/tmp/tmpru35511c/Project.toml`
  [8254be44] + SymbolicRegression v0.7.5
    Updating `/tmp/tmpru35511c/Manifest.toml`
  [c3fe647b] + AbstractAlgebra v0.12.0
  [4fba245c] + ArrayInterface v4.0.2
  [d360d2e6] + ChainRulesCore v1.12.0
  [9e997f8a] + ChangesOfVariables v0.1.2
  [861a8166] + Combinatorics v1.0.2
  [bbf7d656] + CommonSubexpressions v0.3.0
  [34da2185] + Compat v3.41.0
  [9a962f9c] + DataAPI v1.9.0
  [864edb3b] + DataStructures v0.18.11
  [163ba53b] + DiffResults v1.0.3
  [b552c78f] + DiffRules v1.9.1
  [ffbed154] + DocStringExtensions v0.8.6
  [e2ba6199] + ExprTools v0.1.8
...

outputted to stderr.

MilesCranmer commented 2 years ago

Done!

MilesCranmer commented 2 years ago

Actually it looks like this breaks julia 1.5: https://github.com/MilesCranmer/PySR/runs/5034798763.

Not sure we need to support it still but maybe we could just turn off the argument for julia<=1.5.

MilesCranmer commented 2 years ago

^ I turned this off for 1.5 by checking versions with the new function is_julia_version_greater(Main, "1.5"). Should be good now.