On 2025-09-15 14:49:21, 'Ralf Hemmecke' via sage-devel wrote:
> I have a number of files that I generate from a Makefile and then pass 
> each of their names to a shell with content
> 
> cat $1 | sage -q | sed 's/^sage: //'
> 
> That seems to work fine when I just call "make", but with "make -j12" 
> (there are then several instances of sage running and) I see the error 
> below.
> 
> Clearly, that comes from IPython wanting to save the input history.
> In my situation history saving is useless and unwanted. I need some hint 
> to switch that off. Is this possible by adding some command(s) to the 
> file $1 or can I simply give a particular option to sage to avoid 
> writing to history.sqlite?

I recently closed this because it just went away for me at some point:

  https://github.com/sagemath/sage/issues/33025

I think the locking got smarter, but it can probably never be good
enough to handle a large number of sessions started at once and
running simultaneously.

In general I would suggest using plain python files rather than a sage
shell session for input. For example,

  #!/usr/bin/python3
  from sage.all import *
  print(ZZ(1) + ZZ(1))

which can then be run with "sage -python" or (if you are using your
distro's sage, or have installed it using meson/pip) just "python".

Using sage as a python library avoids the ipython history entirely,
but the big downside is that you can't use any of the magic sage shell
preparsing. So x^2 isn't exponentiation, and the 2 is a python int
rather than a Sage integer -- if you naively try to pipe in a sage
shell session, it's unlikely to work.

If that isn't feasible, another option would be to use a different
DOT_SAGE for each process. If it doesn't break anything else, that
will give each process its own history file. Something like,

  DOT_SAGE=$(mktemp -d) sage ...

-- 
You received this message because you are subscribed to the Google Groups 
"sage-devel" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To view this discussion visit 
https://groups.google.com/d/msgid/sage-devel/aMgT8Ft3TN-5zYPL%40mertle.

Reply via email to