I am writing my first small package.
I found Nemo useful for my purpose and I am using it in my package.
But it comes with a small trouble: it prints a banner in the Jupyter notebook when it is loaded.
Below is the code from Nemo where this happens.
Would you see how to mute this banner from within my package?
I could mute it by adding something within the Jupyter notebook:
either setting ENV[“NEMO_PRINT_BANNER”]=…
or using redirect_stdout()
But this is almost as annoying as the banner itself !
Adding these commands within the package doesn’t work!
Any suggestion?
Thanks
Michel
if isinteractive() &&
!any(x -> x.name in ("Hecke", "Oscar", "Singular"), keys(Base.package_locks)) &&
get(ENV, "NEMO_PRINT_BANNER", "true") != "false"
println("")
println("Welcome to Nemo version $(version())")
println("")
println("Nemo comes with absolutely no warranty whatsoever")
println("")
end
I can indeed redirect within my Juoyter notebook, this works:
oldstd = stdout
redirect_stdout(open("nul", "w"))
using myPackage
redirect_stdout(oldstd)
Within myPackage I am using the Nemo package which is the banner emitter.
However, if I move the redirect to within myPackage:
Module myPackage
....
oldstd = stdout
redirect_stdout(open("nul", "w"))
using Nemo
redirect_stdout(oldstd)
....
end
then I get the banner again in my notebook.
I would like to keep the Jupyter notebook clean and simple.
Therefore I would prefer just using myPackage instead of extra code.
Looks like this is not possible with redirect?
Probably for good reasons, like avoiding packages to perturb the caller i/o .
the redirection you made is run once during precompilation, therefore it has no effect on using myPackage.
I suggest you open a issue in Nemo repository.
Yes, I have read that elsewhere.
However, I did some tests and could not really clarify what it means.
Besides, other people already opened an issue on Nemo, but it was rejected.
So, either I have to live with it, or I have to hope for an unexpected solution, or I also could duplicate the Nemo package and suppress the banner. The last solution is a bit heavy!
Another remark: I only need a very small part of Nemo.
The integer nullspace function.
Who knows, maybe I can find it elsewhere?
module AAA
x = let
println("setting x=2")
2
end
end
you should see “setting x=2” during precompilation, but not during using AAA. the value of x in the module is set once, and doesn’t need to be evaluated/changed at using. That is what precompilation is about.
The only way of changing something in a package elsewhere is to ask (e.g. by opening an issue) the developers to change it. If you don’t ask, it won’t be changed ever
AbstractAlgebra.jl (by the same developers) also has the the nullspace implemented but it comes without banner It will probably be tad slower.
Where did you see that? Nemo.jl is still pretty much actual. It depends on AbstractAlgebra.jl, which sets up the interfaces and implements generic algebraic structures and algorithms. And Nemo.jl implement these interfaces on types which are wrapped from Flint, so you can generally expect more efficiency from Nemo.jl.
AbstractAlgebra.jl grew out of the Nemo project after a number of requests
from the community for the pure Julia part of Nemo to be split
off into a separate project.
Ok! Maybe I misinterpreted your “AA is the successor of Nemo”, but in your link we can read “AA grew out of Nemo”, which certainly doesn’t mean Nemo is superseded by AA.