IPython workflow (edit, run)

后端 未结 13 1293
后悔当初
后悔当初 2020-12-04 06:30

Is there a GUI for IPython that allows me to open/run/edit Python files? My way of working in IDLE is to have two windows open: the shell and a .py file. I edit the .py file

相关标签:
13条回答
  • 2020-12-04 07:11

    You can use the autoreload module in IPython to automatically reload code.

    Open jupyter qtconsole or jupyter console and type:

    %load_ext autoreload
    %autoreload 2
    from your_work_file import *
    

    Now every time you save your_work_file.py, it will be automatically reloaded.

    Hint: if you want this to happen automatically, put the followinglines in your ipython_config.py file:

    c.InteractiveShellApp.extensions = ['autoreload']         
    c.InteractiveShellApp.exec_lines = ['%autoreload 2']
    
    0 讨论(0)
  • 2020-12-04 07:13
    sudo apt-get install ipython
    

    Once you are done with installing ipython.

    Start ipython from terminal (just hit ipython in the ternminal)

    To run ravi.py file all you need to do is

    %run ravi.py
    
    0 讨论(0)
  • 2020-12-04 07:14

    I want to suggest excellent plugin for vim that makes two-way integration between Vim and IPython: vim-ipython.

    From project page on http://github.com/ivanov/vim-ipython:

    Using this plugin, you can send lines or whole files for IPython to execute, and also get back object introspection and word completions in Vim, like what you get with: object? and object. in IPython.

    This plugin has one big limitation: it doesn't support python 3 (it's planned).

    0 讨论(0)
  • 2020-12-04 07:17

    Take a look at DreamPie. Might be what you are looking for.

    0 讨论(0)
  • 2020-12-04 07:20

    If you like the work-flow under Matlab, then you probably should try the following two:

    1, Try the combination of Spyder and Vim.

    • Edit python files in Vim (Spyder can reload the file automatically)

    • Run the code in Spyder (in the same interpreter, which is important for me):

    • Use F9 to run the current file

    • Ctrl+F9 to run the selected block

    2, Use Vim + conque-shell. (on google code)

    • Open your preferred Python interpreter in Vim,

      e.g., just :ConqueTermSplit python.

    • then visual select some Python code

    • press F9 to paste and run it in the Python interpreter buffer.

    Note: a few more:

    • :ConqueTermVSplit python,

    • :ConqueTerm python

    • :ConqueTermVSplit rlwrap python

      If your interpretor misses readline, you can use rlwrap.

    0 讨论(0)
  • 2020-12-04 07:21

    Try Ptpython. It has much better integration with VIM. You can directly edit in VIM by just pressing V. It also allows browsing your history.. so you can pretty much code in the shell, and incrementally build up your code.

    If you are already familiar with ipython, you can check the advantages of ptpython here:

    https://www.youtube.com/watch?v=XDgIDslyAFM

    0 讨论(0)
提交回复
热议问题