ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Sun, 07 Jan 2018 00:43:15 +0100Using SAGE from an editorhttps://ask.sagemath.org/question/40279/using-sage-from-an-editor/I was wondering if there is a way to use SAGE in an editor like I can with the Python GUI Idle. I only know how to run it using the terminal or the ntoebook, but if I want to write a lengthy program in SAGE involving several files, I need to start using attach, which is bothersome.
I'm using SAGEmath 8.1 for Windows and Windows 10. I have also Notepad++ in case it helps. I am willing to install any editor that works painlessly with SAGE but I'd rather not use EMACS/Vim. Too many bad memories from college.
Fri, 22 Dec 2017 06:26:39 +0100https://ask.sagemath.org/question/40279/using-sage-from-an-editor/Comment by Iguananaut for <p>I was wondering if there is a way to use SAGE in an editor like I can with the Python GUI Idle. I only know how to run it using the terminal or the ntoebook, but if I want to write a lengthy program in SAGE involving several files, I need to start using attach, which is bothersome.</p>
<p>I'm using SAGEmath 8.1 for Windows and Windows 10. I have also Notepad++ in case it helps. I am willing to install any editor that works painlessly with SAGE but I'd rather not use EMACS/Vim. Too many bad memories from college.</p>
https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?comment=40473#post-id-40473One thing you'll find is that Sage has syntax that is almost but not quite Python--that is, Sage has its own special syntactic extensions to Python. So any editor that supports syntax highlighting for Python will be mostly fine for Sage, but not quite, though I believe people have implemented Sage syntax highlighting for a few different editors--not sure if there's a list of that somewhere. Beyond that though, I'm not sure what you mean by "painless"--you'd have to be more specific. I don't know why you think you need to use attach. If you want to write a complex program involving multiple files you can gather them up into a normal Python package. Now, how to organize a multiple-module Python package is another question, but a skill worth learning.Fri, 05 Jan 2018 16:04:35 +0100https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?comment=40473#post-id-40473Comment by slelievre for <p>I was wondering if there is a way to use SAGE in an editor like I can with the Python GUI Idle. I only know how to run it using the terminal or the ntoebook, but if I want to write a lengthy program in SAGE involving several files, I need to start using attach, which is bothersome.</p>
<p>I'm using SAGEmath 8.1 for Windows and Windows 10. I have also Notepad++ in case it helps. I am willing to install any editor that works painlessly with SAGE but I'd rather not use EMACS/Vim. Too many bad memories from college.</p>
https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?comment=40308#post-id-40308@Iguananaut's answer to this similar question
[https://ask.sagemath.org/question/39742/make-pycharm-recognise-the-sage-python-interpreter/](https://ask.sagemath.org/question/39742/make-pycharm-recognise-the-sage-python-interpreter/)
might also answer your question.Tue, 26 Dec 2017 20:08:52 +0100https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?comment=40308#post-id-40308Comment by slelievre for <p>I was wondering if there is a way to use SAGE in an editor like I can with the Python GUI Idle. I only know how to run it using the terminal or the ntoebook, but if I want to write a lengthy program in SAGE involving several files, I need to start using attach, which is bothersome.</p>
<p>I'm using SAGEmath 8.1 for Windows and Windows 10. I have also Notepad++ in case it helps. I am willing to install any editor that works painlessly with SAGE but I'd rather not use EMACS/Vim. Too many bad memories from college.</p>
https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?comment=40511#post-id-40511Regarding your files as a Python package, see also:
- [Ask Sage question #40036: Importing user Sage files pythonically](https://ask.sagemath.org/question/40036/importing-user-sage-files-pythonically/).Sun, 07 Jan 2018 00:43:15 +0100https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?comment=40511#post-id-40511Answer by Emmanuel Charpentier for <p>I was wondering if there is a way to use SAGE in an editor like I can with the Python GUI Idle. I only know how to run it using the terminal or the ntoebook, but if I want to write a lengthy program in SAGE involving several files, I need to start using attach, which is bothersome.</p>
<p>I'm using SAGEmath 8.1 for Windows and Windows 10. I have also Notepad++ in case it helps. I am willing to install any editor that works painlessly with SAGE but I'd rather not use EMACS/Vim. Too many bad memories from college.</p>
https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?answer=40298#post-id-40298Full disclosure : I have fiddled with computer since 1974. I got my first contact with emacs in 1986 and used it almost exclusively for "hard" editing since about 1990. Therefore, I am *obviously* biased.
I am not aware of an editor able to "run" sage other than... emacs (via [sage_shell_mode](https://github.com/sagemath/sage-shell-mode)).
Before you run away screaming, I have to tell you that sage_shell_mode is really a very nice piece of work, making the development of a complicated work (such as a paper draft) a breeze :
* Using sage in emacs is a nice replacement for the IPython console. Getting your math (properly) typeset and your (2D) graphs in the main window is damn useful.
* Using a buffer for editing your code, then sending it to Sage with two keystrokes severely reduces the development time. And you don't have to worry about code formattong (capital for Python and Python-like languages, since wite space is syntaxically importan !) : the editor will manage it for you.
* Using sage_shell_mode + SageTeX + AUCTeX (a very nice \LaTeX mode for emacs) is, IMNSHO, the only realistic way to produce a good paper (avoiding the troubles you are certain to experience using manual cut'n_paste, for example).
Yes, emacs has a learning curve similar to the [Matterhorn](https://de.wikipedia.org/wiki/Matterhorn) (only a bit steeper...:-). Hence your bad-memories-from-college, probably worsened by the time pressure you suffered then (you need _time_ to grok emacs...).
But it's really worth it. Try perusing the emacs tutorial (standard in all emacs installations), ignoring the outdated bits such as control character for small cursor moves (the moves by paragraph, section, etc... are still relevant)). And give yourself the necessary time to "drink" the process (a couple weeks ?).
Then, try to compare the time necessary to *real* program editing with emacs and your current favorite editor. I'd be surprised if emacs didn't come ahead by a huge margin...
[Obligatory holy wars comparison ;-] Notepad++ ? Bah... And don't get me started on vi(le)...Tue, 26 Dec 2017 12:06:26 +0100https://ask.sagemath.org/question/40279/using-sage-from-an-editor/?answer=40298#post-id-40298