Skip to content
This repository

Prevent from being imported by accident #701

wants to merge 164 commits into from

5 participants

Stefan van der Walt Brian E. Granger Matthias Bussonnier Fernando Perez Min RK
Stefan van der Walt

Suggest importing IPython instead

and others added some commits
Brian E. Granger Fixing code to assume msg_type and msg_id are top-level.
* I have gone through and looked for instances of ['msg_type'] and
  ['msg_id'] and tried to make sure that I added ['header'] so
  pull the values out of the header.
* But there are many cases where I can't tell if the dict is the
  full message or the header already. This is especially true
  of the msg_id in the parallel db parts of the code.
* Tests pass, but this is scary.
Brian E. Granger Renaming unpack_message to unserialize and updating docstrings. efa1f33
Brian E. Granger Fixing docstrings and a few more places for msg_id/msg_type. d86d45f
Brian E. Granger Adding html notebook subpackage. 0494d13
Brian E. Granger Initial draft of HTML5/JS/CSS3 notebook. adcfbf8
Brian E. Granger Adding shift-enter support. 9e95afe
Brian E. Granger Fixing selection and focus logic. 04da04e
Brian E. Granger Added placeholder text for TextCell. 927f44b
Brian E. Granger Adding preventDefault to shift-up/down events. d7f2add
Brian E. Granger Work on the server side of the html notebook. 398f176
Brian E. Granger Basic server for htmlnotebook working. b7248bf
Brian E. Granger Initial reply handling implemented along with css fixes. 0bfc754
Brian E. Granger Make the main notebook div auto scroll. 5a8489e
Brian E. Granger Adding tests for zmq.session. a09b42a
Brian E. Granger More tests for Session.send/recv. b95a185
Brian E. Granger Fixing messaging docs to reflect msg_type in header. fa7cc46
Brian E. Granger Adding temp refs to msg_type to prevent nested dict gets. e5d9e2c
Brian E. Granger Fixing bug in related to msg_type refactoring. e4a965d
Brian E. Granger Fixing another bug in msg_type refactoring. f0d2271
Brian E. Granger Server side of file based notebook store implemented. 5dc428b
Brian E. Granger Initial template for notebook browser. a2dd039
Brian E. Granger Added message to help users open notebook. 74b8ea8
Brian E. Granger Updating jquery UI and themes. 1497e96
Brian E. Granger Fixing main toolbar area and cleaning up jquery themes. 339135b
Brian E. Granger Different clients now share a single zmq session.
Previously, each client (browser window) would open its own set
of ZMQ sockets to a kernel. Now one master set of connections
to the kernel is created and all clients share those connections.
In some ways, this simplifies the URL design.

I have also made kernel_ids server-side created.
Brian E. Granger Minor changes to notebook css. df52f21
Brian E. Granger Interrupt and restart work for kernels. 7731a50
Brian E. Granger Cleaned up kernel action interface.
* Using POST rather than GET.
* Using simple URLs rather than a query string.
* Using a regexp to match the action.
Brian E. Granger Status monitoring added to notebook.
* Busy == red
* Idle == gray
* Restarting == black
Brian E. Granger Fixes to notebook scrolling and layout.
We are now using the flexible box model, so the layout won't work
on IE9, but it already doesn't work on IE9 because of WS support.
Brian E. Granger Tweaking and cleanup of notebook.css.
* Adjusted font sizes for improved readability.
* Got rid of unused css attributes and styles.
* Changed font of Title to Verdana.
Brian E. Granger Further font adjustments to the notebook.
* Using Fernando's recommended monospaced font list.
* Increased tool/tab menus to 10 pt.
Brian E. Granger Work on the notebook's code cell.
* Cleaned up the js code for creating the code cell.
* Added a div around the input text area to allow the text area
  to have a width of 100%.
* Added CodeCell.toJSON.
Brian E. Granger Basic notebook saving and loading.
* The logic in the server and javascript frontend is there for
  a basic JSON notebook format with a .ipynb extension.
* To save a new notebook: "%notebook save filename.ipynb"
* To save a notebook that is already saved: "%notebook save"
* To load a notebook from the cwd: "notebook load filename.ipynb"
Brian E. Granger Initial latex printing for sympy and fixes to autogrow. 68db752
Brian E. Granger Refactoring of the output and display system.
* LaTeX rendering now works.
* Font's are reworked in the css style sheet.
* Testing on FF and Chrome.
Brian E. Granger Fixes to the latex rendering by adjusting the MathJax config. 6c644c6
Brian E. Granger Basic exception display in the notebook is working. bffb119
Brian E. Granger Added basic styling to text cells. 9447eb0
Brian E. Granger Cells call grow by hand when they reload from JSON. a563b92
Min RK include html frontend in packages/package_data
chmod +x ipython-notebook script
Brian E. Granger Shift-Enter only selects the next cell if it is a CodeCell. e341cf4
Brian E. Granger Fine tuning of notebook styles.
* Padding added to L/R of notebook div (40px).
* Margin added to T/B of cells (15px).
* Margin added to T of output div (15px).
* More elements using border-box layout mode.
Brian E. Granger Adding logic to look for CDN version of MathJax and fallback to local. 5e55e20
Brian E. Granger Added note about tornado version to main script. ff6dc82
Brian E. Granger Minor fix to sympy latex printing.
* \dag is converted to \dagger.
Brian E. Granger Adding new notebook examples.
* Many that use sympy's quantum computing (github master required)
* One from Fernando Perez that does text analysis.
Brian E. Granger Minor changes to text_analysis notebook example. 1ff5a82
Brian E. Granger Updating notebook examples, and notebook js/html. 264b061
Brian E. Granger General CSS cleanup.
* Created layout.css for common layout related mixins.
* monospace is the default font for now.
Brian E. Granger CodeMirror code editing added.
* codemirror2 repo has been added to IPython.
* Custom coloring used to match the qtconsole.
Brian E. Granger Better handling of up/down arrows for CodeCells. e270403
Brian E. Granger Much improved nagivation for the notebook cells.
* Up/Down arrow now used to navigate cells.
* For text cells, shift-enter renders, enter edits.
Brian E. Granger Updating notebook examples. c9ad4e8
Brian E. Granger Updating sympy notebook examples. b2aa21f
Brian E. Granger Updating examples notebooks. 0f16a10
Brian E. Granger Adding new density of states notebook example. b55bc76
Brian E. Granger Creating files to new notebook app. 98f7851
Brian E. Granger Fixing import statments in handlers and notebookapp. a94f1fa
Brian E. Granger Initial reorg of files complete.
I have moved things around to get ready for making the notebook
a full blown app, but have not actually made it an app.  That is
Brian E. Granger Renaming NotebookApplication to NotebookWebApplication. 8deb465
Brian E. Granger Refactored htmlnotebook session and kernel manager.
* The KernelManager now manages multiple kernels with a uniform
* The SessionManager now manages the full set of channels+streams
  and the IPython.zmq.session.Session object for a single kernel.
Brian E. Granger Refactoring the notebook app to support the new config system. 9ce4875
Brian E. Granger Notebook app debugging.
* Logging is now working with a default of INFO.
* Other misc bug fixes.
Brian E. Granger Work to adapt routers to new Session message protocol. f0ab259
Brian E. Granger More work on updating the notebook zmq forwarding. fd1d84c
Brian E. Granger Updating the notebook to work with the latex master.
* PNG figures are now used for matplotlib.
* NEW msg format is used where msg_type is in the header.
* Session is used for sending/recving.
Brian E. Granger Splitting notebook.js into muliple files for development ease. 82dfeed
Brian E. Granger Updating main notebook template to use split scripts. 90a9bbc
Brian E. Granger Change unpack_message to unserialize in 27afdf3
Brian E. Granger Implemented module and namespace pattern in js notebook. c5b0c06
Brian E. Granger Using $.proxy to clean up callbacks. 73126bf
Brian E. Granger Actually kill old kernels upon restart. 7fc2c96
Brian E. Granger Starting to refactor the notebook layout ad2890a
Brian E. Granger Initial payload handling.
* Syntax highlighting fixed for things like "math?".
* Basic pager is working.
Brian E. Granger Refactoring pager into its own class. aa37ef2
Brian E. Granger Updating jQuery to 1.6.2 and jQuery UI to 1.8.14.
I have also added a focus.html files for testing focus related
Brian E. Granger Adding note about vbox related scroll bugs. ed4b3fd
Brian E. Granger More work updating the notebook to use dynamics resizing. a0257f5
Brian E. Granger Pager is working again. 9262f15
Brian E. Granger More accuract height calculations for the pager collapse/expand. e37fefa
Brian E. Granger Left panel is now working. 450ed2f
Brian E. Granger Improving the scrolling model. 1579023
Brian E. Granger Initial draft of panel section and the cell section working. c6ab30b
Brian E. Granger Minor fixes to fonts and spacing. a7ef503
Brian E. Granger Controls in cell section have a solid layout. 71e8168
Brian E. Granger Help section implemented and working. 0376908
Brian E. Granger Minors fixes and initial work on save widget.
* Fixed width of buttons in left panel.
* Started to create a save widget for the header.
Brian E. Granger Work on save widget, kernel status widget and notebook section. 67aa594
Brian E. Granger Fixing execution related things.
* Extra enter on FF is fixed by hooking into CodeMirror's
  onKeyEvent hook. We now have CodeMirror ignore shift-enter
  completely as we handle it ourselves.
