Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Prevent ipython.py from being imported by accident #701

Closed
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

ellisonbg and others added some commits
Brian E. Granger ellisonbg 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.
1bc3aac
Brian E. Granger ellisonbg Renaming unpack_message to unserialize and updating docstrings. efa1f33
Brian E. Granger ellisonbg Fixing docstrings and a few more places for msg_id/msg_type. d86d45f
Brian E. Granger ellisonbg Adding html notebook subpackage. 0494d13
Brian E. Granger ellisonbg Initial draft of HTML5/JS/CSS3 notebook. adcfbf8
Brian E. Granger ellisonbg Adding shift-enter support. 9e95afe
Brian E. Granger ellisonbg Fixing selection and focus logic. 04da04e
Brian E. Granger ellisonbg Added placeholder text for TextCell. 927f44b
Brian E. Granger ellisonbg Adding preventDefault to shift-up/down events. d7f2add
Brian E. Granger ellisonbg Work on the server side of the html notebook. 398f176
Brian E. Granger ellisonbg Basic server for htmlnotebook working. b7248bf
Brian E. Granger ellisonbg Initial reply handling implemented along with css fixes. 0bfc754
Brian E. Granger ellisonbg Make the main notebook div auto scroll. 5a8489e
Brian E. Granger ellisonbg Adding tests for zmq.session. a09b42a
Brian E. Granger ellisonbg More tests for Session.send/recv. b95a185
Brian E. Granger ellisonbg Fixing messaging docs to reflect msg_type in header. fa7cc46
Brian E. Granger ellisonbg Adding temp refs to msg_type to prevent nested dict gets. e5d9e2c
Brian E. Granger ellisonbg Fixing bug in ipkernel.py related to msg_type refactoring. e4a965d
Brian E. Granger ellisonbg Fixing another bug in msg_type refactoring. f0d2271
Brian E. Granger ellisonbg Server side of file based notebook store implemented. 5dc428b
Brian E. Granger ellisonbg Initial template for notebook browser. a2dd039
Brian E. Granger ellisonbg Added message to help users open notebook. 74b8ea8
Brian E. Granger ellisonbg Updating jquery UI and themes. 1497e96
Brian E. Granger ellisonbg Fixing main toolbar area and cleaning up jquery themes. 339135b
Brian E. Granger ellisonbg 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.
2ad3ee4
Brian E. Granger ellisonbg Minor changes to notebook css. df52f21
Brian E. Granger ellisonbg Interrupt and restart work for kernels. 7731a50
Brian E. Granger ellisonbg 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.
9fe1c2c
Brian E. Granger ellisonbg Status monitoring added to notebook.
* Busy == red
* Idle == gray
* Restarting == black
1f5c4be
Brian E. Granger ellisonbg 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.
2050714
Brian E. Granger ellisonbg 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.
169110d
Brian E. Granger ellisonbg Further font adjustments to the notebook.
* Using Fernando's recommended monospaced font list.
* Increased tool/tab menus to 10 pt.
3b1715e
Brian E. Granger ellisonbg 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.
5d9b6e7
Brian E. Granger ellisonbg 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"
2607443
Brian E. Granger ellisonbg Initial latex printing for sympy and fixes to autogrow. 68db752
Brian E. Granger ellisonbg 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.
9e126bc
Brian E. Granger ellisonbg Fixes to the latex rendering by adjusting the MathJax config. 6c644c6
Brian E. Granger ellisonbg Basic exception display in the notebook is working. bffb119
Brian E. Granger ellisonbg Added basic styling to text cells. 9447eb0
Brian E. Granger ellisonbg Cells call grow by hand when they reload from JSON. a563b92
Min RK minrk include html frontend in packages/package_data
chmod +x ipython-notebook script
e6b3e5b
Brian E. Granger ellisonbg Shift-Enter only selects the next cell if it is a CodeCell. e341cf4
Brian E. Granger ellisonbg 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.
e513eb9
Brian E. Granger ellisonbg Adding logic to look for CDN version of MathJax and fallback to local. 5e55e20
Brian E. Granger ellisonbg Added note about tornado version to main script. ff6dc82
Brian E. Granger ellisonbg Minor fix to sympy latex printing.
* \dag is converted to \dagger.
5d05db0
Brian E. Granger ellisonbg Adding new notebook examples.
* Many that use sympy's quantum computing (github master required)
* One from Fernando Perez that does text analysis.
7877585
Brian E. Granger ellisonbg Minor changes to text_analysis notebook example. 1ff5a82
Brian E. Granger ellisonbg Updating notebook examples, and notebook js/html. 264b061
Brian E. Granger ellisonbg General CSS cleanup.
* Created layout.css for common layout related mixins.
* monospace is the default font for now.
e3dc236
Brian E. Granger ellisonbg CodeMirror code editing added.
* codemirror2 repo has been added to IPython.
* Custom coloring used to match the qtconsole.
f5911d3
Brian E. Granger ellisonbg Better handling of up/down arrows for CodeCells. e270403
Brian E. Granger ellisonbg Much improved nagivation for the notebook cells.
* Up/Down arrow now used to navigate cells.
* For text cells, shift-enter renders, enter edits.
c14e651
Brian E. Granger ellisonbg Updating notebook examples. c9ad4e8
Brian E. Granger ellisonbg Updating sympy notebook examples. b2aa21f
Brian E. Granger ellisonbg Updating examples notebooks. 0f16a10
Brian E. Granger ellisonbg Adding new density of states notebook example. b55bc76
Brian E. Granger ellisonbg Creating files to new notebook app. 98f7851
Brian E. Granger ellisonbg Fixing import statments in handlers and notebookapp. a94f1fa
Brian E. Granger ellisonbg 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
next.
02f9051
Brian E. Granger ellisonbg Renaming NotebookApplication to NotebookWebApplication. 8deb465
Brian E. Granger ellisonbg Refactored htmlnotebook session and kernel manager.
* The KernelManager now manages multiple kernels with a uniform
  API.
* The SessionManager now manages the full set of channels+streams
  and the IPython.zmq.session.Session object for a single kernel.
3f3cd92
Brian E. Granger ellisonbg Refactoring the notebook app to support the new config system. 9ce4875
Brian E. Granger ellisonbg Notebook app debugging.
* Logging is now working with a default of INFO.
* Other misc bug fixes.
e051436
Brian E. Granger ellisonbg Work to adapt routers to new Session message protocol. f0ab259
Brian E. Granger ellisonbg More work on updating the notebook zmq forwarding. fd1d84c
Brian E. Granger ellisonbg 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.
97f1ce7
Brian E. Granger ellisonbg Splitting notebook.js into muliple files for development ease. 82dfeed
Brian E. Granger ellisonbg Updating main notebook template to use split scripts. 90a9bbc
Brian E. Granger ellisonbg Change unpack_message to unserialize in routers.py. 27afdf3
Brian E. Granger ellisonbg Implemented module and namespace pattern in js notebook. c5b0c06
Brian E. Granger ellisonbg Using $.proxy to clean up callbacks. 73126bf
Brian E. Granger ellisonbg Actually kill old kernels upon restart. 7fc2c96
Brian E. Granger ellisonbg Starting to refactor the notebook layout ad2890a
Brian E. Granger ellisonbg Initial payload handling.
* Syntax highlighting fixed for things like "math?".
* Basic pager is working.
af64139
Brian E. Granger ellisonbg Refactoring pager into its own class. aa37ef2
Brian E. Granger ellisonbg 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
events.
8766e94
Brian E. Granger ellisonbg Adding note about vbox related scroll bugs. ed4b3fd
Brian E. Granger ellisonbg More work updating the notebook to use dynamics resizing. a0257f5
Brian E. Granger ellisonbg Pager is working again. 9262f15
Brian E. Granger ellisonbg More accuract height calculations for the pager collapse/expand. e37fefa
Brian E. Granger ellisonbg Left panel is now working. 450ed2f
Brian E. Granger ellisonbg Improving the scrolling model. 1579023
Brian E. Granger ellisonbg Initial draft of panel section and the cell section working. c6ab30b
Brian E. Granger ellisonbg Minor fixes to fonts and spacing. a7ef503
Brian E. Granger ellisonbg Controls in cell section have a solid layout. 71e8168
Brian E. Granger ellisonbg Help section implemented and working. 0376908
Brian E. Granger ellisonbg Minors fixes and initial work on save widget.
* Fixed width of buttons in left panel.
* Started to create a save widget for the header.
e4683b7
Brian E. Granger ellisonbg Work on save widget, kernel status widget and notebook section. 67aa594
Brian E. Granger ellisonbg 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.
f1b3d4a
Brian E. Granger ellisonbg Updating font-sizing to use the YUI protocol. 0c51946
Brian E. Granger ellisonbg Prevent shift-enter from propagating and performing default. d8294f0
Brian E. Granger ellisonbg 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.
00dc27f
Brian E. Granger ellisonbg Added complete method of JS kernel object. 5829983
Brian E. Granger ellisonbg Autocompletion working with CTRL-SPACE. dad53c3
Brian E. Granger ellisonbg 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.
6a242ba
Brian E. Granger ellisonbg 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.
b1f1dde
Brian E. Granger ellisonbg Adding nbformat subpackage. 68687d2
Brian E. Granger ellisonbg Notebook now uses tab for autocompletion. 4b71ab3
Brian E. Granger ellisonbg Fixes to terminal mode execution (ctrl-enter). c88117a
Brian E. Granger ellisonbg Hacks to prevent FLOUC (flash of unformatted content). fbddd43
Brian E. Granger ellisonbg Fixing minor resize bug on the Mac. 27379eb
Brian E. Granger ellisonbg Adding Cell.grow back to fix bug.
This can go away once we star to use CodeMirror for TextCells.
8012152
Brian E. Granger ellisonbg 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.
f3a5072
Brian E. Granger ellisonbg Updates to basic notebook format.
* The format now handles multiple output blocks.
* XML now as worksheets, cells and outputs tags.
4b0e672
Min RK minrk support html representations in the notebook frontend
html gets highest priority, because it is the native language
of the frontend.
1cc83a7
Brian E. Granger ellisonbg Full versioning added to nbformat. 0251893
Brian E. Granger ellisonbg Merge branch 'repr_html' of https://github.com/minrk/ipython into min…
…rk-repr_html
a65c2d3
Brian E. Granger ellisonbg Added lib/display.py for extra display related things. c292a9c
Min RK minrk update add_packages for reorganized nbformat 4c2aebb
Brian E. Granger ellisonbg Fixing setupbase.py for nbformat package. 540b3f1
Brian E. Granger ellisonbg 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.
65666c0
Brian E. Granger ellisonbg Merge branch 'htmlnotebook' of github.com:ipython/ipython into htmlno…
…tebook

