How to use markdown for python with PyCharm? - python

I'm new to python and I've been using PyCharm (4.5 Community Edition) as my IDE on a Mac OS X v11 system. I've installed the markdown plug-in and enabled the package in pycharm (Actions>Plugins>Markdown is checked, program restart complete).
When I create a new markdown file (test.md or test.markdown) I can see the preview tab. But I don't see anything in the preview tab. Also, I can't "run / execute" this file. So seeing a preview would be nice. Ideally, I would like to be able to execute python chunks with markdown comments in-between and see the output rendered in a local browser if this at all is possible.
This was really easy in the Rstudio IDE and a super powerful way to communicate findings.
Any suggestions? Help much appreciated.

Uninstall Markdown Support (by Jetbrains) (has no side preview)
Install Markdown Navigator 2.0 (by Vladimir Schneider) (has side-preview)
https://github.com/vsch/idea-multimarkdown
This should give you a per-compiled side view of you .md file.

I'm on the same boat. Making transition from RStudio to PyCharm. You can install markdown plugins directly within the PyCharm settings. Within Pycharm I searched and downloaded "Markdown support". Once you're editing the Markdown file, you should have a "view" to see the markdown in raw or rendered format and even some formatting buttons like in a normal Text Editor.
I think you need to follow these tag instructions to have the HTML render correctly.
You should also take a look at IntelliLang for language injections, which I think are equivalent to R "chunks".

The default setting for Markdown files - with a fresh copy of Pycharm - is preview mode only:
Just change it to side-by-side mode:
No requirement to install additional plug-ins.
https://www.jetbrains.com/help/idea/markdown.html#preview

Currently PyCharm has two plugin options for .md format: PlantUML and Mermaid.
According to the official docs, in order to enable md support:
Go to File -> Settings -> Languages & Frameworks -> Markdown.
(in recent versions: Pycharm -> Preferences -> Languages & Frameworks -> Markdown)
Install either of these plugins.
Close and Reopen PyCharm (it did not work instantly for me)
In order to see a file preview move a mouse to the upper right corner and select this option.

I've found that a much better way to achieve what I was trying to accomplish when I asked this question is to utilize jupyter notebook (jupyter.org/).

Related

intellisense vscode not showing parameters nor documentation when hovering above with mouse

I'm trying to migrate my entire workflow from eclipse and jupyter notebook all over to VS Code. I installed the python extension, which should come with Intellisense, but it only worse partly. I get suggestions after typing a period, but don't get any information on parameters nor documentation when hovering over with my mouse. Thank you so much for your help and have a wonderful new year!
P.S If anyone has any experience with using anaconda environments with VS Code, that would be greatly appreciated as well as I running into some problems with it recognizing the libraries.
Also you can see here that when I manually activate Intellisense, it doesn't recognize that it's in a method.
Sorry for the long string of edits, but I discovered that when typing print in a regular python file, it works, but not in a jupyter notebook file. Also, it still doesn't work for numpy. Thanks for the help everyone.
You could use the shortcut key "Ctrl+Space" to open the suggested options:
In addition, it is recommended that you use the extension "Pylance", which works better with the extension "Python".
Update:
Currently in VSCode, the "IntelliSense" document content is provided by the Python language service, which is mainly for Python files (".py" files call this function), while in Jupyter, the "IntelliSense" used by the ".ipynb" file comes from the extension "Jupyter". You could refer to the content of this link to use VS code insiders, and its notebook editor has better intellisense.
In VS code insiders:

What is the difference between Jupyter Notebook and JupyterLab?

