These are chat archives for spyder-ide/public

2nd
Dec 2018
Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 02:29
Basic Spyder 3.2/Jupyter plugin question: Is it possible to close Jupyter notebook tabs? I see a '+' sign to create them but no equivalent to the Editor controls to close any of them. Anaconda 5.3, Python 2.7, MacOS 10.13.6
CAM Gerlach
@CAM-Gerlach
Dec 02 2018 02:32

Spyder 3.2

Spyder 3.2.x is many months to over a year out of date; you should upgrade to 3.3.1 (3.3.2 is the latest, but the current version of spyder-notebook needs a minor update to fix a compatibility issue which is currently in work as discussed above).

@OldGuyInTheClub Did you try Cmd-W?
Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 02:36
Awrk, I am on 3.3.1 sorry. Bad typing. Yes, Cmd-W worked. Thank you. Is it documented anywhere in the menus? Are there other useful shortcuts listed somewhere?
CAM Gerlach
@CAM-Gerlach
Dec 02 2018 02:41

Is it documented anywhere in the menus?

If the command is in a menu, it might be, but I'm not sure—I don't use spyder-notebook myself since I don't use Jupyter notebooks that often. I just guessed based on the universal convention of Ctrl/Cmd-W to close a tab/sub-window. However, with our user contributions (including yours!) we are planning on funding support for plugins to register their own shortcuts in the Keyboard Shortcuts Manager so you can view and configure them as you like, just like Spyder's own shortcuts.

Are there other useful shortcuts listed somewhere?

You can view a cheatsheet of all the shortcuts (updated dynamically based on your custom configuration) in Help --> Shortcuts Summary. We've substantially improved the display on macOS for Spyder 4 so the platform-native key names and symbols are displayed.

Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 02:48
Thanks, those are very helpful. Jupyter notebooks: FWIW, I've never understood the value of the console in Spyder and equivalents. Although Spyder does not output directly to the Notebook, I find that a quick copy/paste from the editor into it or a %run from within it gives me a powerful console alternative - Bokeh plots are interactive, for example whereas they don't render in the console. So, I've minimized the console and used the space to have a notebook open.
Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 02:54
Additional UI questions: 1) Is it possible to adjust the fonts/icons of the window titles? They're hard for my old eyes to see. 2) Also, is there a guide or video to adjusting the panes? I'm able to move them around but it takes me multiple drags per pane to get an adjustable space in a location where I'd like it.
CAM Gerlach
@CAM-Gerlach
Dec 02 2018 07:20

FWIW, I've never understood the value of the console in Spyder and equivalents.

Maybe I misunderstand your question? Being able to run your code and see the results within the application is perhaps the core defining distinction between a text editor and an IDE for an interpreted language. Spyder, like any other "interactive execution"-focused IDEs (Rstudio, Matlab, etc) would be nothing if it wasn't actually able to run your code. The whole point of the workflow it encourages is to be able to easily and flexibly run commands, a line, selection, cell or a whole script, view the results, and iteratively build your analysis routines with a rapid feedback loop and the ability to easily and cheaply explore your data and different approaches to problems.

Although Spyder does not output directly to the Notebook, I find that a quick copy/paste from the editor into it or a %run from within it gives me a powerful console alternative

If you're doing that, you're probably better off just using a good text editor and doing the same thing, since it doesn't take advantage of Spyder's two most powerful features—its Variable Explorer and its interactive execution modes supporting multiple IPython interpreters running in Jupyter kernels across different environments, Python installs and even machines. Furthermore, how are you running your final scripts or creating modules/packages for truly reproducible, re-usable research? If you wanted, you could connect a Console to the kernel attached your Jupyter Notebook instance and send code and commands directly, but

Bokeh plots are interactive, for example whereas they don't render in the console.

Right, that's because they are specifically designed to work only on the Jupyter Notebook environment rather than being interoperable; which is a limitation of Bokeh rather than Spyder. Of course, you can still view them in Spyder-Notebook just like regular Jupyter. Spyder's Consoles are each running the very same IPython interpreter in a Jupyter kernel as the Notebook does, all inside a GUI console emulator that's officially part of project Jupyter (although developed by us now); all the core %magics and capabilities should work essentially the same, plus you get the power of unlimited consoles in different environments, the Variable Explorer, the interactive rich-text Help pane, parallel processing, module auto-reloading, Cython, Sympy and Pylab support, easier integration with running your code, GUI debugger control, more options and customizability...plus, Spyder 4 brings an integrated plot viewer, a powerful debugger, further improvements to the Variable Explorer and more, all of which are only possible through use of Spyder's Consoles.

