Open IPython at startup in Sublime Text 3 - ipython

I am trying to customize the Sublime Text 3 settings for Python files in a Python.sublime-settings file. What I want to do is have two columns in the layout and automatically open the IPython console in the right column on opening a python file in sublime text. I have SublimeREPL installed for IPython.
I can get the layout split in 2 columns using,
"Layout": 2
But I can't seem to figure out how to set IPython to open automatically.
Any ideas? Thanks.

Related

VS Code and Jupyter Notebook - how to open large output in text editor?

I'm running jupyter notebooks in VSCode and have a return of a very large json - too large to see it all in the jupyter notebook.
When I prettyprint the json in VSCode, it shows some of the data, then:
"show more (open the raw output data in a text editor) . . . "
When I click on that, VSCode pops up a msg, "The window is not responding".
How do I make this link work and open that json in Notepad++, which is installed?
Alternatively, how can I dump this json to text file so I can view in a text editor?
Once notebooks were natively supported by VSCode, the setting changed to notebook.output.textLineLimit.
You can try to set the 'Max Output Size', which is the setting of the jupyter extension, and check if it works.
If the 'Max Output Size' can't work, use logs or files to keep your output is wise.

How to open .ipyjn files with preview notebook editor by default

I am using the latest updated version of VScode Insiders. While working with .ipyjn files I have noticed that it is WAY better to edit them with preview notebook editor instead of the classical notebook editor.
Is there a way to open these files by default with the preview editor?
Thank you!
if you use VSCode insider and want the VSCode open Jupyter notebook in default editor add this line "jupyter.experiments.optOutFrom": ["NativeNotebookEditor"], to your settings.json file, otherwise remove it.
here is a link

how to disable jupyter editor in vscode

like the title mentioned, how to disable jupyter editor in vscode?
every time,I want to new a file just for text or markdown,I do not like to appear a choice between two, but just default for the inner editor applied by vscode. and how can I configure this.
for right now,I never need to use jupyter notebook.
It seems to be appeared unexpected after vscode update or installed some python package.
This can be disabled by python.dataScience.useNotebookEditor if you are using the Python extension.
Source: https://github.com/microsoft/vscode/issues/103526
Update:
You also need the Jupyter extension along with Python extension for VS Code. The setting key has been renamed from python.dataScience.useNotebookEditor to jupyter.useNotebookEditor^update
With the July/August 2021 introduction of the new Native Notebook Support in VS Code, the answers involving your settings.json are now obsolete. Now the Notebook editor will be used to open .*ipynb files even if you've never installed the Python or Jupyter extensions.
However, you can open a *.ipynb file in the regular text editor by right-clicking on the file in the VS Code File Explorer, doing "Open With", and then selecting the "Text Editor".

VSCode: How to export a python file that was imported from a Jupyter Notebook back to Jupyter format?

Probably a silly question, but I couldn't find it. Visual Studio Code editor has a really nice way to work with Jupyter Notebooks. I can edit the cells directly in vscode and run them. Now it would be easy to work with version control.
But I couldn't find a way to convert it back to a Notebook! How do I generate a notebook back from the generated python file?
I understand that the notebook wouldn't have the output cells in it.
There is an option in the interactive Python window that has the notebook output:
This is really cool, now you can work in a Python file and have a really nice interface with your version configuration system (Git).
Yes, it was a silly question :-)
The Jupytext library supports the percent-based cell format used by VSCode-Python, as well as other text-based notebook interchange formats:
https://github.com/mwouts/jupytext
If you need more control over how conversion to ipynb is done (or you need to have cross-references) then you can give a try to Pandoctools. It can export VSCode *.py documents to any Pandoc output format or to Jupyter notebook.
For example you can create and register Jupyter kernel. For example is can be named "nn". That should be the same kernel that you selected in VSCode (there you select it by path but VSCode still uses installed kernels specs under the hood). Then add hat to the Python file, split document to cells, provide settings and set Markdown cells (commented metadata line would export to pdf instead of ipynb; I recommend to open ipynb in nteract native app):
"""
---
kernels-map:
py: nn
jupyter:
kernelspec:
display_name: nn
language: python
name: nn
pandoctools:
# out: "*.pdf"
out: "*.ipynb"
...
# Markdown section title 1
Some **static** Markdown text.
"""
# %% {echo=False}
import IPython.display as ds
import math
import sugartex as stex
# %% {markdown}
"""
# Markdown section title 2
The quick brown Fox jumps over the lazy dog.
"""
# %%
ds.Markdown(stex.pre(f'''
Some **dynamic** Markdown text with SugarTeX formula: ˎα^˱{math.pi:1.3f}˲ˎ.
It works because of the `Markdown` display option and `sugartex` Pandoc filter.
Acually `stex.pre` is redundant here but it is needed when the text is imported
or read from somewhere instead of being written in the same document.
'''))
Then convert the file via pandoctools: drag and drop file to pandoctools shortcut/executable or "open with" pandoctools executable.
Also see:
Two introduction articles are at the beginning of this README,
examples of input to output conversion that have cross-references!
how to use Pandoctools and it's CLI,
how to use Knitty that collects Jupyter outputs and change it's settings.
Use jupytext library:
Install:
pip install jupytext
Now open CMD or internal terminal to the folder with your .py file
Run this:
jupytext --set-formats py:percent,ipynb filename.ipynb

Does VSCode has a console like the Sublime Text console?

On the Sublime Text console we can run python commands, use the Sublime Text api. See the error messages from the packages, and much more. Does VSCode has such feature?
Yes, it has Integrated Terminal and you can chose what to use in it - PowerShell/Bash/CMD, also Debug Console, code Output and Problems tab for the current workspace