I am new to Jupyter Notebook, what is the key difference between the Jupyter Notebook and JupyterLab, suggest me to choose the best one, which should be used in future.
Jupyter Notebook is a web-based interactive computational environment for creating Jupyter notebook documents. It supports several languages like Python (IPython), Julia, R etc. and is largely used for data analysis, data visualization and further interactive, exploratory computing.
JupyterLab is the next-generation user interface including notebooks. It has a modular structure, where you can open several notebooks or files (e.g. HTML, Text, Markdowns etc) as tabs in the same window. It offers more of an IDE-like experience.
For a beginner I would suggest starting with Jupyter Notebook as it just consists of a filebrowser and an (notebook) editor view. It might be easier to use.
If you want more features, switch to JupyterLab. JupyterLab offers much more features and an enhanced interface, which can be extended through extensions:
JupyterLab Extensions (GitHub)
1 - To answer your question directly:
The single most important difference between the two is that you should start using JupyterLab straight away, and that you should not worry about Jupyter Notebook at all. Because:
JupyterLab will eventually replace the classic Jupyter Notebook.
Throughout this transition, the same notebook document format will be
supported by both the classic Notebook and JupyterLab
As of version 3.0, JupyterLab also comes with a visual debugger that lets you interactively set breakpoints, step into functions, and inspect variables.
2 - To contradict the numerous claims in the comments that plotly does not run well with JLab:
JupyterLab is an absolutely fantastic tool both to build plotly figures, and fire up complete Dash Apps both inline, as a tab, and externally in a browser.
3 - And you would probably also like to know this:
Other posts have suggested that Jupyter Notebook (JN) could potentially be easier to use than JupyterLab (JL) for beginners. But I would have to disagree.
A great advantage with JL, and arguably one of the most important differences between JL and JN, is that you can more easily run a single line and even highlighted text. I prefer using a keyboard shortcut for this, and assigning shortcuts is pretty straight-forward.
And the fact that you can execute code in a Python console makes JL much more fun to work with. Other answers have already mentioned this, but JL can in some ways be considered a tool to run Notebooks and more. So the way I use JupyterLab is by having it set up with an .ipynb file, a file browser and a python console like this:
And now you have these tools at your disposal:
View Files, running kernels, Commands, Notebook Tools, Open Tabs or Extension manager
Run cells using, among other options, Ctrl+Enter
Run single expression, line or highlighted text using menu options or keyboard shortcuts
Run code directly in a console using Shift+Enter
Inspect variables, dataframes or plots quickly and easily in a console without cluttering your notebook output.
At this time (mid 2019), with JupyterLab 1.0 release, as a user, I think we should adopt JupyterLab for daily use. And from the JupyterLab official documentation:
The current release of JupyterLab is suitable for general daily use.
and
JupyterLab will eventually replace the classic Jupyter Notebook. Throughout this transition, the same notebook document format will be supported by both the classic Notebook and JupyterLab.
Note that JupyterLab has a extensible modular architecture. So in the old days, there is just one Jupyter Notebook, and now with JupyterLab (and in the future), Notebook is just one of the core applications in JupyterLab (along with others like code Console, command-line Terminal, and a Text Editor).
(I am using JupyterLab with Julia)
First thing is that Jupyter lab from my previous use offers more 'themes' which is great on the eyes, and also fontsize changes independent of the browser, so that makes it closer to that of an IDE. There are some specifics I like such as changing the 'code font size' and leaving the interface font size to be the same.
Major features that are great is
the drag and drop of cells so that you can easily rearrange the code
collapsing cells with a single mouse click and a small mark to remind of their placement
What is paramount though is the ability to have split views of the tabs and the terminal. If you use Emacs, then you probably enjoyed having multiple buffers with horizontal and vertical arrangements with one of them running a shell (terminal), and with jupyterlab this can be done, and the arrangement is made with drags and drops which in Emacs is typically done with sets of commands.
(I do not believe that there is a learning curve added to those that have not used the 'notebook' original version first. You can dive straight into this IDE experience)
This answer shows the python perspective. Jupyter supports various languages besides python.
Both Jupyter Notebook and Jupyterlab are browser compatible interactive python (i.e. python ".ipynb" files) environments, where you can divide the various portions of the code into various individually executable cells for the sake of better readability. Both of these are popular in Data Science/Scientific Computing domain.
I'd suggest you to go with Jupyterlab for the advantages over Jupyter notebooks:
In Jupyterlab, you can create ".py" files, ".ipynb" files, open terminal etc. Jupyter Notebook allows ".ipynb" files while providing you the choice to choose "python 2" or "python 3".
Jupyterlab can open multiple ".ipynb" files inside a single browser tab. Whereas, Jupyter Notebook will create new tab to open new ".ipynb" files every time. Hovering between various tabs of browser is tedious, thus Jupyterlab is more helpful here.
I'd recommend using PIP to install Jupyterlab.
If you can't open a ".ipynb" file using Jupyterlab on Windows system, here are the steps:
Go to the file --> Right click --> Open With --> Choose another app --> More Apps --> Look for another apps on this PC --> Click.
This will open a file explorer window. Now go inside your Python installation folder. You should see Scripts folder. Go inside it.
Once you find jupyter-lab.exe, select that and now it will open the .ipynb files by default on your PC.
If you are looking for features that notebooks in JupyterLab have that traditional Jupyter Notebooks do not, check out the JupyterLab notebooks documentation. There is a simple video showing how to use each of the features in the documentation link.
JupyterLab notebooks have the following features and more:
Drag and drop cells to rearrange your notebook
Drag cells between notebooks to quickly copy content (since you can have more than one open at a time)
Create multiple synchronized views of a single notebook
Themes and customizations: Dark theme and increase code font size

