New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix the Magma interface to work with remote installations #20388
Comments
Branch: u/mmasdeu/20388 |
Commit: |
comment:2
I was able to use it! Note that on the server I have access to I need two commands to launch magma
And Sided note: Would be nice for users to set up their configurations once for all for these external interfaces (via environment variables?). For example, I have access to maple and magma but they live on two different servers. |
comment:3
That's great! I added the 'command' parameter because it could be potentially useful although I didn't need it. I am happy to see that my guess was correct. About setting defaults, have you tried to put
in $HOME/.sage/init.sage? Finally, although I agree that the documentation should advertise more this feature, I don't know where to put it exactly. |
comment:4
Setting them in My question about default configuration did not make much sense since I thought that
then it would not take into account any specific server configuration. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:6
Thanks for testing it! I found two functions (one in arith.all, one in plane_conics/con_field.py) that imported magma. I have changed them to try to use the global magma if it exists (which should be the case if the user initialized it, anyway). |
comment:7
A few things you might want to look at:
|
comment:8
Relying on
I think that the magma interface (and all interface in general) should just have some default configurable parameters. That would be used with something like
|
comment:9
Replying to @videlec:
I would hang those properties on Note that A workaround you can already do if you want to use a magma with non-standard setting is "monkey patch" the global instance, i.e.,
with the problem that if some other file (such as |
comment:10
I have addressed Nils' two concerns above. About the "magma = Magma()" and the configuration parameters, I don't have a quick solution yet. There's a bunch of places in the schemes/ folder that import magma depending on the algorithm chosen. One easy way to fix this is to provide a get_magma_session() and set_magma_session() functions so that something like this would work:
This would only involve changing the calls that look like:
to
Do you think that this is a good enough solution? If so, I would quickly implement it... |
comment:11
Replying to @mmasdeu:
I do not like it so much. It would involve a lot of changes in the schemes/ folder (that people have maybe already copy/paste in their personal code). And, more importantly, it would be different from any other interface in Sage. What about environment variable?
One just needs in the constructor of
A solution based on |
comment:12
Here is what I propose: add the environment variables (which make sense the moment there is a magma = Magma() line in there...), but also change the functions using magma to use the get_magma_session() function. How reasonable is this? |
comment:13
Replying to @mmasdeu:
You are right that it is desirable to have a way to modify it from Sage itself. However, I would not populate the global namespace with Moreover, it is very confusing to have all of: |
comment:14
I think the
If there are other settings to change as well, it may be necessary to override this routine on Magma (and do the usual super() call thing) The main thing is that an instantiated expect interface doesn't run a process on its own. Starting it is a separate operation (and in fact, during the lifetime of an expect object it may start and stop underlying processes repeatedly) The cleaner solution would be to make new |
comment:15
Replying to @nbruin:
I like better this approach. That way the server can even be configured in
I would actually remove the |
Changed branch from u/mmasdeu/20388 to u/mmasdeu/20388-fix |
comment:17
Tested succesfully with Though, there is something wrong with
And even after a Ctrl-C I do not have back the sage prompt (only
(and |
comment:18
Might be too much, but we could even move the environment part inside pexpect
What do you think? To fit with coding conventions could change
And add cross doctests between |
comment:19
An annoying feature
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:31
Setting the default to
which results in
|
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:33
I fixed it by (also) reading the environment variable in magma.py. Each interface can do something similar if needed. |
comment:34
Replying to @videlec:
No, that is the best place to save it because that's one of the few (hopefully persistent) places where you might expect to have write access. Two magma versions tend to have only subtly different namespaces by default, so the enormous cost of trying to differentiate is probably not offset by having slightly more accurate tab completion. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:37
Replying to @nbruin:
I was not complaining about the location, just about potential version clashes. However, this seems to be completely broken (at least with magma 2.11.13 on my computer). |
comment:38
Marc, you did not address [comment:29], see Deprecation in the developer guide. |
Branch pushed to git repo; I updated commit sha1. New commits:
|
comment:40
I have deprecated the function magma_version. When calling it, you get now an explanatory message. I get a ton of other deprecation warnings which I think are not my fault, so I hope that they don't delay the review of this ticket! |
comment:41
Replying to @mmasdeu:
Nope. There is another ticket which actually tracks the issue. This is a problem with the way Sage uses Ipython. |
comment:42
Technically, you deprecated the import in the global namespace but not the function in the module. In other words, this does not raise a warning as it should
(because in the long run, we should just get rid of
Other than that, everything looks good to me. Nils? |
comment:44
This good for me, only needs Nils agreement. Thanks for the fix. Possible follow-up: #13885 |
comment:45
I don't have an axe to grind on this. My general impression is that the proposal here should improve the status quo. |
Reviewer: Nils Bruin, Vincent Delecroix |
Changed branch from u/mmasdeu/20388-fix to |
I have frequently encountered computer setups where one has access to a Sage installation locally, but Magma is only installed in a remote machine (say with address 'remote'). Typically one either:
to pretend having magma installed locally.
Actually Sage has functionality to use (2) in its interface with Magma, but it is currently broken and not advertised. It presumes that 'remote' also has sage installed (in fact it presumes that sage-native-execute is in the default PATH), for example.
This ticket fixes this, and makes a command like
work, and provide the user with an interface to a particular version of Magma installed in 'remote'.
Component: interfaces: optional
Keywords: magma, remote
Author: Marc Masdeu
Branch/Commit:
f499648
Reviewer: Nils Bruin, Vincent Delecroix
Issue created by migration from https://trac.sagemath.org/ticket/20388
The text was updated successfully, but these errors were encountered: