IPython: Productive Interactive Computing

Overview
https://codecov.io/github/ipython/ipython/coverage.svg?branch=master https://raster.shields.io/badge/Follows-NEP29-brightgreen.png

IPython: Productive Interactive Computing

Overview

Welcome to IPython. Our full documentation is available on ipython.readthedocs.io and contains information on how to install, use, and contribute to the project. IPython (Interactive Python) is a command shell for interactive computing in multiple programming languages, originally developed for the Python programming language, that offers introspection, rich media, shell syntax, tab completion, and history.

IPython versions and Python Support

Starting with IPython 7.10, IPython follows NEP 29

IPython 7.17+ requires Python version 3.7 and above.

IPython 7.10+ requires Python version 3.6 and above.

IPython 7.0 requires Python version 3.5 and above.

IPython 6.x requires Python version 3.3 and above.

IPython 5.x LTS is the compatible release for Python 2.7. If you require Python 2 support, you must use IPython 5.x LTS. Please update your project configurations and requirements as necessary.

The Notebook, Qt console and a number of other pieces are now parts of Jupyter. See the Jupyter installation docs if you want to use these.

Main features of IPython

Comprehensive object introspection.

Input history, persistent across sessions.

Caching of output results during a session with automatically generated references.

Extensible tab completion, with support by default for completion of python variables and keywords, filenames and function keywords.

Extensible system of ‘magic’ commands for controlling the environment and performing many tasks related to IPython or the operating system.

A rich configuration system with easy switching between different setups (simpler than changing $PYTHONSTARTUP environment variables every time).

Session logging and reloading.

Extensible syntax processing for special purpose situations.

Access to the system shell with user-extensible alias system.

Easily embeddable in other Python programs and GUIs.

Integrated access to the pdb debugger and the Python profiler.

Development and Instant running

You can find the latest version of the development documentation on readthedocs.

You can run IPython from this directory without even installing it system-wide by typing at the terminal:

$ python -m IPython

Or see the development installation docs for the latest revision on read the docs.

Documentation and installation instructions for older version of IPython can be found on the IPython website

IPython requires Python version 3 or above

Starting with version 6.0, IPython does not support Python 2.7, 3.0, 3.1, or 3.2.

For a version compatible with Python 2.7, please install the 5.x LTS Long Term Support version.

If you are encountering this error message you are likely trying to install or use IPython from source. You need to checkout the remote 5.x branch. If you are using git the following should work:

$ git fetch origin
$ git checkout 5.x

If you encounter this error message with a regular install of IPython, then you likely need to update your package manager, for example if you are using pip check the version of pip with:

$ pip --version

You will need to update pip to the version 9.0.1 or greater. If you are not using pip, please inquiry with the maintainers of the package for your package manager.

For more information see one of our blog posts:

https://blog.jupyter.org/release-of-ipython-5-0-8ce60b8d2e8e

As well as the following Pull-Request for discussion:

https://github.com/ipython/ipython/pull/9900

This error does also occur if you are invoking setup.py directly – which you should not – or are using easy_install If this is the case, use pip install . instead of setup.py install , and pip install -e . instead of setup.py develop If you are depending on IPython as a dependency you may also want to have a conditional dependency on IPython depending on the Python version:

install_req = ['ipython']
if sys.version_info[0] < 3 and 'bdist_wheel' not in sys.argv:
    install_req.remove('ipython')
    install_req.append('ipython<6')

setup(
    ...
    install_requires=install_req
)

Alternatives to IPython

IPython may not be to your taste; if that's the case there might be similar project that you might want to use:

Ignoring commits with git blame.ignoreRevsFile

As of git 2.23, it is possible to make formatting changes without breaking git blame. See the git documentation for more details.

To use this feature you must:

  • Install git >= 2.23
  • Configure your local git repo by running:
    • POSIX: tools\configure-git-blame-ignore-revs.sh
    • Windows: tools\configure-git-blame-ignore-revs.bat