Conflicts:
	setupbase.py
d77eb2c
Brian E. Granger ellisonbg Implemented basic notebook browser and fixed numerous bugs. 1699c90
Brian E. Granger ellisonbg Implemented delete functionality in nb browser.
* Dialog confirms the notebook delete.
* Notebook element is removed from list upon deletion.
b0243db
Brian E. Granger ellisonbg File upload/import working from notebook browser. 53c7ec7
Brian E. Granger ellisonbg 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.
8f4eb62
Brian E. Granger ellisonbg Adding kernel/notebook associations. 03eb23c
Brian E. Granger ellisonbg 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.
708c73e
Brian E. Granger ellisonbg Using beforeunload to save at exit and kill the kernel. 7640e54
Brian E. Granger ellisonbg Added saving and loading of output of all types. 2a85499
Brian E. Granger ellisonbg Starting to rename text cell to html cell. b0e516c
Brian E. Granger ellisonbg New HTMl cell working with CodeMirror editing. 653f157
Brian E. Granger ellisonbg Updating CodeMirror to v 2.12.
For now I am keeping the old codemirror2 directory in here until
we finish debugging the new version.
981bc0c
Brian E. Granger ellisonbg Fixing HTML cell syntax highlighting. 3896ff1
Brian E. Granger ellisonbg Starting work on a Markdown cell. f5f6198
Brian E. Granger ellisonbg Refactoring of text/markdown/rst/html cells. fbce942
Brian E. Granger ellisonbg Reordering Export button and renaming Export->Export As 978f742
Brian E. Granger ellisonbg Markdown cells are now saved and restored in notebooks. a85c3e7
Brian E. Granger ellisonbg Implemented smart autoindenting. 4fb6f61
Brian E. Granger ellisonbg Fixed text cell rendering bug. 8bee5f8
Brian E. Granger ellisonbg Updates to the css style of rendered html text cells. db81ec2
Brian E. Granger ellisonbg Minor fixes to config system for notebook. 89e253a
Brian E. Granger ellisonbg Adding minor help strings for keyboard shortcuts. ddb901b
Brian E. Granger ellisonbg Merge branch 'master' into htmlnotebook
Conflicts:
	setupbase.py