* The cell execution logic in notebook.js has been refactored and
  the Run All/Selected buttons have been hooked up.
Brian E. Granger Updating font-sizing to use the YUI protocol. 0c51946
Brian E. Granger Prevent shift-enter from propagating and performing default. d8294f0
Brian E. Granger Colors now working in tracebacks and the pager.
For now I am just converting ANSI color escape sequences to HTML
<span> tags that have css classes for coloring.
Brian E. Granger Added complete method of JS kernel object. 5829983
Brian E. Granger Autocompletion working with CTRL-SPACE. dad53c3
Brian E. Granger CTRL-ENTER now runs a cell in "terminal mode"
In this mode, a new cell is not created after the current cell
is run. Once the cell is run, the current input is cleared, so
it acts just like the terminal.
Brian E. Granger Removing default input prompt number.
In a notebook setting being able to delete and add cells makes it
virtually impossible to correctly guess what the next input
prompt number should be. We now follow the convention that our
prompts look like "In [ ]:" before execution.
Brian E. Granger Adding nbformat subpackage. 68687d2
Brian E. Granger Notebook now uses tab for autocompletion. 4b71ab3
Brian E. Granger Fixes to terminal mode execution (ctrl-enter). c88117a
Brian E. Granger Hacks to prevent FLOUC (flash of unformatted content). fbddd43
Brian E. Granger Fixing minor resize bug on the Mac. 27379eb
Brian E. Granger Adding Cell.grow back to fix bug.
This can go away once we star to use CodeMirror for TextCells.
Brian E. Granger Initial draft of more formal notebook format.
* Basic Python notebook uses a simple Struct subclass,
  NotebookNode for representing the notebook components.
* XML and JSON readers/writers work in full round trip manner.
* Python reader/writter works for code cells.
* Everything is tested.
Brian E. Granger Updates to basic notebook format.
* The format now handles multiple output blocks.
* XML now as worksheets, cells and outputs tags.
Min RK support html representations in the notebook frontend
html gets highest priority, because it is the native language
of the frontend.
Brian E. Granger Full versioning added to nbformat. 0251893
Brian E. Granger Merge branch 'repr_html' of into min…
Brian E. Granger Added lib/ for extra display related things. c292a9c
Min RK update add_packages for reorganized nbformat 4c2aebb
Brian E. Granger Fixing for nbformat package. 540b3f1
Brian E. Granger Massive work on the notebook document format.
* Finished nbformat work and debugged the versioning API.
* Integrated the nbformat with the notebook. Save/New/Open/Export
  are all now working.
Brian E. Granger Merge branch 'htmlnotebook' of into htmlno…

Brian E. Granger Implemented basic notebook browser and fixed numerous bugs. 1699c90
Brian E. Granger Implemented delete functionality in nb browser.
* Dialog confirms the notebook delete.
* Notebook element is removed from list upon deletion.
Brian E. Granger File upload/import working from notebook browser. 53c7ec7
Brian E. Granger Improvements to file uploaded, mime types and .py reader.
* The .py notebook reader now uses that ast module to split
  a plain python file into blocks. These blocks become cells in
  the notebook.
* Proper mime types are used for xml (application/xml), json
  (application/json) and python (application/x-python).
* Other fixes to file uploading.
Brian E. Granger Adding kernel/notebook associations. 03eb23c
Brian E. Granger Fixed subtle bug in kernel restarting.
* Old routers were not being shutdown and removed.
* We were incorrectly associating the new kernel with the notebook
  (we were using the *old* kernel_id for this).
* General clean ups in the kernel manager.
Brian E. Granger Using beforeunload to save at exit and kill the kernel. 7640e54
Brian E. Granger Added saving and loading of output of all types. 2a85499
Brian E. Granger Starting to rename text cell to html cell. b0e516c
Brian E. Granger New HTMl cell working with CodeMirror editing. 653f157
Brian E. Granger Updating CodeMirror to v 2.12.
For now I am keeping the old codemirror2 directory in here until
we finish debugging the new version.
Brian E. Granger Fixing HTML cell syntax highlighting. 3896ff1
Brian E. Granger Starting work on a Markdown cell. f5f6198
Brian E. Granger Refactoring of text/markdown/rst/html cells. fbce942
Brian E. Granger Reordering Export button and renaming Export->Export As 978f742
Brian E. Granger Markdown cells are now saved and restored in notebooks. a85c3e7
Brian E. Granger Implemented smart autoindenting. 4fb6f61
Brian E. Granger Fixed text cell rendering bug. 8bee5f8
Brian E. Granger Updates to the css style of rendered html text cells. db81ec2
Brian E. Granger Minor fixes to config system for notebook. 89e253a
Brian E. Granger Adding minor help strings for keyboard shortcuts. ddb901b
Brian E. Granger Merge branch 'master' into htmlnotebook
Brian E. Granger Updating notebook configuration.
* is now created and staged.
* New certfile/keyfile config=True attributes for enabling SSL/TLS.
* Examples of usage added.
* New handling for --ip=*
* Aliases added.
Brian E. Granger Created new notebook magic that can export/convert notebooks.
* %notebook --export foo will export the current IPython history
  to a file foo.ipynb.
* %notebook --format=json foo.ipynb will convert foo.ipynb to
Brian E. Granger Adding initial documentation on the notebook. 1bcb722
Brian E. Granger Reducing/adjusting the padding of cells to make the notebook more

* Reduced padding between cells from 15px to 5px.
* Prompt width is now dynamic to grow/shrink as the prompt number
  increases in width.
* Reduced padding between input and output from 15px to 5px.
Brian E. Granger Updates to the display system.
* New publish_* functions created in IPython.core.displaypub.
* A raw=True argument has been added to the display_* functions
  in IPython.core.display.
* Display object classes such as Html, Png, etc. have been added
  to IPython.core.display to make it easier to diplay raw data
  from the internet.
Brian E. Granger Finishing display system work.
* Added image/jpeg MIME type to notebook format, the core display
  logic and the notebook.
* Finished HTML, SVG, Image, Math, Javascript, JSON classes.
Brian E. Granger Autoindentation fixed and enabled by default. eaf692f
Brian E. Granger %loadpy works in the notebook and bug with inline plotting fixed. 1de26e1
Brian E. Granger Fixing padding of output cells. b85982d
Brian E. Granger Added note about imports in IPython.__init__. 1d01468
Brian E. Granger Added collapsed field to the code cell. 1c4a699
Brian E. Granger HTML/Markdown cells no longer saved their rendered output. 31ac0f3
Brian E. Granger Adding time delay to show the notebook saving more clearly. 40d4a55
Brian E. Granger New .py notebook format implemented. 7debcc4
Brian E. Granger Adding tracebacks, evalue and etype to the nbformat and notebook. 3669962
Brian E. Granger HTML output cells are now styled with the rendered_html class. df0ed78
Brian E. Granger Disabling auto-save at exit. 453bf75
Brian E. Granger Clear all output is implemented. 31e9da5
Brian E. Granger Major refactor of kernel connection management in the notebook.
* Full kernel heartbeating is working.
* Connections between the notebook and server and now created
  a new each time there is a WebSocket connection. Each channel is
  also handled separately. This dramatically simplifies the
  server code and makes for a more scalable system.
Brian E. Granger Merge branch 'master' into htmlnotebook cc6010e
Brian E. Granger Fixing bug that caused plots to not be saved.
CodeCell.append_mime_type needed a default element.
Brian E. Granger Autotry additional ports if 8888 if already in use. d1499b6
Brian E. Granger Browser window title follows the name of the notebook. 1786348
Brian E. Granger Added a notebook dirty flag that is used when exiting page. fb55a88
Brian E. Granger Notebook id removed from the notebook format. a86896d
Brian E. Granger Updating notebook examples to current format. bee9c06
Brian E. Granger Fixing latex rendering bug. feaba3c
Brian E. Granger A single tab-completion match is now automatically selected. 49fa32f
Stefan van der Walt Prevent launcher from being imported. 2fdc9c0
Stefan van der Walt stefanv closed this
Fernando Perez

Is a naked print a good idea here? If so, then at least we should do

from __future__ import print_function

at the top and use print() instead, so the 2to3 changes are minimized.


Since it's one of the few things 2to3 handles well, making the from __future__ import print_function change manually, really has zero benefits as far as I know, and is primarily a cause for annoyance.


I guess I'm just getting used to using print as a function everywhere in anticipation of the transition to 3, so it doesn't bother me much. But I agree that it's not a big deal, and I have no problem if it stays as-is.

Matthias Bussonnier

Those 2 bindings seem not to be used. The collapse/expand_pager triggerd seem to be in notebook.js. Am I wrong ? Should I remove them from here ?


Hum, it seem that I'm wrong... I'm not sure t understand how it works then... and what's the difference between those binding and the ones in notebooks.js
Sorry for the noise.


I don't know why we have both of them, but I did a test and confirm that both are being called when pager.js L62 is run. W can probably move all that logic to pager.js as I don't see anything notebook specific in the notebook.js version. This code was written very early on so I am not surprised it is crusty.


I think the one in pager.js grow/shrink the pager below the separator while the one in notebook.js shrink/grow the height of the notebook area. So it kind of make sens to have function dealing with notebook in notebook..

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.