Still more KernelManager cleanup
Finish up some more work from #2775closes#2722
- [x] ip/transport configurables only live on KernelManager objects, not ConsoleApp
- [x] fix default ipc paths in `ipython kernel` and `ipython notebook` cases
- [x] fix ipc file cleanup in a few more cases
- [x] add `--transport` alias for all appropriate entry points
General cleanup of kernel manager code.
This does some general cleanup of MultiKernelManager to better reflect how it is actually being used.
Sometimes there is a need to create kernel_id's elsewhere in code. This minor change allows a kernel_id to be created outside of the MultiKernelManager and passed in as a kwarg. An exception is raised if the id is already used.
Tasks:
- [x] Fix cleanup of ipc files.
- [x] Allow kernel_id to be passed to MultiKernelManager.start_kernel.
- [x] Add ipc support to MultiKernelManager.
- [x] Add more tests for MultiKernelManager.
- [x] Rename sub channel to iopub channel everywhere.
- [x] Use consistent naming for all channel classes in zmq, inprocess and qt.
- [x] Move BlockingChannelMixin to zmq.blockingkernelmanager.
- [x] Create ABC for KernelManager.
- [x] Make the InProcessKernelManager a Configurable.
- [x] Cleanup docstrings in ABCs.
- [x] Add tests for KernelManager.
- [x] Check over MultiKernelManager.
- [x] Make KernelManager,kill_kernel private in ABC and implementations.
- [x] Find bug that is causing the kernel manager tests to hang unless the shell channel linger is set to 0.
- [x] Decide about critical logging in ipkernel.
- [x] Debug lack of stderr redirect in tests.
The select menu for celltoolbar presets should live entirely in
the maintoolbar code - it was 1/2 in CellToolbar itself. This
fixes this issue using events and an additional method on
CellToolbar (list_presets).
The kernel_id is *always* the same under a restart and there
is no need to return it. The restart handler does pass
the original kernel_id back to the browser as it currently uses it.
This add a per-cell globally toggleable toolbar
the main purpouse is to easily edit metadata.
this come with a few example like adding checkbox,
dropdown list, simple button, button with icon...
please see the js-doc of
IPython/frontend/html/notebook/static/js/MetaUI.js
for more info
also bind shift tab for tooltip + config
This does not change the curent behavior, only add the shift+tab shortcut.
Note that the shift tab shortcut has a slightly different behavior. You can select part of a line and pressing shift-tab will show you the tooltip only for the selection.
This is disabled for multiline selection to still allow to unindent block of code, Keep in mind that the real real shortcut for indent unindent is Ctrl+] or [ . Select/tab is not really supported by codemirror.
Finally the "tooltip_on_tab" behavior is globally configurable via IPython.config so that it could be easily switched to false.
It can be overridden via js console for test purpose.
IPython.config.tooltip_on_tab = true | false
Take effect immediately, only on current notebook.
or globally via custom.js
var user_conf = {tooltip_on_tab:false | true};
$.extend(IPython.config, user_conf)
diverse fixes for project url
- Force leading and trailing slashes in base_project/kernel_url
- Add support for the prefix in template for static files
- Fix some forgotten quotes
- remove old make_static_url which is now a jinja2 macro
* Force leading and trailing slashes in base_project/kernel_url
* Add support for the prefix in template for static files
* Fix some forgotten quotes
* remove old make_static_url which is now a jinja2 macro
fixes-2720
Destructive paste mapped to Ctrl-M V is a surprising choice given that
there was no drag-to-select on the area being replaced (there is a
weaker notion of "selected cell" but this does not map to will-be-replaced-
by-paste in the minds of participants in an unscientific poll at
PyConCA).
Destructive paste is still available as the last paste option in the
Edit menu, qualified as "Paste Cell Replace".
I've accidentally deleted the wrong cell quite a few times and
it has been quite frustrating. This enables a very hacky backup of
the last cell deletion.
I'm sure the core devs will have some opinions on both the feature
and its implementation, I consider this very much a first pass.
Equation References and Numbering are not going to be trivial to add,
so the code has been removed for now. Important fixes include
no-MathJax support (previously, the code was failing), and the
generation of unique ids for the rendering content in each cell,
tremendously speeding up MathJax rendering.
I am still not rendering placeholder text.
MathJax.InputJax.TeX.resetEquationNumbers is supposed to be available,
but isn't consistently loaded before the notebook fires off its first
re-render request. The code edits in mathjaxutils.js fix this issue.
Additionally, there was some init code in mathjaxutils.js that has been
properly excised to the html templates.
Removed some orphan rendering code so that all typesetting now goes
through mathjaxutils.js
Finally, removed an extra cell in the demo notebook.
Autochange highlight with cell magics
Highlight change is made on cell load and Enter keypress.
For now, it recognizes %%javascript, %%python[3], %%ruby, %%bash , %%R, %%perl.
new modes can easily be added by adding regular expression on config.js
Previously `^C` would register as a regular test failure, and the test suite would continue, in which case halting `iptest` meant hitting `^C` nine times.
This change makes iptest take notice of sigint in a test runner, and aborts the run.
Notebook: Store the username in a cookie whose name is unique.
Cookies cannot be saved on a per-port basis, so a cookie "username" is shared
across all running IPython notebooks with the same hostname. Using a unique
cookie name prevents this collision.
This allows a user to start multiple IPython notebooks and be logged into
each.
was using notebook.get('name') instead of notebook.metadata.get('name'),
where the name is actually stored. The result was that all downloaded notebooks were called 'notebook'.
closes#2227
Cookies cannot be saved on a per-port basis, so a cookie "username" is
shared across all running IPython notebooks with the same hostname.
Using a unique cookie name prevents this collision.
This allows a user to start multiple IPython notebooks and be logged into
each.
Introduce Notification Area
This allow several notification widget to be next one to the other in the notification area.
The Api allow also to register a callback if the user click on the notification. and allows sticky and non sticky notification.
I have created a base class for all notebook managers. Our
existing, file-based store, is now in filenbmanager.py. I have
also created a new Azure Blob based backed notebook manager.
The behavior is the following:
* If you press UP while on the first row, you go to the beginning of the line.
* If you press UP again (or were already at the beginning of the line), you
go to the previous cell.
* If you press DOWN while on the last row, you go to the end of the line.
* If you press DOWN again (or were already at the end of the line), you go
to the next cell.
This applies to `CodeCell`s and `RawCell`s.
add FileFindHandler for Notebook static files
* The static file handler now uses a search path, instead of a single dir.
This allows easier customization of available js/css,
and provides a place for extra files to go for extending the notebook.
* An empty custom.js / custom.css are added to the templates for trivial
custom user styling/scripting.
The search only happens once, and the result is cached after the first.
* A few methods are pulled from tornado 2.2-dev verbatim to have tornado 2.1 compatibility.
* mathjax is now installed by default in profile.
win32 iptest: Use subprocess.Popen() instead of os.system().
The call to `os.system` in `iptest` prevents us from easily setting `$IPYTHONDIR` to a temporary directory. In theory we should be able to use `subprocess.Popen` instead of `os.system` in Windows. This would unify the code structure and make it easy to pass in a different environment.
Note that Python < 2.7 does not have `os.kill`. I've attempted to work around this by using `ctypes` to kill any living processes.
python 2 and 3 compatibility without 2to3
apply some fixes :
- apply (deactivated in setup.py now)
- repr (deactivated in setup.py now)
- print (only in modules with print >>)
- raise (partially)
don't touch deathrow and quarantine.
Base of allowing a full toolbar construction in js without altering the
html template, and use it to construct our toolbar as example.
still need some work to be totally decoupled.
There's nothing there we should be running python tests on, and
occasionally python files may appear there that cause problems to nose
(e.g. mathjax ships a non-py3 valid conf.py that breaks py3 testing).
brutally replace all `exeption <type>, <name>:` by
`exception <type> as <name> :`
`exception <type>, <type> :` should not be present anywhere in the code
anymore, or should be present with explicit tuple as
`exception (<type>, <type>)`
this improve the current css of the print page and add css to the
classical notebook with print as target to get a better print view ant
the ability to directly print a notebook without going through the print
view
Fix spurious appearance of the #fontarea when fonts don't have any problem; also remove loud dialog when problematic font is detected and simply adjust baseline. Users will have a slightly offset baseline for bold/italic highlights, but without any functional problems.
Fixes#2005.
Clean BG processes created by %%script on kernel exit
* uses less forceful shutdown of kernels in the notebook, allowing atexit machinery to fire
* enables daemon BackgroundJobs
* cleanup %%script --bg subprocesses at shutdown
minor notebook startup/notebook-dir adjustments
* change inaccurate / distressing "Overwriting profile..." log message
* `ipython notebook path` results in setting notebook-dir if it's a dir,
rather than unconditionally setting file-to-run
* file-to-run overrides no-browser
* kernels start in the notebook dir, rather than the Server's cwd
* notebook dir is validated, and created if it doesn't exist (only if parent exists, like ~all other such things)
closes#1985closes#1980
second attempt at scrolled long output
Some amount of CSS tweaking will probably want to be done before 0.13 final,
but this is good enough for beta.
closes#1553
Cell/Worksheet metadata
* metadata dicts are attached to cells and worksheets
* restores collapsed flag to the nbformat - this change happened in the refactor, and was undocumented, and possibly accidental. But we should either document it or fix it, and this includes a fix.
* adds a new field, `nbformat_minor`, used to denote minor bumps of the notebook format that expose new capabilities but don't prevent loading by older clients.
* Add a warning in Javascript if loading a multiworksheet notebook (which will exist in the future) as current JS code will only save the first.
closes#1915
fix for #1678, undo no longer clears cells
With these changes, Ctrl-Z inside of codemirror cells will only undo up to the text that was in the cell when it was loaded from JSON.
closes#1678
I found another bug where switching the cell type causes the loss of all
undo history for that cell. With this commit, switching the cell type
simply resets the history
Remove remaining references to deprecated XREP/XREQ names.
There was only one actual use of the deprecated constants in code, but numerous mentions in docstrings, etc.
These names have been removed from the next libzmq release, and will presumably be removed from pyzmq someday.
only one line of actual code is changed.
these names have been removed from the next libzmq release,
and will presumably be removed from pyzmq someday.
Increase duration of save messages and write permanent 'failed' message to the save status area on failed save.
Not a pop-up as described in #1461, but significantly more prominent, and most importantly permanent when saving fails, at least until the next successful save.
Closes#1461.
Add %%octave, %octave, %octave_pull and %octave_push magics to facilitate interaction with Octave via oct2py. This is similar in spirit to the R magic extension.
New `%%capture` cell magic captures stdout/err while running a cell.
Uses `capture_output()` context manager, moved to utils.io from IPython.parallel testing utilities, where it originated.
The caputre objects can be printed as a string, case in which they display the captured stdout, which is also available as `.stdout`. The captured stderr, if any, is in a `.stderr` attribute. A `.show()` method can be called to quickly print both, with stderr being correctly printed to the sys.stderr stream (so the notebook displays it with red highlighting).
closes#1863
Fix 1px margin bouncing of selected menu item.
This fixes the margin of the active menu item to zero, so now the text doesn't shift around, even if you use larger fonts.
To reproduce the original error, zoom your notebook (ctrl-mousewheel, or ctrl-+ in most browsers) and try the menu.
Fix vertical offset due to bold/italics, and bad browser fonts.
Adds a dialog warning users when a problematic monospaced font is detected, so they can change their configuration.
There was a bug in NotebookManager.save_notebook_object.
Here is how to reproduce:
0. Make sure you don't have Untitled0.
1. Open new notebook Untitled0.
2. Rename it to something else.
3. Copy Untitled0.ipynb to the notebook dir from somewhere.
(Do not use notebook UI.)
4. New copied Untitled0 cannot be opened.
The renamed notebook is opened when tried.
Indeed, accessing to http://localhost:XXXX/notebooks shows
duplicated notebook_id.
The problem was that NotebookManager.rev_mapping keeps old notebook
name after renaming.
Make : invalid in filenames in the Notebook JS code.
This only prevents : in the filenames on the JavaScript side of things. Handling this on the server side will be a separate issue that is related to other open issue. I will update those to reflect this.
closes#1781
Rmagic extension to use R (the statistical package) seamlessly from IPython.
The rmagic extension allows R inline code as well as cell level magics. An example notebook is provided in docs/examples/notebooks/rmagic_extension.ipynb to demonstrate its usage.
Main points:
1) Allows capture of plots to R via inline png plots (like --pylab inline)
2) Allows capture of R's stdout() connection to the notebook
3) Allows simple push/pull for array data to/from R (via rpy2) with copy only on push to R -- this seems necessary.
When kernel is died and restarted, or restarted while it is in the
busy state, message "(Busy)" on the window title is not updated. This
problem is fixed by updating document title when restarting.
it seem that show and hide methods fron tooltip where collinding with
jquery, sometime blocking the notebook.
Move from css fadeIn/Out to jQuery fade In/Out, and replace
addRemoveClass by fadeIn/fadeOut
For security reasons, the kernel should not be started until
after the notebook content is completely loaded and on the page.
This prevents people from creating notebooks that run nasty code
on the users machine at load time.
In order to implement this, we had to create a CodeCell.set_kernel
method that allows the kernel attribute of a CodeCell to be set
at a later time. This also fixes some error messages we were
seeing related to the kernel's channels not being setup properly
when a send was attempted.
Use notification to quicky remind use of the tooltip
Use javascript in notebook to make a live demo in
01_notebook_introduction
tooltip docstring is remplaceid for the first use by a live tutorial
I had removed the choice for the user to not restart a dead kernel
but we are using that elsewhere. Eventually we may not give them
a choice, but for now we will use that model.