Therefore, I'm quite curious—which specific capabilities are you finding lacking in Spyder's Consoles wit h regard to code execution that compels you to adopt such a workflow?

Is it possible to adjust the fonts/icons of the window titles?

If it is, you can do it under Preferences > General > Appearance. If that doesn't work, then its controlled by your OS and you'll need to change it there (e.g. System Preferences > Appearance).

Also, is there a guide or video to adjusting the panes?

It can be a little tricky, but hopefully it will become easier with practice; I don't know of a guide per say. However, Spyder 4 already has several improvements in terms of docking/undocking, re-arranging and adjusting panes so hopefully that will help make things easier.

If you'd like a fresh perspective on Jupyter Notebook (and better illuminate some of what I said above), check out this presentation from JupyterCon.
CAM Gerlach
@CAM-Gerlach
Dec 02 2018 08:06

...

Hey, that's my signature response :)

Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 08:08
I'm having a lot of trouble quoting and excerpting in Reply... It looks like whenever I hit a return, a message gets posted...
CAM Gerlach
@CAM-Gerlach
Dec 02 2018 08:08
Shift-Return is your friend
Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 08:24

FWIW, I've never understood the value of the console in Spyder and equivalents.

Maybe I misunderstand your question? Being able to run your code and see the results within the application is perhaps the core defining distinction between a text editor and an IDE...

I was thinking of consoles with static or limited text-only output in comparison to iPython and now Jupyter notebooks (more on this later). IIRC, prior versions of Spyder and other equivalents could not output graphics, static or otherwise. Now with an iPython console, static graphic outputs are possible. With a notebook window, even more seems possible. These are good things, in my opinion - not shortcomings.

Although Spyder does not output directly to the Notebook, I find that a quick copy/paste from the editor into it or a %run from within it gives me a powerful console alternative

If you're doing that, you're probably better off just using a good text editor and doing the same thing, since it doesn't take advantage of Spyder's two most powerful features

No, I mean that I can use all of those tools within Spyder and then copy/paste working code into a Notebook for documentation. I may go off on one or more rants but while I've used Notebooks to learn Python, I've been very frustrated by their limitations and even more frustrated by the heady Notebook PR which I think gets way ahead of reality. There are no visual debuggers, the doc browser is not at all convenient, and it is VERY easy to go off the rails by hopping back and forth among cells.

Bokeh plots are interactive, for example whereas they don't render in the console.

Right, that's because they are specifically designed to work only on the Jupyter Notebook environment rather than being interoperable; which is a limitation of Bokeh rather than Spyder. Of course, you can still view them in Spyder-Notebook just like regular Jupyter.

Yes, I agree. I was pointing this out as a strength of the Spyder/Notebook integration. When I am at work I normally use Matlab. At home I use Python on a 15" Macbook Pro. Having the notebook within the Spyder UI is a much better use of the screen real-estate. All the borders, edges, decorations, etc. take up space when running the two separately. That's now resolved thanks to the integration.

Therefore, I'm quite curious—which specific capabilities are you finding lacking in Spyder's Consoles wit h regard to code execution that compels you to adopt such a workflow?

Again, I think we're discussing a mixture of Spyder revisions. The path I have found based on a few minutes of play I think will allow me to use Spyder to write and test code and Jupyter to document that code. This plays to the strengths of both tools and now I can have them all in one integrated display.

Is it possible to adjust the fonts/icons of the window titles?

If it is, you can do it under Preferences > General > Appearance. If that doesn't work, then its controlled by your OS and you'll need to change it there (e.g. System Preferences > Appearance).

Also, is there a guide or video to adjusting the panes?

It can be a little tricky, but hopefully it will become easier with practice; I don't know of a guide per say. However, Spyder 4 already has several improvements in terms of docking/undocking, re-arranging and adjusting panes so hopefully that will help make things easier.

Thanks for the tips. I'll see what happens with the preferences. I don't think I saw anything for the title bars when I looked earlier but will check again.

Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 08:29

If you'd like a fresh perspective on Jupyter Notebook (and better illuminate some of what I said above), check out this presentation from JupyterCon.

Oof. It is my age showing. I could not make any sense out of the 1/3 of the slide deck that I read before giving up.

bcolsen
@bcolsen
Dec 02 2018 08:32

Right, that's because they are specifically designed to work only on the Jupyter Notebook environment rather than being interoperable; which is a limitation of Bokeh rather than Spyder.

To be fair here, what do we want Bokeh to do to be compatible with Spyder? I think HTML5 is a perfectly interoperable open standard and Spyder needs a way of displaying that data. The only way to be interoperable with Spyder currently is to make a static image or run your own gui process in a popup window.