fd892df
Brian E. Granger ellisonbg Updating notebook configuration.
* ipython_notebook_config.py 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.
53df0ac
Brian E. Granger ellisonbg 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
  foo.json.
46fc646
Brian E. Granger ellisonbg Adding initial documentation on the notebook. 1bcb722
Brian E. Granger ellisonbg Reducing/adjusting the padding of cells to make the notebook more
compact.

* 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.
b633a93
Brian E. Granger ellisonbg 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.
b84d895
Brian E. Granger ellisonbg 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.
08ef328
Brian E. Granger ellisonbg Autoindentation fixed and enabled by default. eaf692f
Brian E. Granger ellisonbg %loadpy works in the notebook and bug with inline plotting fixed. 1de26e1
Brian E. Granger ellisonbg Fixing padding of output cells. b85982d
Brian E. Granger ellisonbg Added note about imports in IPython.__init__. 1d01468
Brian E. Granger ellisonbg Added collapsed field to the code cell. 1c4a699
Brian E. Granger ellisonbg HTML/Markdown cells no longer saved their rendered output. 31ac0f3
Brian E. Granger ellisonbg Adding time delay to show the notebook saving more clearly. 40d4a55
Brian E. Granger ellisonbg New .py notebook format implemented. 7debcc4
Brian E. Granger ellisonbg Adding tracebacks, evalue and etype to the nbformat and notebook. 3669962
Brian E. Granger ellisonbg HTML output cells are now styled with the rendered_html class. df0ed78
Brian E. Granger ellisonbg Disabling auto-save at exit. 453bf75
Brian E. Granger ellisonbg Clear all output is implemented. 31e9da5
Brian E. Granger ellisonbg 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.
5bad195
Brian E. Granger ellisonbg Merge branch 'master' into htmlnotebook cc6010e
Brian E. Granger ellisonbg Fixing bug that caused plots to not be saved.
CodeCell.append_mime_type needed a default element.
f5c5121
Brian E. Granger ellisonbg Autotry additional ports if 8888 if already in use. d1499b6
Brian E. Granger ellisonbg Browser window title follows the name of the notebook. 1786348
Brian E. Granger ellisonbg Added a notebook dirty flag that is used when exiting page. fb55a88
Brian E. Granger ellisonbg Notebook id removed from the notebook format. a86896d
Brian E. Granger ellisonbg Updating notebook examples to current format. bee9c06
Brian E. Granger ellisonbg Fixing latex rendering bug. feaba3c
Brian E. Granger ellisonbg A single tab-completion match is now automatically selected. 49fa32f
Stefan van der Walt stefanv Prevent ipython.py 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.

Owner

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.

Owner

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 ?

Owner

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.

Owner

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.

Owner

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..

Owner
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.