Mix python output and markdown in jupyter

I want to be able to show the result of a python computation and have some explanation of it in Markdown. This seems like a fairly simple operation, but I can't figure out how to do it.
Is there any way to do this without installing any extensions to Jupyter?
In the toolbar (see image here http://jupyter-notebook.readthedocs.io/en/latest/_images/jupyter-notebook-default.png), you can set the cell as Markdown in the drop down menu for explanatory text.
Would it suffice if you yourself didn't have to personally handle the installations to Jupyter?
I know OP says specifically, without installing an extension, but what is described is addressed with the Python-Markdown extension, see here. And this question comes up at the top of the list when one Googles "jupyter mix markdown and python print cell".
You can easily use Python-Markdown in an active notebook launched via the MyBinder system from here; the repo for that is here if you want to fork it and further adapt it by adding your own notebooks.

SublimeREPL for IPython under Windows not possible. Any workaround?

SublimeREPL says 'IPython doesn't work under SublimeREPL on Windows' when I select Ipython from it.
Is there any solution out there for this great plugin to work with IPython on Windows as well.
tl;dr: try master branch from github. If something doesn't work, get in touch with me (github issues), I'll try to help:)
Hi everyone,
there is no need for such heated discussion :) SublimeREPL is in a bit of a transitional state right now. Development is progressing steadily (https://github.com/wuub/SublimeREPL/commits/master) with most of my personal focus on Python/IPython.
However there was no release to Package Control for some time now, since I switched to Sublime Text 3 and Linux in march. This is mostly because ST2 (python2) -> St3 (python3) port dropped some functions, and compatibility with OSX & Windows isn't 'production ready' yet. I'm afraid to release current code to everyone, as it'll most definitely not work for some people.
To cut the long story short. SublimeREPL version available in Package Control is stable but out of date. SublimeREPL from git master is used daily by me and several other people, but I test it only on Linux.
Will Bond is planning to roll out new version of Package Control soon (https://twitter.com/wbond/status/334753348018388992). It will allow me to target specific versions of SublieText with different code, and roll out new code separately for compatible platforms.
On a related note: SublimePTY was not updated for a very long time and its future is uncertain at best.
If you haven't made any changes to config files within the Packages/SublimeREPL directory, try erasing/backing it up, and running the following in the Packages directory:
git clone git://github.com/wuub/SublimeREPL.git
to get the absolute latest version. Assuming you have IPython set up properly on your system, you should be able to choose Tools -> SublimeREPL -> Python -> Python - IPython and have it run fine. Make sure you have the latest build of Sublime Text 2. I have it set up at work on WinXP with ST2 Build 2220, IPython 0.13.2, and the latest versions of NumPy and matplotlib/pylab, and it works like a charm.
If this still doesn't work, let me know and I'll try and walk you through it...
When I did a search, the first Google result took me to the Sublime Forums, where this thread says "IPython is working on Windows for some time now".
So, It seems like you just need a newer version of Sublime Text and/or SublimeREPL.
Alternatively, as the SublimeREPL FAQ says:
Is this a terminal emulator?
No. Shell (cmd.exe/bash) REPL can be used for simple tasks (file creation, git init etc.) but anything terminal like (mc, ipython, vim) will not work! SublimeREPL has a sister project: SublimePTY that aims to bring real terminal emulator to SublimeText2.
That seems a little out of date, but you can try SublimePTY anyway.
Finally, it looks like the author of SublimeREPL follows the Sublime Forum pretty closely, and in fact a large chunk of the forum seems to be devoted to plugins. So, you will probably do better asking there, rather than here.

Using VIM for Python IDE in Windows?

I am turning to Python from .NET world. And Visual Studio was something a great tool i used.
In python world we do have basic IDLE and another one is VIM. I have seen that a lot of developers have configured VIM to a great IDE. Using basic VIM in Windows 7 seems of less use.
So i want to moderate my VIM to a level which has file explorer, syntax highlighting, search, error highlighting etc. So that it gives feel of Visual Studio and more productive.
But all hacks/tips available are for Linux/Ubuntu users mostly, which i may use later but as of now i need to make my VIM in Windows more productive, visual.
Please Suggest some Tips/Hacks/Resources to look around for VIM configuration?
Thanks
This question addresses your low level issue: coding Python with an IDE that is not VS.
There are a few popular blog posts addressing your high level issue: setting up Vim for Python development. They are a quick google away…
I feel the need to point out that Vim is not an IDE. You can customize it a lot and end up with something that looks like an IDE but you won't get an IDE. Only an over-customized text editor.
Anyway, here are a few tips for starting out with Vim:
Do $ vimtutor as many times as needed to feel comfortable with the basics.
Get familiar with Vim's buit-in documentation: the answers to most of your questions are somewhere inside. :help gets you to the front page, :help 'option' shows the documentation for option, :help :command shows the documentation for command… Hit <C-]> on a colored word to jump to its definition.
Don't use Janus or SPF13 or whatever pre-packaged set of plugins. You'll only grow bad habits. Similarly, don't copy other people's vimrc wholesale.
Ctags is an external code indexer that is used by Vim to "jump to definition" with <C-]>. cscope is another option, it's more powerful but also a little more complex. See :help tags.
Related to ctags, TagList and TagBar are two popular plugins used to display more or less the equivalent of the Object Browser in VS.
NERDTree is another popular plugin that mimicks the file tree found in many IDEs/editors. But Vim comes with netrw (:Ex) by default, try it before installing NERDTree.
Read :help motion.txt as soon as possible.
Watch Drew Neil's laser-guided vimcasts.
Don't rush it.
you can use vim plugins on windows, http://www.vim.org/scripts/index.php, typing "vim {your feature here}" into google will come up with lots of results.
popular file explorer is nerdtree,
syntax highlighting can be turned on with
syntax on in your vimrc
searching open file is easy to do using reg exes . Initialize search with /.
Searching directory is easy to do using grep.
I don't develop on windows but i have read that Cygwin might be worth installing for some linux tools if not already installed.
I am in no way an evangelist of any Editor/IDE.
But, if you are a newbie to Python I would suggest trying out Sublime Text 2 http://www.sublimetext.com/ . It is a very light weight yet powerful editor with a great following and it has a free evaluation version with no deadline.
But, if you intend to work using frameworks such as Django/ GAE then I would suggest using PyCharm from JetBrains
http://www.jetbrains.com/pycharm/
Finally, these tools are all just personal choices until you get comfortable with one or two of them.
Thanks,
-Hari
One possible compromise is to use your favorite IDE with a vim emulator plugin. For example, in Eclipse you can use Vrapper, PyCharm has IdeaVim and so forth. Lighttable also has vim key-bindings. The plug-ins (or key-binding options) give you some of the benefits of editing in Vim while still having the powerful debugging / navigation features, etc. of a full-blown IDE. BTW, Vrapper works with PyDev.
Using an emulator in an IDE allows you to gain the "muscle-memory" necessary for effective vim editing, without getting bogged down in "configuration hell" associated with turning an editor into an IDE (which auto-complete plugin do I use?..etc.?). Once you have mastered the vim keystrokes for normal and visual mode, used along with insert mode, you may decide to continue on into pure Vim and face those issues.
I wouldn't recommend to learn VIM in 2012 (despite it being a great editor). If you must, this blog post will get you started.
But VIM isn't an IDE, it's a text editor.
If you really want a powerful IDE, try IntelliJ IDEA or Eclipse. Both have great plugins to turn them into Python IDEs (along with code completion and all the other nice time savers). For Eclipse, try PyDev. For IntelliJ, search for Python in the plugin preferences pages.

Categories

Resources