Perhaps we could display interactive HTML graphs in the new figure gallery with QWebView

Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 08:46
@CAM-Gerlach If you're interested in more of my frustrations with Python, my only two Github entries pertain to them! I also have a separate blog post at https://rettacs.org/a-pitch-by-any-other-name-jupyters-narratives/
CAM Gerlach
@CAM-Gerlach
Dec 02 2018 08:53

IIRC, prior versions of Spyder and other equivalents could not output graphics, static or otherwise.

Right; but that was many, many years ago, when the PyData ecosystem was a vastly different place. Spyder's had built-in IPython consoles since at least 2014, before Jupyter even existed.

With a notebook window, even more seems possible

What I'm curious about is what else we're missing in Spyder proper outside of whiz-bang interactive bokeh figures.

copy/paste working code into a Notebook for documentation

If you're using Jupyter notebooks for documentation, I'd recommend considering using docstrings instead, as well as writing more modular code instead of shoving everything in one big script. Rather than going to all the work and overhead of shoving your code into a walled-garden format that can't really be re-used or automatically introspected, writing good docstrings for modular functions allows you to generate beautiful rich-text documentation that can be retrieved automatically, on-demand with e.g. Spyder's help viewer or other common tools, or built with Sphinx into a form that can be easily deployed to Readthedocs or your own website, all while requiring minimal extra work besides the writing itself and not forcing you to port your code over to a format where it can't easily be re-used.

You could also consider spyder-reports, which allows you to write both normal code and prose Markdown to explain it (basically just like a notebook, but without all the overhead and weirdness) and then its all knitted together into a final document (HTML, PDF, etc) readable by anyone without special tools and more easily deployable to other platforms.

I may go off on one or more rants but while I've used Notebooks to learn Python, I've been very frustrated by their limitations

Very much agreed, and I'm not the only one; these are the very points the presentation I linked rants about as well.

Perhaps we could display interactive HTML graphs in the new figure gallery with QWebView

@bcolson This would be really neat! @jnsebgosselin , any chance of this happening?

Old Guy in the Club
@OldGuyInTheClub
Dec 02 2018 09:11

[deletia]

What I'm curious about is what else we're missing in Spyder proper outside of whiz-bang interactive bokeh figures.

I don't know. I've been working with Spyder 3.3.1 for only a few hours and I think the last time I tried Spyder was indeed 2014-2015-ish. I can't recall exactly which version I had at the time. I thought that the current Spyder Notebook integration was quite slick and would minimize the development team having to come up with solutions to problems that only a few users like myself would use.

copy/paste working code into a Notebook for documentation

If you're using Jupyter notebooks for documentation, I'd recommend considering using docstrings i...
You could also consider spyder-reports, which allows you to write both normal code and prose Markdown to explain it (basically just like a notebook, but without all the overhead and weirdness) and then its all knitted together into a final document (HTML, PDF, etc) readable by anyone without special tools and more easily deployable to other platforms.

Clearly I need to spend more time looking at these features. It sounds like I didn't do a good job in acknowledging 3.3.1's capabilities. What were compliments came off as criticisms.

Documentation: I mean that in a general sense of material I put down so that I can remember what I did if I revisit the code weeks, months, or years later. I don't generally write code that others rely on or have to use. I do calculations, sanity checks, and other early-stage work to see if ideas are feasible, where they might break, etc. None of anything I do gets anywhere close to production. Notebooks have been very good for that. I also acknowledge their value in learning Python. I got frustrated the first time I tried with consoles and IDEs of the time (including Spyder, whichever rev.) Notebooks allowed me to fail fast and often with small chunks of code and got me over many humps. When I tried to use them for more complicated tasks, I saw their limitations.

Walled-garden: I think you're referring to Notebooks but I thought that one of the selling points of Notebooks was the open standards which are said to lower the walls to collaboration? I am not agreeing with the claims, just stating that they've been made repeatedly.

I may go off on one or more rants but while I've used Notebooks to learn Python, I've been very frustrated by their limitations

Very much agreed, and I'm not the only one; these are the very points the presentation I linked rants about as well.

Ok. Maybe one had to be there. I just couldn't follow the author's train of thought and I thought the Smurfs, social media excerpts, and other photos were downright insulting to the audience.

As an aside, I'll be interested to see what happens when Notebooks for education run up against Accessibility. https://groups.google.com/forum/#!topic/jupyter/_ve1GE3Imyg and the references therein. Berkeley had to take down untold hours of course videos because they were not compliant to the ADA.