Comments
  • IPEP 23: Backbone.js Widgets

    IPEP 23: Backbone.js Widgets

    Description

    Adds backbone.js layer on top of comm layer to enable the creation of modular widgets. See IPEP 23 for a detailed description.

    Organization

    • Widget manager /ipython/IPython/html/static/js/widgetmanager.js
    • Javascript models and associated views /ipython/IPython/html/static/js/widgets/widget*.js
    • Python widgets /ipython/IPython/html/widgets/widget*.py
    • Unit tests /ipython/IPython/html/tests/casperjs/test_cases/widgets*.js
    • Example and tutorial notebooks /ipython/examples/widgets/*.ipynb

    Examples

    Examples and tutorials are included in this PR's contents (as seen above) direct link

    Included Widgets

    • CheckboxWidget
    • ToggleButtonWidget
    • ButtonWidget
    • ContainerWidget
    • PopupWidget
    • FloatSliderWidget
    • BoundedFloatTextWidget
    • FloatProgressWidget
    • FloatTextWidget
    • ImageWidget
    • IntSliderWidget
    • BoundedIntTextWidget
    • IntProgressWidget
    • IntTextWidget
    • AccordionWidget
    • TabWidget
    • ToggleButtonsWidget
    • RadioButtonsWidget
    • DropdownWidget
    • SelectWidget
    • HTMLWidget
    • LatexWidget
    • TextareaWidget
    • TextWidget
    opened by jdfreder 158
  • Terminal emulator in the notebook

    Terminal emulator in the notebook

    To try this out: pip install terminado, launch the notebook server, and go to http://localhost:8888/terminals/new (or replace new with any alphanumeric name).

    You have an arbitrary number of named terminals. Tabs open to the same URL share a terminal - this isn't always flawlessly visually, especially if you open a new tab with something like vim already running, because it just sends the output, as it arrives, to all connected tabs, but it works pretty well in my informal tests.

    If it can't load terminado, e.g. because you're on Windows, these handlers don't get added at all.

    For now, terminals are only shut down if you quit your shell inside them. It should be easy, however, to build a REST API which can kill terminal sessions, and a UI on top of that.

    I've copied the relatively minimal JS from terminado into our JS tree, because that seemed simpler than working out how to handle serving JS from another Python package. The big chunk of JS code, term.js, is added to the components submodule in a branch.

    nb terminal screenshot

    opened by takluyver 117
  • Add sticky header effect without Javascript

    Add sticky header effect without Javascript

    This is supposed to be a step to fix issue #7968. It allows to obtain the same current behavior without using Javascript and then it will be possible to fix #7701. However, more input is needed.

    Sticky header when scrolling down:

    screenshot from 2015-03-07 21 23 29

    Keeping the same margin between #header and #site elements when resizing window:

    screenshot from 2015-03-07 21 25 08

    Small issue. If there are scrollbars, the width of the window is calculated differently. As a consequence, the media query is not activated as it should when the header's height is increased:

    screenshot from 2015-03-07 21 25 51

    If the browser is shrunk a bit more, then the media query takes effect. Unfortunately, I don't think there is a clean solution for this. Removing the media queries could be an option to give a more consistent behavior although this reduces the margin between #header and #site in small windows.

    /tree page is not affected by these changes because I added classes specific to /tree and /notebook.

    notebook 
    opened by r-31415 111
  • Break out language magics into their own repos

    Break out language magics into their own repos

    @minrk is responsible for this, but I added this issue because @davclark expressed interest in improving the RMagic.

    Be sure to extract (preserve) the git history for files related to the magic, and any documentation for it (such as example notebooks)

    • [x] %%R magic (work by @davclark, @gmbecker and @lgautier)
    • [x] %%Cython magic
    • [x] %%octave magic (oct2py author @blink1073 is on this)
    notebook R 
    opened by ivanov 101
  • nbformat v4

    nbformat v4

    Still quite a bit to do, but the implemented parts of v4 are working pretty well. I did find and fix some things while testing the validation. Both v3 and v4 have a Draft 4 jsonschema, and use the standard jsonschema format for references, so jsonpointer is no longer used.

    closes #5074

    TODO in separate PRs:

    • backport v4->v3 to 2.x
    • what to do when uploading old notebooks (upgrade on upload, or leave alone and upgrade on open)?
    • [x] add convert 3<->4
    • [x] make v4 current
    • [x] update stream messages to name, text
    • [x] move display_data.png to display_data.data['image/png']
    • [x] what's new
    • [x] decide on UI for downgrade
    • [x] upgrade existing example notebooks
    opened by minrk 92
  • Modal UI

    Modal UI

    The goal of this PR is to fix the various focus related problem in the notebook user experience. The issue for this is #3441. The source of the problem is that we used to call this.code_mirror.focus when a cell was selected. This caused all of the jumpy behavior. However, when this call was removed, the entire user experience fell apart. This PR is an attempt to restore a solid user experience while also removing the problematic focus calls.

    The result is that the notebook is now a dual mode editor with a command mode and edit mode. Command mode is entered using ESC or Ctrl-m. Thus our old keyboard shortcuts still work, but multiple of them can be given after you type Ctrl-m. Edit mode is entered for the current cell by pressing Enter. This is not ready for merge, but we are thinking about trying to merge this for 1.0. But, it will need lots of testing. The code is relatively simple, but the new interaction model is quite subtle and there are numerous tweaks we could make.

    Another side effect is that multiple markdown, rawtext and heading cells can now be unrendered at the same time.

    Overall I think this is a massive improvement of the user experience. But, this needs tons of interactive hands on user experience testing.

    Remaining issues:

    • [ ] Test various notebook and cell actions (cut, copy, paste, merge, split, etc.).
    • [ ] Keyboard shortcuts for command mode need to be turned off when the notebook area is not in focus. This is currently preventing dialogs and other things that require keyboard input from working.
    • [ ] Test and debug tooltips.
    • [ ] Test to make sure that the pager can be closed with ESC.
    • [ ] Test and debug tab completion.
    • [ ] Possibly refactor the keyboard shortcut code to make it all configurable.

    Questions:

    • Do we like how Shift-Enter, Ctrl-Enter and Alt-Enter behave?
    • Should we always enter edit mode when a cell is changed type?
    • Do people like the green border to indicate edit mode?
    • Do we want to keep ESC for entering command mode?
    opened by ellisonbg 88
  • IPEP 21:  widget messages

    IPEP 21: widget messages

    IPEP 21 has full description of the proposal.

    This is just the basic communication tube, through which widgets might communicate.

    It's pretty basic, but it seems to work reasonably well.

    Some example use cases for the Comms implemented here: http://nbviewer.ipython.org/6547109

    This also refactors callbacks in a clearer way, allowing callback cleanup since widget messages dramatically exacerbate #2524.

    closes #2524.

    opened by minrk 85
  • use SockJS instead of pure WebSockets

    use SockJS instead of pure WebSockets

    Should work in more environments than plain websockets.

    Still some work to do, checking out authentication, etc., but the basics definitely work.

    Third-party code added: sockjs-tornado (in IPython.external), sockjs-client (in static/sockjs).

    opened by minrk 85
  • In-process kernel support (take 2)

    In-process kernel support (take 2)

    This PR is functionally equivalent to #2382 but involves substantially less refactoring. Note, however, that ZMQ is now required.

    The gist referenced in the previous PR contains usage examples: https://gist.github.com/3659874.

    opened by epatters 83
  • ImportError: No module named shutil_get_terminal_size

    ImportError: No module named shutil_get_terminal_size

    Update from @carreau : Reopening, tagging 5.4 we should vendor shutil_get_terminal_size.


    After installing ipython sudo apt-get install ipython-notebook , ipython it appears a error, as follows:

    [email protected]:~$ ipython Traceback (most recent call last): File "/usr/local/bin/ipython", line 4, in from IPython import start_ipython File "/usr/local/lib/python2.7/dist-packages/IPython/init.py", line 48, in from .core.application import Application File "/usr/local/lib/python2.7/dist-packages/IPython/core/application.py", line 25, in from IPython.core import release, crashhandler File "/usr/local/lib/python2.7/dist-packages/IPython/core/crashhandler.py", line 28, in from IPython.core import ultratb File "/usr/local/lib/python2.7/dist-packages/IPython/core/ultratb.py", line 128, in from IPython.utils.terminal import get_terminal_size File "/usr/local/lib/python2.7/dist-packages/IPython/utils/terminal.py", line 22, in from backports.shutil_get_terminal_size import get_terminal_size as _get_terminal_size ImportError: No module named shutil_get_terminal_size

    opened by applar 81
  • UI For Metadata

    UI For Metadata

    This a prototype to edit metadata. right now you need to execute

    ``` %%javascript #execute to toggle header to edit metadata of cell $('body').toggleClass('editmetaon') ```

    To see the UI change.

    I'll add a button to the toolbar to do so once #2127 is merged. looks like Imgur

    Cell "header" are togglable by above command, and clicking on "raw edit" bring the modal editor.

    My question is what kind of API do we want to add other buttons to the cell header/toolbar.

    Obviously if an extension want to add a button, the button needs to be be added to all the current cell of a certain type.

    Do we allows extension to be loaded at any time, or do we says that some stuff can only be extended if the extension is loded at notebook load time?

    And we also need maybe an event to say that the metadata have changed.

    Update :

    see this comment To see how to enable.

    opened by Carreau 78
  • Removed the usage of minor-version entrypoints

    Removed the usage of minor-version entrypoints

    Unfortunatly, as discussed here: https://github.com/ipython/ipython/issues/13815. The feature is not implemented correctly as the global wheel has the entrypoints hard-coded to the minor version of the python used to create them. This PR will remove that third entrypoint.

    Side note: I didn't see any github acftion to publish new versions of the package. Will it be ok if I create a new PR with one and if so, would it be acceptible if I make it so the github action would run on all supported minor versions of python to create a wheel that is aware of the minor version (so the feature would be able to be re-implemented)?

    opened by UltimateLobster 0
  • Proposal: Improved multiline editing

    Proposal: Improved multiline editing

    IPython supports multi-line edits when its internal logic determines that the initial input line is not a valid standalone statement (e.g. ends with a colon or has unclosed parentheses). Once inside a multi-line edit, the only way to execute it is to go to the end of the line end press enter twice.

    There are two features that could be independently useful:

    1. Key binding (e.g. CTRL-ENTER) to execute multi-line input regardless of the location of the cursor. This is useful when one is editing a multi-line input and wants to execute it without navigating to the last line and pressing ENTER twice.
    2. Key binding (e.g. SHIFT-ENTER) to force start a multi-line edit (even if the first line is a valid single-line statement).

    What do you think?

    opened by mlucool 0
  • Improve autocomplete UX

    Improve autocomplete UX

    Hi,

    IPython recently introduced hinted suggestions as input is being typed. The user can accept the suggestion by pressing END or RIGHT. Alternatively, the user can scroll through other prefix matches in the history by pressing UP (and DOWN). However, all these modes of navigation move the cursor to the end of the line. It is impossible to accept a prefix of a hinted suggestion.

    We would like to propose keeping the cursor in place and naturally supporting the cursor movement with the logic of “accept anything that is on the LHS of the cursor”. This would allow reusing long prefixes without the need to accept the entire line and make edits from its end.

    For example, suppose the history includes very.long.module.foo.func() very.long.module.bar.Baz() The user types the prefix “very.”. The hinted suggestion would be “long.module.bar.Baz()”. The user can now press:

    1. RIGHT/CTRL-RIGHT to accept letters/words from the hinted completion. This would make it easier to type “very.long.module.bar.Zap()”.
    2. END to accept the entire suggestion.
    3. UP to replace the hinted suggestion with “long.module.foo.func()” (cursor stays in place).
    4. BACKSPACE to delete last character and resume hinting from the new prefix (currently, it aborts hinting).
    5. LEFT to accept the hint and move the cursor to the left.
    6. New key binding to accept the suggestion but keep cursor in place.

    Thoughts?

    opened by mlucool 0
  • pvlib.pvsystem.retrieve_sam

    pvlib.pvsystem.retrieve_sam

    I tried to call a PV Module as below code , But it given an erroe --> KeyError Traceback (most recent call last) ~\miniconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3799 try: -> 3800 return self._engine.get_loc(casted_key) 3801 except KeyError as err:

    ~\miniconda3\lib\site-packages\pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

    ~\miniconda3\lib\site-packages\pandas_libs\index.pyx in pandas._libs.index.IndexEngine.get_loc()

    pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

    pandas_libs\hashtable_class_helper.pxi in pandas._libs.hashtable.PyObjectHashTable.get_item()

    KeyError: 'LONGi_Green_Energy_Technology_Co___Ltd__LR4_72HPH_450M'

    The above exception was the direct cause of the following exception:

    KeyError Traceback (most recent call last) ~\AppData\Local\Temp\ipykernel_17908\2790595467.py in <cell line: 23>() 21 22 modules = pvlib.pvsystem.retrieve_sam('CECMod') ---> 23 M = modules['LONGi_Green_Energy_Technology_Co___Ltd__LR4_72HPH_450M'] 24 25 print (M)

    ~\miniconda3\lib\site-packages\pandas\core\frame.py in getitem(self, key) 3803 if self.columns.nlevels > 1: 3804 return self._getitem_multilevel(key) -> 3805 indexer = self.columns.get_loc(key) 3806 if is_integer(indexer): 3807 indexer = [indexer]

    ~\miniconda3\lib\site-packages\pandas\core\indexes\base.py in get_loc(self, key, method, tolerance) 3800 return self._engine.get_loc(casted_key) 3801 except KeyError as err: -> 3802 raise KeyError(key) from err 3803 except TypeError: 3804 # If we have a listlike key, _check_indexing_error will raise

    KeyError: 'LONGi_Green_Energy_Technology_Co___Ltd__LR4_72HPH_450M

    opened by mhmidat 0
  • frame source code is missing

    frame source code is missing

    When calling inspect.getsource() from within a function (let's call it g) on an upper frame, when that upper frame is the global ipython scope, only the first line of the code is present.

    I'm not sure if this is a design flaw or something that changed recently but would like to hear your thoughts on this.

    In [105]: def g(*x):
         ...:     upper_frame = sys._getframe(1)
         ...:     code = inspect.getsource(upper_frame)
         ...:     print(code)
         ...: 
    
    In [106]: g(1,
         ...:   2)
    g(1,
    
    
    

    Do note, of course this issue is specifically a bare global scope issue. If we make the call to g inside a function, the source code is retrieved just fine (which makes sense since because there you have the function's frame)-

    In [107]: def f():
         ...:     g(1,
         ...:       2)
         ...: 
    
    In [108]: f()
    def f(): 
        g(1,
          2)
    

    I'm not too keen on how ipython actually manages its frame. I do know upper to the global scope is the run_code frame, and it seems to be that the issue is just retrieving from its child <cell line: 1>. I guess because ipython, even when stuff is multi line, stores in frame only cell line 1?

    In [112]: sys._getframe(0
         ...: )
    Out[112]: <frame at 0x2b066d0, file '<ipython-input-112-38b961076835>', line 1, code <cell line: 1>>
    

    thanks

    opened by dankeyy 0
  • Annoying venv warning

    Annoying venv warning

    Hi!

    Using ipython 8.7.0 I just identified that the block below always triggers the annoying warning when I run ipython within a pyenv venv.

    https://github.com/ipython/ipython/blob/d38397b078b744839b8510f7ac9ab4fa40450a4f/IPython/core/interactiveshell.py#L886-L890

    The instance variable warn_venv occurs two times in the whole module (here both locations in the snippets cutout) and seems to be always true.

    https://github.com/ipython/ipython/blob/d38397b078b744839b8510f7ac9ab4fa40450a4f/IPython/core/interactiveshell.py#L511-L514

    I see no point to always get that message although I clearly run the ipython executable in the currently active venv.

    Maybe my symlink setup causes that?

    Here you see something in my neovim session.

    Top pane: the module where above code listings come from Middle pane: vars in a debug session in pdb Bottom pane: my symlink of $HOME/.pyenv and the env var VIRTUAL_ENV

    Maybe someone wants to look deeper into that scenario. For now it looks like a warning that should not appear in this case and I disable it.

    I wish a Merry Christmas, Jamil

    image
    opened by jamilraichouni 6
Releases(7.18.1)
Owner
IPython
interactive computing in Python
IPython
hey, this repo is the backend of the sociio project

sociio backend Hey, this repository is a part of sociio project , In this repo we are working to create an independent server for everything you can i

2 Jun 09, 2022
A QGIS integration plugin for Kart repositories

QGIS Kart Plugin A plugin to work with Kart repositories Installation The Kart plugin is available in the QGIS Plugins server. To install the latest v

Koordinates 27 Jan 04, 2023
Stack-overflow-import - Import arbitrary code from Stack Overflow as Python modules.

StackOverflow Importer Do you ever feel like all you’re doing is copy/pasting from Stack Overflow? Let’s take it one step further. from stackoverflow

Filip Haglund 3.7k Jan 08, 2023
Adansons Base is a data management tool that organizes metadata of unstructured data and creates and organizes datasets.

Adansons Base is a data management tool that organizes metadata of unstructured data and creates and organizes datasets. It makes dataset creation more effective and helps find essential insights fro

Adansons Inc 27 Oct 22, 2022
Neogex is a human readable parser standard, being implemented in Python

Neogex (New Expressions) Parsing Standard Much like Regex, Neogex allows for string parsing and validation based on a set of requirements. Unlike Rege

Seamus Donnellan 1 Dec 17, 2021
Pre-crisis Risk Management for Personal Finance

Антикризисный риск-менеджмент личных финансов Риск-менеджмент личных финансов условиях санкций и/или финансового кризиса: делаем сегодня все, чтобы за

Dmitry Petukhov 593 Jan 09, 2023
Apache Airflow - A platform to programmatically author, schedule, and monitor workflows

Apache Airflow Apache Airflow (or simply Airflow) is a platform to programmatically author, schedule, and monitor workflows. When workflows are define

The Apache Software Foundation 28.6k Dec 28, 2022
Multi-Process / Censorship Detection

Multi-Process / Censorship Detection

Baris Dincer 2 Dec 22, 2021
A python script that changes your desktop background based on current weather and time of the day.

Desktop background wallpaper, based on current weather and time A python script that changes your computer's desktop background based on current weath

Maj Gaberšček 1 Nov 16, 2021
redun aims to be a more expressive and efficient workflow framework

redun yet another redundant workflow engine redun aims to be a more expressive and efficient workflow framework, built on top of the popular Python pr

insitro 372 Jan 04, 2023
TickerRain is an open-source web app that stores and analysis Reddit posts in a transparent and semi-interactive manner.

TickerRain is an open-source web app that stores and analysis Reddit posts in a transparent and semi-interactive manner

GonVas 180 Oct 08, 2022
Persian Kaldi profile for Rhasspy built from open speech data

Persian Kaldi Profile A Rhasspy profile for Persian (fa). Installation Get started by first installing Vosk: # Create virtual environment python3 -m v

Rhasspy 12 Aug 08, 2022
Python scripts to interact with Upper Deck ePack online trading card platform

This script should connect to the Upper Deck ePack API using your browser cookies and download a list of your current collection and save it as a CSV.

Adrian Kent 1 Nov 22, 2021
This interactive script demonstrates the Menezes-Vanstone-EC-Cryptosystem

Menezes-Vanstone-EC-Cryptosystem This interactive script demonstrates the Meneze

Nishaant Goswamy 1 Jan 02, 2022
Animation picker for Audodesk Maya 2017 (or higher)

Dreamwall Picker Animation picker for Audodesk Maya 2017 (or higher) Authors: Lionel Brouyère, Olivier Evers This tool is a fork of Hotbox Designer (L

DreamWall 93 Dec 21, 2022
The ldapconsole script allows you to perform custom LDAP requests to a Windows domain

ldapconsole The ldapconsole script allows you to perform custom LDAP requests to a Windows domain. Features Authenticate with password Authenticate wi

Podalirius 38 Dec 09, 2022
Programa principal de la Silla C.D.P.

Silla CDP Página Web Contáctenos Lista de contenidos: Información del proyecto. Licencias. Contacto. Información del proyecto Silla CDP, o Silla Corre

Silla Control de Postura 1 Dec 02, 2021
New multi tool im making adding features currently

Emera Multi Tool New multi tool im making adding features currently Current List of Planned Features - Linkvertise Bypasser - Discord Auto Bump - Gith

Lamp 3 Dec 03, 2021
Social reading and reviewing, decentralized with ActivityPub

BookWyrm Social reading and reviewing, decentralized with ActivityPub Contents Joining BookWyrm Contributing About BookWyrm What it is and isn't The r

BookWyrm 1.4k Jan 08, 2023
Google Fit Sensor Component

Google Fit Sensor Component

Ivan Vojtko 21 Dec 20, 2022