├── .gitmodules ├── docs ├── source │ ├── _static │ │ ├── .gitkeep │ │ └── images │ │ │ ├── new-notebook.gif │ │ │ ├── cell-toolbar-41.png │ │ │ ├── dashboard-sort.png │ │ │ ├── find-replace-41.png │ │ │ ├── multi-select-41.png │ │ │ ├── shortcut-editor.png │ │ │ ├── blank-notebook-ui.png │ │ │ ├── cell-tags-toolbar.png │ │ │ ├── command-palette-41.png │ │ │ ├── table-style-after.png │ │ │ ├── table-style-before.png │ │ │ ├── jupyter-file-editor.png │ │ │ ├── jupyter-notebook-edit.png │ │ │ ├── jupyter-verification.png │ │ │ ├── jupyter-notebook-dashboard.png │ │ │ └── jupyter-notebook-default.png │ ├── examples │ │ ├── Notebook │ │ │ ├── nbpackage │ │ │ │ ├── __init__.py │ │ │ │ ├── nbs │ │ │ │ │ ├── __init__.py │ │ │ │ │ └── other.ipynb │ │ │ │ └── mynotebook.ipynb │ │ │ ├── images │ │ │ │ ├── edit_mode.png │ │ │ │ ├── command_mode.png │ │ │ │ ├── menubar_toolbar.png │ │ │ │ ├── nbconvert_arch.png │ │ │ │ ├── dashboard_files_tab.png │ │ │ │ ├── dashboard_running_tab.png │ │ │ │ ├── dashboard_files_tab_new.png │ │ │ │ ├── dashboard_files_tab_run.png │ │ │ │ └── dashboard_files_tab_btns.png │ │ │ └── examples_index.rst │ │ ├── images │ │ │ ├── animation.m4v │ │ │ ├── ipython_logo.png │ │ │ ├── jupyter_logo.png │ │ │ ├── FrontendKernel.png │ │ │ └── FrontendKernel.graffle │ │ │ │ └── image1.png │ │ └── utils │ │ │ ├── list_pyfiles.ipy │ │ │ └── list_subdirs.ipy │ ├── contributing.rst │ ├── development_faq.rst │ ├── extending │ │ └── index.rst │ ├── template.tpl │ ├── spelling_wordlist.txt │ ├── index.rst │ ├── ui_components.rst │ ├── development_release.rst │ └── links.txt ├── doc-requirements.txt ├── resources │ ├── ipynb.icns │ ├── running_code.png │ ├── notebook_basics.png │ ├── running_code_med.png │ ├── ipynb.iconset │ │ ├── icon_16x16.png │ │ ├── icon_24x24.png │ │ ├── icon_32x32.png │ │ ├── icon_48x48.png │ │ ├── icon_64x64.png │ │ ├── icon_1024x1024.png │ │ ├── icon_128x128.png │ │ ├── icon_16x16@2x.png │ │ ├── icon_24x24@2x.png │ │ ├── icon_256x256.png │ │ ├── icon_32x32@2x.png │ │ ├── icon_512x512.png │ │ ├── icon_64x64@2x.png │ │ ├── icon_128x128@2x.png │ │ ├── icon_256x256@2x.png │ │ └── icon_512x512@2x.png │ ├── Info.plist.example │ └── generate_icons.sh ├── environment.yml ├── jsdoc_config.json ├── jsdoc_plugin.js └── autogen_config.py ├── notebook ├── base │ └── __init__.py ├── bundler │ ├── __init__.py │ ├── tests │ │ ├── __init__.py │ │ └── resources │ │ │ ├── subdir │ │ │ ├── subsubdir │ │ │ │ └── .gitkeep │ │ │ └── test_file.txt │ │ │ ├── another_subdir │ │ │ └── test_file.txt │ │ │ └── empty.ipynb │ ├── __main__.py │ ├── tarball_bundler.py │ └── zip_bundler.py ├── edit │ ├── __init__.py │ └── handlers.py ├── files │ └── __init__.py ├── tests │ ├── __init__.py │ ├── selenium │ │ ├── __init__.py │ │ ├── test_find_and_replace.py │ │ ├── test_prompt_numbers.py │ │ ├── test_markdown.py │ │ ├── test_save_as_notebook.py │ │ ├── quick_selenium.py │ │ ├── test_dualmode_insertcell.py │ │ └── test_deletecell.py │ ├── mockextension │ │ └── index.js │ ├── test_hist.sqlite │ ├── _testdata │ │ └── black_square_22.png │ ├── test_i18n.py │ ├── notebook │ │ ├── inject_js.js │ │ ├── safe_append_output.js │ │ ├── clipboard_multiselect.js │ │ ├── interrupt.js │ │ ├── merge_cells_api.js │ │ ├── kernel_menu.js │ │ ├── shutdown.js │ │ ├── buffering.js │ │ ├── dualmode_arrows.js │ │ ├── dualmode_markdown.js │ │ └── move_multiselection.js │ ├── README.md │ ├── test_serialize.py │ ├── test_paths.py │ ├── base │ │ ├── misc.js │ │ ├── highlight.js │ │ └── security.js │ └── test_config_manager.py ├── tree │ ├── __init__.py │ └── tests │ │ ├── __init__.py │ │ └── test_tree_handler.py ├── view │ ├── __init__.py │ └── handlers.py ├── auth │ ├── tests │ │ ├── __init__.py │ │ └── test_security.py │ ├── __init__.py │ ├── logout.py │ └── __main__.py ├── kernelspecs │ ├── __init__.py │ └── handlers.py ├── nbconvert │ ├── __init__.py │ └── tests │ │ └── __init__.py ├── notebook │ ├── __init__.py │ └── handlers.py ├── services │ ├── __init__.py │ ├── api │ │ ├── __init__.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_api.py │ │ └── handlers.py │ ├── contents │ │ ├── __init__.py │ │ └── tests │ │ │ └── __init__.py │ ├── kernels │ │ ├── __init__.py │ │ └── tests │ │ │ └── __init__.py │ ├── sessions │ │ ├── __init__.py │ │ └── tests │ │ │ └── __init__.py │ ├── config │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_config_api.py │ │ ├── __init__.py │ │ ├── handlers.py │ │ └── manager.py │ ├── kernelspecs │ │ ├── __init__.py │ │ └── tests │ │ │ └── __init__.py │ ├── nbconvert │ │ ├── __init__.py │ │ ├── tests │ │ │ ├── __init__.py │ │ │ └── test_nbconvert_api.py │ │ └── handlers.py │ ├── security │ │ ├── __init__.py │ │ └── handlers.py │ └── shutdown.py ├── static │ ├── robots.txt │ ├── auth │ │ ├── less │ │ │ ├── logout.less │ │ │ ├── style.less │ │ │ └── login.less │ │ ├── css │ │ │ └── override.css │ │ └── js │ │ │ ├── main.js │ │ │ ├── logoutmain.js │ │ │ ├── loginmain.js │ │ │ └── loginwidget.js │ ├── favicon.ico │ ├── base │ │ ├── images │ │ │ ├── logo.png │ │ │ ├── favicon.ico │ │ │ ├── favicon-file.ico │ │ │ ├── favicon-busy-1.ico │ │ │ ├── favicon-busy-2.ico │ │ │ ├── favicon-busy-3.ico │ │ │ ├── favicon-notebook.ico │ │ │ └── favicon-terminal.ico │ │ ├── less │ │ │ ├── style.less │ │ │ ├── mixins.less │ │ │ ├── error.less │ │ │ └── variables.less │ │ └── js │ │ │ ├── i18n.js │ │ │ ├── promises.js │ │ │ ├── events.js │ │ │ └── page.js │ ├── tree │ │ ├── less │ │ │ ├── style.less │ │ │ └── altuploadform.less │ │ └── js │ │ │ └── shutdownbutton.js │ ├── edit │ │ ├── less │ │ │ ├── style.less │ │ │ ├── menubar.less │ │ │ └── edit.less │ │ └── js │ │ │ └── notificationarea.js │ ├── notebook │ │ ├── less │ │ │ ├── highlight-refs.less │ │ │ ├── kernelselector.less │ │ │ ├── quickhelp.less │ │ │ ├── style_noapp.less │ │ │ ├── modal.less │ │ │ ├── notificationwidget.less │ │ │ ├── style.less │ │ │ ├── completer.less │ │ │ ├── searchandreplace.less │ │ │ ├── variables.less │ │ │ ├── commandpalette.less │ │ │ ├── tagbar.less │ │ │ ├── toolbar.less │ │ │ ├── savewidget.less │ │ │ ├── notificationarea.less │ │ │ ├── pager.less │ │ │ ├── celltoolbar.less │ │ │ ├── codecell.less │ │ │ ├── ansicolors.less │ │ │ └── textcell.less │ │ ├── css │ │ │ └── override.css │ │ └── js │ │ │ ├── promises.js │ │ │ ├── codemirror-ipython.js │ │ │ ├── celltoolbarpresets │ │ │ ├── attachments.js │ │ │ ├── default.js │ │ │ └── slideshow.js │ │ │ ├── about.js │ │ │ └── codemirror-ipythongfm.js │ ├── terminal │ │ ├── css │ │ │ └── override.css │ │ ├── less │ │ │ └── terminal.less │ │ └── js │ │ │ ├── terminado.js │ │ │ └── main.js │ ├── style │ │ ├── ipython.less │ │ └── style.less │ ├── custom │ │ └── custom.css │ └── bidi │ │ ├── bidi.js │ │ └── numericshaping.js ├── i18n │ ├── babel_notebook.cfg │ ├── babel_nbui.cfg │ ├── nbjs.json │ └── babel_nbjs.cfg ├── __main__.py ├── templates │ ├── 404.html │ ├── view.html │ ├── error.html │ ├── terminal.html │ └── logout.html ├── transutils.py ├── _version.py ├── __init__.py ├── _tz.py ├── terminal │ ├── api_handlers.py │ ├── handlers.py │ └── __init__.py ├── metrics.py └── log.py ├── git-hooks ├── post-merge ├── install-hooks.sh ├── README.md └── post-checkout ├── .babelrc ├── .bowerrc ├── .eslintignore ├── readthedocs.yml ├── docs-translations └── ko-KR │ ├── resources │ ├── dashboard.GIF │ ├── edit_mode.GIF │ ├── file_editor.GIF │ ├── Notebook_Editor.GIF │ └── running_code_med.png │ ├── Installation.md │ ├── UIComponents.md │ └── HowtoRun.md ├── codecov.yml ├── .eslintrc.json ├── MANIFEST.in ├── package.json ├── setup.cfg ├── .gitignore ├── appveyor.yml ├── bower.json └── tools └── build-main.js /.gitmodules: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/_static/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/base/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/bundler/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/edit/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/files/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/tree/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/view/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /git-hooks/post-merge: -------------------------------------------------------------------------------- 1 | post-checkout -------------------------------------------------------------------------------- /notebook/auth/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/kernelspecs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/nbconvert/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/notebook/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/api/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/tree/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/bundler/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/nbconvert/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/contents/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/kernels/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/sessions/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/tests/selenium/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/api/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/config/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/kernels/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/kernelspecs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/nbconvert/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/contents/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/kernelspecs/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/nbconvert/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/services/sessions/tests/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.babelrc: -------------------------------------------------------------------------------- 1 | { 2 | "presets": ["es2015"], 3 | } 4 | -------------------------------------------------------------------------------- /docs/source/examples/Notebook/nbpackage/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /docs/source/examples/Notebook/nbpackage/nbs/__init__.py: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /notebook/auth/__init__.py: -------------------------------------------------------------------------------- 1 | from .security import passwd 2 | -------------------------------------------------------------------------------- /notebook/bundler/tests/resources/subdir/subsubdir/.gitkeep: -------------------------------------------------------------------------------- 1 | -------------------------------------------------------------------------------- /.bowerrc: -------------------------------------------------------------------------------- 1 | { 2 | "directory": "notebook/static/components" 3 | } -------------------------------------------------------------------------------- /notebook/static/robots.txt: -------------------------------------------------------------------------------- 1 | User-agent: * 2 | Disallow: / 3 | -------------------------------------------------------------------------------- /notebook/tests/mockextension/index.js: -------------------------------------------------------------------------------- 1 | console.log('z'); 2 | -------------------------------------------------------------------------------- /docs/doc-requirements.txt: -------------------------------------------------------------------------------- 1 | sphinx>=1.3.6 2 | sphinx-rtd-theme 3 | nbsphinx 4 | -------------------------------------------------------------------------------- /notebook/bundler/tests/resources/subdir/test_file.txt: -------------------------------------------------------------------------------- 1 | Used to test globbing. -------------------------------------------------------------------------------- /notebook/services/config/__init__.py: -------------------------------------------------------------------------------- 1 | from .manager import ConfigManager 2 | -------------------------------------------------------------------------------- /notebook/bundler/tests/resources/another_subdir/test_file.txt: -------------------------------------------------------------------------------- 1 | Used to test globbing. -------------------------------------------------------------------------------- /notebook/static/auth/less/logout.less: -------------------------------------------------------------------------------- 1 | // Custom styles for logout.html 2 | 3 | -------------------------------------------------------------------------------- /.eslintignore: -------------------------------------------------------------------------------- 1 | *.min.js 2 | *components* 3 | *node_modules* 4 | *built* 5 | *build* 6 | -------------------------------------------------------------------------------- /readthedocs.yml: -------------------------------------------------------------------------------- 1 | conda: 2 | file: docs/environment.yml 3 | python: 4 | version: 3 5 | -------------------------------------------------------------------------------- /docs/source/contributing.rst: -------------------------------------------------------------------------------- 1 | .. highlight:: sh 2 | 3 | .. include:: ../../CONTRIBUTING.rst 4 | -------------------------------------------------------------------------------- /docs/resources/ipynb.icns: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.icns -------------------------------------------------------------------------------- /notebook/i18n/babel_notebook.cfg: -------------------------------------------------------------------------------- 1 | [python: notebook/*.py] 2 | [python: notebook/services/contents/*.py] 3 | -------------------------------------------------------------------------------- /notebook/static/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/favicon.ico -------------------------------------------------------------------------------- /docs/resources/running_code.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/running_code.png -------------------------------------------------------------------------------- /notebook/tests/test_hist.sqlite: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/tests/test_hist.sqlite -------------------------------------------------------------------------------- /docs/resources/notebook_basics.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/notebook_basics.png -------------------------------------------------------------------------------- /docs/resources/running_code_med.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/running_code_med.png -------------------------------------------------------------------------------- /notebook/static/base/images/logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/logo.png -------------------------------------------------------------------------------- /notebook/static/auth/less/style.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * IPython auth 4 | * 5 | */ 6 | @import "login.less"; 7 | @import "logout.less"; -------------------------------------------------------------------------------- /notebook/static/base/images/favicon.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon.ico -------------------------------------------------------------------------------- /docs/source/examples/images/animation.m4v: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/images/animation.m4v -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_16x16.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_16x16.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_24x24.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_24x24.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_32x32.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_32x32.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_48x48.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_48x48.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_64x64.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_64x64.png -------------------------------------------------------------------------------- /docs/source/_static/images/new-notebook.gif: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/new-notebook.gif -------------------------------------------------------------------------------- /docs/source/examples/images/ipython_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/images/ipython_logo.png -------------------------------------------------------------------------------- /docs/source/examples/images/jupyter_logo.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/images/jupyter_logo.png -------------------------------------------------------------------------------- /notebook/bundler/tests/resources/empty.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "nbformat_minor": 0, 3 | "cells": [], 4 | "nbformat": 4, 5 | "metadata": {} 6 | } -------------------------------------------------------------------------------- /notebook/static/base/images/favicon-file.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon-file.ico -------------------------------------------------------------------------------- /notebook/static/tree/less/style.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * IPython tree view 4 | * 5 | */ 6 | @import "altuploadform.less"; 7 | @import "tree.less"; -------------------------------------------------------------------------------- /notebook/tests/_testdata/black_square_22.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/tests/_testdata/black_square_22.png -------------------------------------------------------------------------------- /docs-translations/ko-KR/resources/dashboard.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs-translations/ko-KR/resources/dashboard.GIF -------------------------------------------------------------------------------- /docs-translations/ko-KR/resources/edit_mode.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs-translations/ko-KR/resources/edit_mode.GIF -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_1024x1024.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_1024x1024.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_128x128.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_128x128.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_16x16@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_16x16@2x.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_24x24@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_24x24@2x.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_256x256.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_256x256.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_32x32@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_32x32@2x.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_512x512.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_512x512.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_64x64@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_64x64@2x.png -------------------------------------------------------------------------------- /docs/source/_static/images/cell-toolbar-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/cell-toolbar-41.png -------------------------------------------------------------------------------- /docs/source/_static/images/dashboard-sort.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/dashboard-sort.png -------------------------------------------------------------------------------- /docs/source/_static/images/find-replace-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/find-replace-41.png -------------------------------------------------------------------------------- /docs/source/_static/images/multi-select-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/multi-select-41.png -------------------------------------------------------------------------------- /docs/source/_static/images/shortcut-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/shortcut-editor.png -------------------------------------------------------------------------------- /docs/source/examples/images/FrontendKernel.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/images/FrontendKernel.png -------------------------------------------------------------------------------- /notebook/i18n/babel_nbui.cfg: -------------------------------------------------------------------------------- 1 | [jinja2: notebook/templates/**.html] 2 | encoding = utf-8 3 | [extractors] 4 | jinja2 = jinja2.ext:babel_extract 5 | -------------------------------------------------------------------------------- /notebook/static/base/images/favicon-busy-1.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon-busy-1.ico -------------------------------------------------------------------------------- /notebook/static/base/images/favicon-busy-2.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon-busy-2.ico -------------------------------------------------------------------------------- /notebook/static/base/images/favicon-busy-3.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon-busy-3.ico -------------------------------------------------------------------------------- /docs-translations/ko-KR/resources/file_editor.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs-translations/ko-KR/resources/file_editor.GIF -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_128x128@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_128x128@2x.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_256x256@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_256x256@2x.png -------------------------------------------------------------------------------- /docs/resources/ipynb.iconset/icon_512x512@2x.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/resources/ipynb.iconset/icon_512x512@2x.png -------------------------------------------------------------------------------- /docs/source/_static/images/blank-notebook-ui.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/blank-notebook-ui.png -------------------------------------------------------------------------------- /docs/source/_static/images/cell-tags-toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/cell-tags-toolbar.png -------------------------------------------------------------------------------- /docs/source/_static/images/command-palette-41.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/command-palette-41.png -------------------------------------------------------------------------------- /docs/source/_static/images/table-style-after.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/table-style-after.png -------------------------------------------------------------------------------- /docs/source/_static/images/table-style-before.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/table-style-before.png -------------------------------------------------------------------------------- /notebook/static/base/images/favicon-notebook.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon-notebook.ico -------------------------------------------------------------------------------- /notebook/static/base/images/favicon-terminal.ico: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/notebook/static/base/images/favicon-terminal.ico -------------------------------------------------------------------------------- /notebook/static/edit/less/style.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * IPython text editor webapp 4 | * 5 | */ 6 | @import "menubar.less"; 7 | @import "edit.less"; 8 | -------------------------------------------------------------------------------- /docs/source/_static/images/jupyter-file-editor.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/jupyter-file-editor.png -------------------------------------------------------------------------------- /docs/source/_static/images/jupyter-notebook-edit.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/jupyter-notebook-edit.png -------------------------------------------------------------------------------- /docs/source/_static/images/jupyter-verification.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/jupyter-verification.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/edit_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/edit_mode.png -------------------------------------------------------------------------------- /docs-translations/ko-KR/resources/Notebook_Editor.GIF: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs-translations/ko-KR/resources/Notebook_Editor.GIF -------------------------------------------------------------------------------- /docs-translations/ko-KR/resources/running_code_med.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs-translations/ko-KR/resources/running_code_med.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/command_mode.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/command_mode.png -------------------------------------------------------------------------------- /docs/source/_static/images/jupyter-notebook-dashboard.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/jupyter-notebook-dashboard.png -------------------------------------------------------------------------------- /docs/source/_static/images/jupyter-notebook-default.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/_static/images/jupyter-notebook-default.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/menubar_toolbar.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/menubar_toolbar.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/nbconvert_arch.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/nbconvert_arch.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/dashboard_files_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/dashboard_files_tab.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/dashboard_running_tab.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/dashboard_running_tab.png -------------------------------------------------------------------------------- /docs/source/examples/images/FrontendKernel.graffle/image1.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/images/FrontendKernel.graffle/image1.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/dashboard_files_tab_new.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/dashboard_files_tab_new.png -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/dashboard_files_tab_run.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/dashboard_files_tab_run.png -------------------------------------------------------------------------------- /notebook/__main__.py: -------------------------------------------------------------------------------- 1 | from __future__ import absolute_import 2 | 3 | if __name__ == '__main__': 4 | from notebook import notebookapp as app 5 | app.launch_new_instance() 6 | -------------------------------------------------------------------------------- /docs/source/examples/Notebook/images/dashboard_files_tab_btns.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/0101011/notebook/master/docs/source/examples/Notebook/images/dashboard_files_tab_btns.png -------------------------------------------------------------------------------- /codecov.yml: -------------------------------------------------------------------------------- 1 | coverage: 2 | status: 3 | project: 4 | default: 5 | target: auto 6 | threshold: 10 7 | patch: 8 | default: 9 | target: 0% 10 | -------------------------------------------------------------------------------- /notebook/templates/404.html: -------------------------------------------------------------------------------- 1 | {% extends "error.html" %} 2 | {% block error_detail %} 3 |

{% trans %}You are requesting a page that does not exist!{% endtrans %}

4 | {% endblock %} 5 | 6 | -------------------------------------------------------------------------------- /notebook/static/base/less/style.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * IPython base 4 | * 5 | */ 6 | @import "variables.less"; 7 | @import "mixins.less"; 8 | @import "flexbox.less"; 9 | @import "error.less"; 10 | -------------------------------------------------------------------------------- /notebook/bundler/__main__.py: -------------------------------------------------------------------------------- 1 | # Copyright (c) Jupyter Development Team. 2 | # Distributed under the terms of the Modified BSD License. 3 | 4 | from .bundlerextensions import main 5 | 6 | if __name__ == '__main__': 7 | main() -------------------------------------------------------------------------------- /docs/source/examples/utils/list_pyfiles.ipy: -------------------------------------------------------------------------------- 1 | # A simple IPython script that provides Notebook links to .py files in the cwd 2 | 3 | from IPython.display import FileLink, display 4 | files =!ls *.py 5 | for f in files: 6 | display(FileLink(f)) -------------------------------------------------------------------------------- /notebook/i18n/nbjs.json: -------------------------------------------------------------------------------- 1 | { 2 | "domain": "nbjs", 3 | "supported_languages": [ 4 | "zh-CN" 5 | ], 6 | "locale_data": { 7 | "nbjs": { 8 | "": { 9 | "domain": "nbjs" 10 | } 11 | } 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /docs/source/examples/utils/list_subdirs.ipy: -------------------------------------------------------------------------------- 1 | # A simple IPython script that lists files in all subdirs 2 | 3 | from IPython.display import FileLinks, display 4 | dirs =!ls -d */ 5 | for d in dirs: 6 | if d != '__pycache__/': 7 | display(FileLinks(d)) -------------------------------------------------------------------------------- /docs/environment.yml: -------------------------------------------------------------------------------- 1 | name: notebook_docs 2 | dependencies: 3 | - python=3.5 4 | - sphinx_rtd_theme 5 | - jinja2 6 | - tornado 7 | - nbformat 8 | - jupyter_client 9 | - ipykernel 10 | - sphinx 11 | - pip: 12 | - nbsphinx 13 | - Send2Trash 14 | - prometheus_client 15 | -------------------------------------------------------------------------------- /docs/source/development_faq.rst: -------------------------------------------------------------------------------- 1 | .. _development_faq: 2 | 3 | Developer FAQ 4 | ============= 5 | 6 | 1. How do I install a prerelease version such as a beta or release candidate? 7 | 8 | .. code-block:: bash 9 | 10 | python -m pip install notebook --pre --upgrade 11 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/highlight-refs.less: -------------------------------------------------------------------------------- 1 | /* load the codemirror defaults as LESS so that highlight.less 2 | can load default theme declarations by reference without pulling in the 3 | nasty positioning 4 | */ 5 | @import (less) "../../components/codemirror/lib/codemirror.css"; 6 | -------------------------------------------------------------------------------- /git-hooks/install-hooks.sh: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env bash 2 | 3 | DOTGIT=`git rev-parse --git-dir` 4 | TOPLEVEL=`git rev-parse --show-toplevel` 5 | TO=${DOTGIT}/hooks 6 | FROM=${TOPLEVEL}/git-hooks 7 | 8 | ln -s ${FROM}/post-checkout ${TO}/post-checkout 9 | ln -s ${FROM}/post-merge ${TO}/post-merge 10 | -------------------------------------------------------------------------------- /notebook/services/security/__init__.py: -------------------------------------------------------------------------------- 1 | # URI for the CSP Report. Included here to prevent a cyclic dependency. 2 | # csp_report_uri is needed both by the BaseHandler (for setting the report-uri) 3 | # and by the CSPReportHandler (which depends on the BaseHandler). 4 | csp_report_uri = r"/api/security/csp-report" 5 | -------------------------------------------------------------------------------- /.eslintrc.json: -------------------------------------------------------------------------------- 1 | { 2 | "parserOptions": { 3 | "ecmaVersion": 6, 4 | "sourceType": "module" 5 | }, 6 | "rules": { 7 | "semi": 1, 8 | "no-cond-assign": 2, 9 | "no-debugger": 2, 10 | "comma-dangle": 0, 11 | "no-unreachable" : 2 12 | } 13 | } 14 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/kernelselector.less: -------------------------------------------------------------------------------- 1 | #kernel_logo_widget { 2 | .current_kernel_logo { 3 | display: none; 4 | .navbar-vertical-align(32px); 5 | width: 32px; 6 | height: 32px; 7 | } 8 | } 9 | 10 | [dir="rtl"] #kernel_logo_widget { 11 | .pull-left(); 12 | } 13 | -------------------------------------------------------------------------------- /git-hooks/README.md: -------------------------------------------------------------------------------- 1 | git hooks for Jupyter 2 | 3 | add these to your `.git/hooks` 4 | 5 | For now, we just have `post-checkout` and `post-merge`, 6 | both of which attempt to rebuild javascript and css sourcemaps, 7 | so make sure that you have a fully synced repo whenever you checkout or pull. 8 | 9 | To use these hooks, run `./install-hooks.sh`. 10 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/quickhelp.less: -------------------------------------------------------------------------------- 1 | .quickhelp { 2 | .hbox(); 3 | line-height: 1.8em; 4 | } 5 | .shortcut_key { 6 | display: inline-block; 7 | width: 21ex; 8 | text-align: right; 9 | font-family: @font-family-monospace; 10 | } 11 | 12 | .shortcut_descr { 13 | display: inline-block; 14 | .box-flex1(); 15 | } 16 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/style_noapp.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * IPython notebook 4 | * 5 | */ 6 | @import "variables.less"; 7 | @import "ansicolors.less"; 8 | @import "cell.less"; 9 | @import "codecell.less"; 10 | @import "codemirror.less"; 11 | @import "highlight.less"; 12 | @import "outputarea.less"; 13 | @import "renderedhtml.less"; 14 | @import "textcell.less"; 15 | -------------------------------------------------------------------------------- /notebook/static/terminal/css/override.css: -------------------------------------------------------------------------------- 1 | /*This file contains any manual css for this page that needs to override the global styles. 2 | This is only required when different pages style the same element differently. This is just 3 | a hack to deal with our current css styles and no new styling should be added in this file.*/ 4 | 5 | body { 6 | overflow: hidden; 7 | } 8 | -------------------------------------------------------------------------------- /notebook/tests/test_i18n.py: -------------------------------------------------------------------------------- 1 | import nose.tools as nt 2 | 3 | from notebook import i18n 4 | 5 | def test_parse_accept_lang_header(): 6 | palh = i18n.parse_accept_lang_header 7 | nt.assert_equal(palh(''), []) 8 | nt.assert_equal(palh('zh-CN,en-GB;q=0.7,en;q=0.3'), 9 | ['en', 'en_GB', 'zh_CN']) 10 | nt.assert_equal(palh('nl,fr;q=0'), ['nl']) 11 | -------------------------------------------------------------------------------- /notebook/static/notebook/css/override.css: -------------------------------------------------------------------------------- 1 | /*This file contains any manual css for this page that needs to override the global styles. 2 | This is only required when different pages style the same element differently. This is just 3 | a hack to deal with our current css styles and no new styling should be added in this file.*/ 4 | 5 | #ipython-main-app { 6 | position: relative; 7 | } 8 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/modal.less: -------------------------------------------------------------------------------- 1 | .modal .modal-body { 2 | 3 | .rename-message { 4 | 5 | } 6 | .move-path { 7 | display: flex; 8 | flex-direction: row; 9 | justify-content: space; 10 | align-items: center; 11 | 12 | .server-root { 13 | padding-right: 20px; 14 | } 15 | .path-input { 16 | flex: 1; 17 | } 18 | } 19 | } 20 | -------------------------------------------------------------------------------- /notebook/static/auth/css/override.css: -------------------------------------------------------------------------------- 1 | /*This file contains any manual css for this page that needs to override the global styles. 2 | This is only required when different pages style the same element differently. This is just 3 | a hack to deal with our current css styles and no new styling should be added in this file.*/ 4 | 5 | #ipython-main-app { 6 | padding-top: 50px; 7 | text-align: center; 8 | } -------------------------------------------------------------------------------- /notebook/static/base/less/mixins.less: -------------------------------------------------------------------------------- 1 | // Mixin CSS classes 2 | 3 | .border-box-sizing { 4 | box-sizing: border-box; 5 | -moz-box-sizing: border-box; 6 | -webkit-box-sizing: border-box; 7 | } 8 | 9 | .corner-all { 10 | border-radius: @border-radius-base; 11 | } 12 | 13 | .border-radius(@radius) { 14 | border-radius: @radius; 15 | } 16 | 17 | .no-padding { 18 | padding: 0px; 19 | } 20 | -------------------------------------------------------------------------------- /notebook/i18n/babel_nbjs.cfg: -------------------------------------------------------------------------------- 1 | [javascript: notebook/static/base/js/*.js] 2 | extract_messages = $._, i18n.msg._ 3 | 4 | [javascript: notebook/static/notebook/js/*.js] 5 | extract_messages = $._, i18n.msg._ 6 | 7 | [javascript: notebook/static/notebook/js/celltoolbarpresets/*.js] 8 | extract_messages = $._, i18n.msg._ 9 | 10 | [javascript: notebook/static/tree/js/*.js] 11 | extract_messages = $._, i18n.msg._ 12 | -------------------------------------------------------------------------------- /notebook/static/auth/js/main.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define(['./loginmain', './logoutmain', 'bidi/bidi'], function (login_main, logout_main, bidi) { 5 | if(bidi.isMirroringEnabled()){ 6 | $("body").attr("dir","rtl"); 7 | } 8 | return { 9 | login_main: login_main, 10 | logout_main: logout_main 11 | }; 12 | }); 13 | -------------------------------------------------------------------------------- /notebook/static/style/ipython.less: -------------------------------------------------------------------------------- 1 | // minimal imports from bootstrap - only variables and mixins 2 | @import "../components/bootstrap/less/variables.less"; 3 | @import "../components/bootstrap/less/mixins.less"; 4 | 5 | // minimal imports from font-awesome 6 | @import "../components/font-awesome/less/variables.less"; 7 | 8 | // base 9 | @import "../base/less/style.less"; 10 | 11 | // notebook 12 | @import "../notebook/less/style_noapp.less"; 13 | -------------------------------------------------------------------------------- /notebook/static/auth/js/logoutmain.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define(['base/js/namespace', 'base/js/page'], function(IPython, page) { 5 | function logout_main() { 6 | var page_instance = new page.Page('div#header', 'div#site'); 7 | page_instance.show(); 8 | 9 | IPython.page = page_instance; 10 | } 11 | return logout_main; 12 | }); 13 | -------------------------------------------------------------------------------- /notebook/services/shutdown.py: -------------------------------------------------------------------------------- 1 | """HTTP handler to shut down the notebook server. 2 | """ 3 | from tornado import web, ioloop 4 | from notebook.base.handlers import IPythonHandler 5 | 6 | class ShutdownHandler(IPythonHandler): 7 | @web.authenticated 8 | def post(self): 9 | self.log.info("Shutting down on /api/shutdown request.") 10 | ioloop.IOLoop.current().stop() 11 | 12 | 13 | default_handlers = [ 14 | (r"/api/shutdown", ShutdownHandler), 15 | ] 16 | -------------------------------------------------------------------------------- /notebook/static/base/less/error.less: -------------------------------------------------------------------------------- 1 | div.error { 2 | margin: 2em; 3 | text-align: center; 4 | } 5 | 6 | div.error > h1 { 7 | font-size: 500%; 8 | line-height: normal; 9 | } 10 | 11 | div.error > p { 12 | font-size: 200%; 13 | line-height: normal; 14 | } 15 | 16 | div.traceback-wrapper { 17 | text-align: left; 18 | max-width: 800px; 19 | margin: auto; 20 | pre.traceback { 21 | max-height: 600px; 22 | overflow: auto; 23 | } 24 | } 25 | -------------------------------------------------------------------------------- /notebook/static/custom/custom.css: -------------------------------------------------------------------------------- 1 | /* 2 | Placeholder for custom user CSS 3 | 4 | mainly to be overridden in profile/static/custom/custom.css 5 | 6 | This will always be an empty file in IPython 7 | */ 8 | 9 | /*for the error , connecting & renaming window*/ 10 | 11 | [dir="rtl"] .modal-footer { 12 | text-align : left !important; 13 | } 14 | 15 | [dir="rtl"] .close { 16 | float : left; 17 | } 18 | 19 | [dir="rtl"] .fa-step-forward::before { 20 | content: "\f048"; 21 | } 22 | -------------------------------------------------------------------------------- /docs/jsdoc_config.json: -------------------------------------------------------------------------------- 1 | { 2 | "markdown": { 3 | "parser": "gfm" 4 | }, 5 | "plugins": [ 6 | "plugins/markdown" , 7 | "jsdoc_plugin.js" 8 | ], 9 | "source": { 10 | "include": [ 11 | "../notebook/static/notebook/js/notebook.js" 12 | ] 13 | }, 14 | "tags": { 15 | "allowUnknownTags": true 16 | }, 17 | "templates": { 18 | "cleverLinks": false, 19 | "monospaceLinks": false 20 | } 21 | } 22 | -------------------------------------------------------------------------------- /notebook/static/auth/less/login.less: -------------------------------------------------------------------------------- 1 | // Custom styles for login.html 2 | .center-nav { 3 | display: inline-block; 4 | // pull the lower margin back 5 | margin-bottom: -4px; 6 | } 7 | 8 | [dir="rtl"] .center-nav { 9 | form.pull-left { 10 | .pull-right(); 11 | } 12 | .navbar-text { 13 | float: right; 14 | } 15 | } 16 | 17 | [dir="rtl"] .navbar-inner { 18 | text-align: right; 19 | } 20 | 21 | [dir="rtl"] div.text-left { 22 | .text-right(); 23 | } 24 | -------------------------------------------------------------------------------- /notebook/transutils.py: -------------------------------------------------------------------------------- 1 | """Translation related utilities. When imported, injects _ to builtins""" 2 | 3 | # Copyright (c) Jupyter Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | import os 7 | import gettext 8 | 9 | 10 | # Set up message catalog access 11 | base_dir = os.path.realpath(os.path.join(__file__, '..', '..')) 12 | trans = gettext.translation('notebook', localedir=os.path.join(base_dir, 'notebook/i18n'), fallback=True) 13 | _ = trans.gettext 14 | -------------------------------------------------------------------------------- /notebook/static/auth/js/loginmain.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define(['jquery', 'base/js/namespace', 'base/js/page'], function($, IPython, page) { 5 | function login_main() { 6 | var page_instance = new page.Page('div#header', 'div#site'); 7 | page_instance.show(); 8 | $('input#password_input').focus(); 9 | IPython.page = page_instance; 10 | } 11 | return login_main; 12 | }); 13 | -------------------------------------------------------------------------------- /notebook/static/base/js/i18n.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | // Module to handle i18n ( Internationalization ) and translated UI 5 | 6 | define([ 7 | 'jed' 8 | ], function(Jed) { 9 | "use strict"; 10 | 11 | var i18n = new Jed(document.nbjs_translations); 12 | i18n._ = i18n.gettext; 13 | i18n.msg = i18n; // Just a place holder until the init promise resolves. 14 | 15 | return i18n; 16 | }); 17 | -------------------------------------------------------------------------------- /docs/jsdoc_plugin.js: -------------------------------------------------------------------------------- 1 | exports.handlers = { 2 | newDoclet: function(e) { 3 | // e.doclet will refer to the newly created doclet 4 | // you can read and modify properties of that doclet if you wish 5 | if (typeof e.doclet.name === 'string') { 6 | if (e.doclet.name[0] == '_') { 7 | console.log('Private method "' + e.doclet.longname + '" not documented.'); 8 | e.doclet.memberof = ''; 9 | } 10 | } 11 | } 12 | }; -------------------------------------------------------------------------------- /docs/source/extending/index.rst: -------------------------------------------------------------------------------- 1 | ====================== 2 | Extending the Notebook 3 | ====================== 4 | 5 | Certain subsystems of the notebook server are designed to be extended or 6 | overridden by users. These documents explain these systems, and show how to 7 | override the notebook's defaults with your own custom behavior. 8 | 9 | .. toctree:: 10 | :maxdepth: 2 11 | 12 | contents 13 | savehooks 14 | handlers 15 | frontend_extensions 16 | keymaps 17 | bundler_extensions 18 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/notificationwidget.less: -------------------------------------------------------------------------------- 1 | .notification_widget { 2 | color: @navbar-default-link-color; 3 | z-index: 10; 4 | background: @notification_widget_bg; 5 | margin-right: 4px; 6 | .btn-default(); 7 | } 8 | 9 | .notification_widget.warning { 10 | .btn-warning(); 11 | } 12 | .notification_widget.success { 13 | .btn-success(); 14 | } 15 | .notification_widget.info { 16 | .btn-info(); 17 | } 18 | .notification_widget.danger { 19 | .btn-danger(); 20 | } 21 | 22 | -------------------------------------------------------------------------------- /notebook/_version.py: -------------------------------------------------------------------------------- 1 | """ 2 | store the current version info of the notebook. 3 | 4 | """ 5 | 6 | # Downstream maintainer, when running `python.setup.py jsversion`, 7 | # the version string is propagated to the JavaScript files, do not forget to 8 | # patch the JavaScript files in `.postN` release done by distributions. 9 | 10 | # Next beta/alpha/rc release: The version number for beta is X.Y.ZbN **without dots**. 11 | 12 | version_info = (5, 6, 0, '.dev0') 13 | __version__ = '.'.join(map(str, version_info[:3])) + ''.join(version_info[3:]) 14 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/style.less: -------------------------------------------------------------------------------- 1 | @import "style_noapp.less"; 2 | 3 | /*! 4 | * 5 | * IPython notebook webapp 6 | * 7 | */ 8 | @import "notebook.less"; 9 | @import "celltoolbar.less"; 10 | @import "tagbar.less"; 11 | @import "completer.less"; 12 | @import "kernelselector.less"; 13 | @import "modal.less"; 14 | @import "menubar.less"; 15 | @import "notificationarea.less"; 16 | @import "notificationwidget.less"; 17 | @import "pager.less"; 18 | @import "quickhelp.less"; 19 | @import "savewidget.less"; 20 | @import "toolbar.less"; 21 | @import "tooltip.less"; 22 | -------------------------------------------------------------------------------- /notebook/static/edit/less/menubar.less: -------------------------------------------------------------------------------- 1 | .selected-keymap { 2 | i.fa { 3 | padding: 0px 5px; 4 | } 5 | i.fa:before { 6 | content: @fa-var-check; 7 | } 8 | } 9 | 10 | #mode-menu { 11 | // truncate mode-menu, so it doesn't get longer than the screen 12 | overflow: auto; 13 | max-height: 20em; 14 | } 15 | 16 | .edit_app { 17 | #header { 18 | .box-shadow(@global-shadow); 19 | } 20 | 21 | #menubar .navbar { 22 | /* Use a negative 1 bottom margin, so the border overlaps the border of the 23 | header */ 24 | margin-bottom: -1px; 25 | } 26 | } 27 | -------------------------------------------------------------------------------- /MANIFEST.in: -------------------------------------------------------------------------------- 1 | include COPYING.md 2 | include CONTRIBUTING.rst 3 | include README.md 4 | include package.json 5 | include bower.json 6 | include .bowerrc 7 | include setupbase.py 8 | include Dockerfile 9 | graft tools 10 | 11 | # Documentation 12 | graft docs 13 | exclude docs/\#* 14 | 15 | # Examples 16 | graft examples 17 | 18 | # docs subdirs we want to skip 19 | prune docs/build 20 | prune docs/gh-pages 21 | prune docs/dist 22 | 23 | # Patterns to exclude from any directory 24 | global-exclude *~ 25 | global-exclude *.pyc 26 | global-exclude *.pyo 27 | global-exclude .git 28 | global-exclude .ipynb_checkpoints 29 | -------------------------------------------------------------------------------- /git-hooks/post-checkout: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | 3 | if [[ "$(basename $0)" == "post-merge" ]]; then 4 | PREVIOUS_HEAD=ORIG_HEAD 5 | else 6 | PREVIOUS_HEAD=$1 7 | fi 8 | 9 | # if style changed (and less available), rebuild sourcemaps 10 | if [[ 11 | ! -z "$(git diff $PREVIOUS_HEAD notebook/static/*/js/**.js)" 12 | ]]; then 13 | echo "rebuilding javascript" 14 | python setup.py js || echo "fail to rebuild javascript" 15 | fi 16 | 17 | if [[ 18 | ! -z "$(git diff $PREVIOUS_HEAD notebook/static/*/less/**.less)" 19 | ]]; then 20 | echo "rebuilding css sourcemaps" 21 | python setup.py css || echo "fail to recompile css" 22 | fi 23 | -------------------------------------------------------------------------------- /docs/source/template.tpl: -------------------------------------------------------------------------------- 1 | {%- extends 'rst.tpl' -%} 2 | 3 | {% macro notebooklink() -%} 4 | 5 | `View the original notebook on nbviewer `__ 6 | 7 | 8 | {%- endmacro %} 9 | 10 | {%- block header %} 11 | {{ notebooklink() }} 12 | {% endblock header -%} 13 | 14 | {%- block footer %} 15 | {{ notebooklink() }} 16 | {% endblock footer -%} 17 | 18 | {% block markdowncell scoped %} 19 | {{ cell.source | markdown2rst | replace(".ipynb>", ".html>") }} 20 | {% endblock markdowncell %} 21 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jupyter-notebook-deps", 3 | "version": "4.0.0", 4 | "description": "Jupyter Notebook nodejs dependencies", 5 | "author": "Jupyter Developers", 6 | "license": "BSD-3-Clause", 7 | "repository": { 8 | "type": "git", 9 | "url": "https://github.com/jupyter/notebook.git" 10 | }, 11 | "scripts": { 12 | "bower": "bower install", 13 | "build": "python setup.py js css", 14 | "build:watch": "set -e; while true; do npm run build; sleep 3; done" 15 | }, 16 | "devDependencies": { 17 | "bower": "*", 18 | "less": "~2", 19 | "requirejs": "^2.1.17" 20 | }, 21 | "dependencies": {} 22 | } 23 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/completer.less: -------------------------------------------------------------------------------- 1 | .completions { 2 | position: absolute; 3 | z-index: 110; 4 | overflow: hidden; 5 | border: 1px solid @border_color; 6 | .corner-all; 7 | .box-shadow(0px 6px 10px -1px #adadad); 8 | line-height: 1; 9 | } 10 | 11 | .completions select { 12 | background: white; 13 | outline: none; 14 | border: none; 15 | padding: 0px; 16 | margin: 0px; 17 | overflow: auto; 18 | font-family: @font-family-monospace; 19 | font-size: 110%; 20 | color: @text-color; 21 | width: auto; 22 | } 23 | 24 | .completions select option.context { 25 | color: darken(@brand-primary, 10%); 26 | } 27 | -------------------------------------------------------------------------------- /docs/source/examples/Notebook/examples_index.rst: -------------------------------------------------------------------------------- 1 | ================= 2 | Notebook Examples 3 | ================= 4 | 5 | The pages in this section are all converted notebook files. You can also 6 | `view these notebooks on nbviewer`__. 7 | 8 | __ http://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/ 9 | docs/source/examples/Notebook/ 10 | 11 | .. toctree:: 12 | :maxdepth: 2 13 | 14 | What is the Jupyter Notebook 15 | Notebook Basics 16 | Running Code 17 | Working With Markdown Cells 18 | Custom Keyboard Shortcuts 19 | JavaScript Notebook Extensions 20 | Importing Notebooks 21 | Connecting with the Qt Console 22 | Typesetting Equations 23 | -------------------------------------------------------------------------------- /notebook/templates/view.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | {{page_title}} 7 | 8 | 9 | 10 | 11 | 25 |
26 | 27 |
28 | 29 | 30 | 31 | -------------------------------------------------------------------------------- /setup.cfg: -------------------------------------------------------------------------------- 1 | [bdist_wheel] 2 | universal=1 3 | 4 | [metadata] 5 | license_file = COPYING.md 6 | 7 | [nosetests] 8 | warningfilters=module |.* |DeprecationWarning |notebook.* 9 | default |.* | Warning | notebook.* 10 | ignore |.*metadata.* |DeprecationWarning |notebook.* 11 | ignore |.*schema.* |UserWarning |nbfor.* 12 | ignore |The 'warn' method is deprecated, use 'warning' instead | DeprecationWarning |notebook.* 13 | error |encodestring\(\) is a deprecated alias, use encodebytes\(\)| DeprecationWarning | notebook.* 14 | error |decodestring\(\) is a .*| DeprecationWarning | notebook.* 15 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | MANIFEST 2 | build 3 | dist 4 | _build 5 | docs/man/*.gz 6 | docs/source/api/generated 7 | docs/source/config.rst 8 | docs/gh-pages 9 | notebook/i18n/*/LC_MESSAGES/*.mo 10 | notebook/i18n/*/LC_MESSAGES/nbjs.json 11 | notebook/static/components 12 | notebook/static/style/*.min.css* 13 | notebook/static/*/js/built/ 14 | notebook/static/*/built/ 15 | notebook/static/built/ 16 | notebook/static/*/js/main.min.js* 17 | notebook/static/lab/*bundle.js 18 | node_modules 19 | *.py[co] 20 | __pycache__ 21 | *.egg-info 22 | *~ 23 | *.bak 24 | .ipynb_checkpoints 25 | .tox 26 | .DS_Store 27 | \#*# 28 | .#* 29 | .coverage 30 | src 31 | 32 | *.swp 33 | *.map 34 | .idea/ 35 | Read the Docs 36 | config.rst 37 | 38 | /.project 39 | /.pydevproject 40 | 41 | -------------------------------------------------------------------------------- /notebook/services/nbconvert/handlers.py: -------------------------------------------------------------------------------- 1 | import json 2 | 3 | from tornado import web 4 | 5 | from ...base.handlers import APIHandler 6 | 7 | class NbconvertRootHandler(APIHandler): 8 | 9 | @web.authenticated 10 | def get(self): 11 | try: 12 | from nbconvert.exporters.export import exporter_map 13 | except ImportError as e: 14 | raise web.HTTPError(500, "Could not import nbconvert: %s" % e) 15 | res = {} 16 | for format, exporter in exporter_map.items(): 17 | res[format] = info = {} 18 | info['output_mimetype'] = exporter.output_mimetype 19 | 20 | self.finish(json.dumps(res)) 21 | 22 | default_handlers = [ 23 | (r"/api/nbconvert", NbconvertRootHandler), 24 | ] 25 | -------------------------------------------------------------------------------- /notebook/auth/logout.py: -------------------------------------------------------------------------------- 1 | """Tornado handlers for logging out of the notebook. 2 | """ 3 | 4 | # Copyright (c) Jupyter Development Team. 5 | # Distributed under the terms of the Modified BSD License. 6 | 7 | from ..base.handlers import IPythonHandler 8 | 9 | 10 | class LogoutHandler(IPythonHandler): 11 | 12 | def get(self): 13 | self.clear_login_cookie() 14 | if self.login_available: 15 | message = {'info': 'Successfully logged out.'} 16 | else: 17 | message = {'warning': 'Cannot log out. Notebook authentication ' 18 | 'is disabled.'} 19 | self.write(self.render_template('logout.html', 20 | message=message)) 21 | 22 | 23 | default_handlers = [(r"/logout", LogoutHandler)] -------------------------------------------------------------------------------- /notebook/tests/notebook/inject_js.js: -------------------------------------------------------------------------------- 1 | // 2 | // Test robustness about JS injection in different place 3 | // 4 | // This assume malicious document arrive to the frontend. 5 | // 6 | 7 | casper.notebook_test(function () { 8 | var messages = []; 9 | this.on('remote.alert', function (msg) { 10 | messages.push(msg); 11 | }); 12 | 13 | this.evaluate(function () { 14 | var cell = IPython.notebook.get_cell(0); 15 | var json = cell.toJSON(); 16 | json.execution_count = ""; 17 | cell.fromJSON(json); 18 | }); 19 | 20 | this.then(function () { 21 | this.test.assert(messages.length == 0, "Captured log message from script tag injection !"); 22 | }); 23 | }); 24 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | # miniconda bootstrap from conda-forge recipe 2 | matrix: 3 | fast_finish: true 4 | 5 | environment: 6 | matrix: 7 | - CONDA_PY: 36 8 | CONDA_INSTALL_LOCN: "C:\\Miniconda36-x64" 9 | - CONDA_PY: 27 10 | CONDA_INSTALL_LOCN: "C:\\Miniconda-x64" 11 | 12 | platform: 13 | - x64 14 | 15 | build: off 16 | 17 | install: 18 | - cmd: call %CONDA_INSTALL_LOCN%\Scripts\activate.bat 19 | - cmd: conda config --set show_channel_urls true 20 | - cmd: conda config --add channels conda-forge 21 | #- cmd: conda update --yes --quiet conda 22 | - cmd: conda install -y pyzmq tornado jupyter_client nbformat nbconvert ipykernel pip nodejs nose 23 | - cmd: pip install .[test] 24 | 25 | test_script: 26 | - nosetests -v notebook --exclude-dir notebook\tests\selenium 27 | -------------------------------------------------------------------------------- /docs/resources/Info.plist.example: -------------------------------------------------------------------------------- 1 | # Add this into the info.plist file of an application 2 | # and the icns icon in Contents/Resources 3 | # then move the application twice : 4 | # https://superuser.com/questions/178316/how-to-set-an-icon-for-a-file-type-on-mac 5 | 6 | CFBundleDocumentTypes 7 | 8 | 9 | CFBundleTypeExtensions 10 | 11 | ipynb 12 | 13 | CFBundleTypeIconFile 14 | ipynb_mac_icon 15 | CFBundleTypeName 16 | IPython notebook file 17 | CFBundleTypeRole 18 | None 19 | 20 | 21 | -------------------------------------------------------------------------------- /notebook/static/style/style.less: -------------------------------------------------------------------------------- 1 | /*! 2 | * 3 | * Twitter Bootstrap 4 | * 5 | */ 6 | @import "../components/bootstrap/less/bootstrap.less"; 7 | 8 | /*! 9 | * 10 | * Font Awesome 11 | * 12 | */ 13 | @import "../components/font-awesome/less/font-awesome.less"; 14 | @fa-font-path: "../components/font-awesome/fonts"; 15 | 16 | // base 17 | @import "../base/less/style.less"; 18 | @import "../base/less/page.less"; 19 | 20 | // auth 21 | @import "../auth/less/style.less"; 22 | 23 | // tree 24 | @import "../tree/less/style.less"; 25 | 26 | // edit 27 | @import "../edit/less/style.less"; 28 | 29 | // notebook 30 | @import "../notebook/less/style.less"; 31 | @import "../notebook/less/commandpalette.less"; 32 | @import "../notebook/less/searchandreplace.less"; 33 | 34 | // terminal 35 | @import "../terminal/less/terminal.less"; 36 | -------------------------------------------------------------------------------- /notebook/static/notebook/js/promises.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | // Define promises for notebook events. 5 | 6 | define(['base/js/events', 'base/js/promises'], function(events, promises) { 7 | "use strict"; 8 | 9 | // Promise to be resolved when the notebook is *initially* loaded. 10 | // The event may fire again if the notebook is reloaded later, but this 11 | // promise only tracks the initial load. 12 | promises.notebook_loaded = new Promise(function(resolve, reject) { 13 | events.one('notebook_loaded.Notebook', function() { 14 | resolve(); 15 | }); 16 | events.one('notebook_load_failed.Notebook', function() { 17 | reject(); 18 | }); 19 | }); 20 | 21 | return promises; 22 | }); 23 | -------------------------------------------------------------------------------- /notebook/static/terminal/less/terminal.less: -------------------------------------------------------------------------------- 1 | .terminal-app { 2 | background: @page-backdrop-color; 3 | 4 | #header { 5 | background: @body-bg; 6 | .box-shadow(@global-shadow); 7 | } 8 | 9 | .terminal { 10 | width: 100%; 11 | float: left; 12 | font-family: monospace; 13 | color: white; 14 | background: black; 15 | padding: @code_padding; 16 | border-radius: @border-radius-base; 17 | .box-shadow(@global-shadow-dark); 18 | line-height: 1em; 19 | font-size: @notebook_font_size; 20 | 21 | .xterm-rows { 22 | padding: 10px; 23 | } 24 | } 25 | 26 | .terminal-cursor { 27 | color: black; 28 | background: white; 29 | } 30 | 31 | .terminado-container-container { 32 | padding-top: @page-header-padding; 33 | height: 100%; 34 | } 35 | 36 | #terminado-container { 37 | height: 100%; 38 | } 39 | } 40 | -------------------------------------------------------------------------------- /notebook/static/tree/less/altuploadform.less: -------------------------------------------------------------------------------- 1 | /* We need an invisible input field on top of the sentense*/ 2 | /* "Drag file onto the list ..." */ 3 | 4 | .alternate_upload { 5 | background-color:none; 6 | display: inline; 7 | 8 | &.form 9 | { 10 | padding: 0; 11 | margin:0; 12 | } 13 | 14 | input.fileinput 15 | { 16 | position: absolute; 17 | 18 | display: block; 19 | width: 100%; 20 | height: 100%; 21 | overflow: hidden; 22 | cursor: pointer; 23 | opacity: 0; 24 | z-index: 2; 25 | } 26 | 27 | .btn-xs > input.fileinput { 28 | margin: -@padding-xs-vertical -@padding-xs-horizontal; 29 | } 30 | 31 | .btn-upload { 32 | position: relative; 33 | height: @btn_mini_height; 34 | } 35 | } 36 | 37 | ::-webkit-file-upload-button { cursor:pointer; } 38 | -------------------------------------------------------------------------------- /notebook/tests/README.md: -------------------------------------------------------------------------------- 1 | # IPython Notebook JavaScript Tests 2 | 3 | This directory includes regression tests for the web notebook. These tests 4 | depend on [CasperJS](http://casperjs.org/), which in turn requires a recent 5 | version of [PhantomJS](http://phantomjs.org/). 6 | 7 | The JavaScript tests are organized into subdirectories that match those in 8 | `static` (`base`, `notebook`, `services`, `tree`, etc.). 9 | 10 | To run all of the JavaScript tests do: 11 | 12 | ``` 13 | python -m notebook.jstest 14 | ``` 15 | 16 | To run the JavaScript tests for a specific file (`base/utils.js` in this case) 17 | do: 18 | 19 | ``` 20 | python -m notebook.jstest base/utils.js 21 | ``` 22 | 23 | The file `jstest.py` will automatically launch a notebook server to run the 24 | tests against. You can however specify the url of a running notebook server 25 | by using `--url=http://localhost:8888`. 26 | -------------------------------------------------------------------------------- /notebook/tests/test_serialize.py: -------------------------------------------------------------------------------- 1 | """Test serialize/deserialize messages with buffers""" 2 | 3 | import os 4 | 5 | import nose.tools as nt 6 | 7 | from jupyter_client.session import Session 8 | from ..base.zmqhandlers import ( 9 | serialize_binary_message, 10 | deserialize_binary_message, 11 | ) 12 | 13 | def test_serialize_binary(): 14 | s = Session() 15 | msg = s.msg('data_pub', content={'a': 'b'}) 16 | msg['buffers'] = [ memoryview(os.urandom(3)) for i in range(3) ] 17 | bmsg = serialize_binary_message(msg) 18 | nt.assert_is_instance(bmsg, bytes) 19 | 20 | def test_deserialize_binary(): 21 | s = Session() 22 | msg = s.msg('data_pub', content={'a': 'b'}) 23 | msg['buffers'] = [ memoryview(os.urandom(2)) for i in range(3) ] 24 | bmsg = serialize_binary_message(msg) 25 | msg2 = deserialize_binary_message(bmsg) 26 | nt.assert_equal(msg2, msg) 27 | -------------------------------------------------------------------------------- /notebook/auth/tests/test_security.py: -------------------------------------------------------------------------------- 1 | # coding: utf-8 2 | from ..security import passwd, passwd_check, salt_len 3 | import nose.tools as nt 4 | 5 | def test_passwd_structure(): 6 | p = passwd('passphrase') 7 | algorithm, salt, hashed = p.split(':') 8 | nt.assert_equal(algorithm, 'sha1') 9 | nt.assert_equal(len(salt), salt_len) 10 | nt.assert_equal(len(hashed), 40) 11 | 12 | def test_roundtrip(): 13 | p = passwd('passphrase') 14 | nt.assert_equal(passwd_check(p, 'passphrase'), True) 15 | 16 | def test_bad(): 17 | p = passwd('passphrase') 18 | nt.assert_equal(passwd_check(p, p), False) 19 | nt.assert_equal(passwd_check(p, 'a:b:c:d'), False) 20 | nt.assert_equal(passwd_check(p, 'a:b'), False) 21 | 22 | def test_passwd_check_unicode(): 23 | # GH issue #4524 24 | phash = u'sha1:23862bc21dd3:7a415a95ae4580582e314072143d9c382c491e4f' 25 | assert passwd_check(phash, u"łe¶ŧ←↓→") -------------------------------------------------------------------------------- /notebook/static/base/js/promises.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | // Define an object to attach promises to for one-time events. 5 | 6 | define(['base/js/events', 'base/js/namespace'], function(events, Jupyter) { 7 | "use strict"; 8 | 9 | // Promise to be resolved when the application is initialized. 10 | // The value is the name of the app on the current page. 11 | var app_initialized = new Promise(function(resolve, reject) { 12 | events.on('app_initialized.NotebookApp', function() { 13 | resolve('NotebookApp'); 14 | }); 15 | events.on('app_initialized.DashboardApp', function() { 16 | resolve('DashboardApp'); 17 | }); 18 | }); 19 | 20 | var promises = { 21 | app_initialized: app_initialized 22 | }; 23 | Jupyter.promises = promises; 24 | 25 | return promises; 26 | }); 27 | -------------------------------------------------------------------------------- /docs/source/spelling_wordlist.txt: -------------------------------------------------------------------------------- 1 | AMS 2 | API 3 | api 4 | args 5 | async 6 | auth 7 | autodetect 8 | Broullón 9 | changelog 10 | config 11 | coroutines 12 | css 13 | CSS 14 | dockerfile 15 | Dockerfile 16 | drop-down 17 | filenames 18 | filesystem 19 | front-end 20 | front end 21 | frontend 22 | github 23 | GitHub 24 | IFrame 25 | iframe 26 | ip 27 | IP 28 | IPython 29 | javascript 30 | JavaScript 31 | jinja 32 | jinja2 33 | Jinja 34 | js 35 | jupyter 36 | Jupyter 37 | Kamens 38 | keepalive 39 | LaTeX 40 | localhost 41 | login 42 | logout 43 | mathjax 44 | MathJax 45 | matplotlib 46 | menubar 47 | metadata 48 | minify 49 | minified 50 | multiline 51 | natively 52 | nbviewer 53 | pre 54 | prerelease 55 | Quantopian 56 | repo 57 | reStructuredText 58 | subclasses 59 | subdirectory 60 | subprocesses 61 | startup 62 | symlink 63 | uncomment 64 | unencrypted 65 | unicode 66 | Unicode 67 | untracked 68 | untrusted 69 | URL 70 | url 71 | username 72 | webserver 73 | websockets 74 | workflow 75 | -------------------------------------------------------------------------------- /docs/resources/generate_icons.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | INKSCAPE=inkscape 3 | 4 | ${INKSCAPE} -z -C --file=ipynb_icon_16x16.svg --export-png=ipynb_icon_16x16_uncrush.png 5 | ${INKSCAPE} -z -C --file=ipynb_icon_24x24.svg --export-png=ipynb_icon_24x24_uncrush.png 6 | ${INKSCAPE} -z -C --file=ipynb_icon_32x32.svg --export-png=ipynb_icon_32x32_uncrush.png 7 | ${INKSCAPE} -z -C --file=ipynb_icon_512x512.svg --export-png=ipynb_icon_64x64_uncrush.png -w 64 -h 64 8 | ${INKSCAPE} -z -C --file=ipynb_icon_512x512.svg --export-png=ipynb_icon_128x128_uncrush.png -w 128 -h 128 9 | ${INKSCAPE} -z -C --file=ipynb_icon_512x512.svg --export-png=ipynb_icon_256x256_uncrush.png -w 256 -h 256 10 | ${INKSCAPE} -z -C --file=ipynb_icon_512x512.svg --export-png=ipynb_icon_512x512_uncrush.png -w 512 -h 512 11 | 12 | 13 | for file in `ls *_uncrush.png`; do 14 | pngcrush -brute -l 9 -reduce -rem alla -rem text -rem time -rem gAMA -rem cHRM -rem iCCP -rem sRGB $file `basename $file _uncrush.png`.png 15 | rm $file 16 | done 17 | -------------------------------------------------------------------------------- /notebook/edit/handlers.py: -------------------------------------------------------------------------------- 1 | #encoding: utf-8 2 | """Tornado handlers for the terminal emulator.""" 3 | 4 | # Copyright (c) Jupyter Development Team. 5 | # Distributed under the terms of the Modified BSD License. 6 | 7 | from tornado import web 8 | from ..base.handlers import IPythonHandler, path_regex 9 | from ..utils import url_escape 10 | 11 | class EditorHandler(IPythonHandler): 12 | """Render the text editor interface.""" 13 | @web.authenticated 14 | def get(self, path): 15 | path = path.strip('/') 16 | if not self.contents_manager.file_exists(path): 17 | raise web.HTTPError(404, u'File does not exist: %s' % path) 18 | 19 | basename = path.rsplit('/', 1)[-1] 20 | self.write(self.render_template('edit.html', 21 | file_path=url_escape(path), 22 | basename=basename, 23 | page_title=basename + " (editing)", 24 | ) 25 | ) 26 | 27 | default_handlers = [ 28 | (r"/edit%s" % path_regex, EditorHandler), 29 | ] -------------------------------------------------------------------------------- /notebook/view/handlers.py: -------------------------------------------------------------------------------- 1 | #encoding: utf-8 2 | """Tornado handlers for viewing HTML files.""" 3 | 4 | # Copyright (c) Jupyter Development Team. 5 | # Distributed under the terms of the Modified BSD License. 6 | 7 | from tornado import web 8 | from ..base.handlers import IPythonHandler, path_regex 9 | from ..utils import url_escape, url_path_join 10 | 11 | class ViewHandler(IPythonHandler): 12 | """Render HTML files within an iframe.""" 13 | @web.authenticated 14 | def get(self, path): 15 | path = path.strip('/') 16 | if not self.contents_manager.file_exists(path): 17 | raise web.HTTPError(404, u'File does not exist: %s' % path) 18 | 19 | basename = path.rsplit('/', 1)[-1] 20 | file_url = url_path_join(self.base_url, 'files', url_escape(path)) 21 | self.write( 22 | self.render_template('view.html', file_url=file_url, page_title=basename) 23 | ) 24 | 25 | default_handlers = [ 26 | (r"/view%s" % path_regex, ViewHandler), 27 | ] 28 | -------------------------------------------------------------------------------- /notebook/__init__.py: -------------------------------------------------------------------------------- 1 | """The Jupyter HTML Notebook""" 2 | 3 | import os 4 | # Packagers: modify this line if you store the notebook static files elsewhere 5 | DEFAULT_STATIC_FILES_PATH = os.path.join(os.path.dirname(__file__), "static") 6 | 7 | # Packagers: modify the next line if you store the notebook template files 8 | # elsewhere 9 | 10 | # Include both notebook/ and notebook/templates/. This makes it 11 | # possible for users to override a template with a file that inherits from that 12 | # template. 13 | # 14 | # For example, if you want to override a specific block of notebook.html, you 15 | # can create a file called notebook.html that inherits from 16 | # templates/notebook.html, and the latter will resolve correctly to the base 17 | # implementation. 18 | DEFAULT_TEMPLATE_PATH_LIST = [ 19 | os.path.dirname(__file__), 20 | os.path.join(os.path.dirname(__file__), "templates"), 21 | ] 22 | 23 | del os 24 | 25 | from .nbextensions import install_nbextension 26 | from ._version import version_info, __version__ 27 | -------------------------------------------------------------------------------- /notebook/static/edit/js/notificationarea.js: -------------------------------------------------------------------------------- 1 | define([ 2 | 'base/js/notificationarea' 3 | ], function(notificationarea) { 4 | "use strict"; 5 | var NotificationArea = notificationarea.NotificationArea; 6 | 7 | var EditorNotificationArea = function(selector, options) { 8 | NotificationArea.apply(this, [selector, options]); 9 | } 10 | 11 | EditorNotificationArea.prototype = Object.create(NotificationArea.prototype); 12 | 13 | /** 14 | * Initialize the default set of notification widgets. 15 | * 16 | * @method init_notification_widgets 17 | */ 18 | EditorNotificationArea.prototype.init_notification_widgets = function () { 19 | var that = this; 20 | var savew = this.new_notification_widget('save'); 21 | 22 | this.events.on("file_saved.Editor", function() { 23 | savew.set_message("File saved", 2000); 24 | }); 25 | }; 26 | 27 | 28 | return {EditorNotificationArea: EditorNotificationArea}; 29 | }); 30 | -------------------------------------------------------------------------------- /docs/source/examples/Notebook/nbpackage/nbs/other.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "### Other notebook\n", 8 | "\n", 9 | "This notebook just defines `bar`" 10 | ] 11 | }, 12 | { 13 | "cell_type": "code", 14 | "execution_count": 2, 15 | "metadata": { 16 | "collapsed": false 17 | }, 18 | "outputs": [], 19 | "source": [ 20 | "def bar(x):\n", 21 | " return \"bar\" * x" 22 | ] 23 | } 24 | ], 25 | "metadata": { 26 | "kernelspec": { 27 | "display_name": "Python 3", 28 | "language": "python", 29 | "name": "python3" 30 | }, 31 | "language_info": { 32 | "codemirror_mode": { 33 | "name": "ipython", 34 | "version": 3 35 | }, 36 | "file_extension": ".py", 37 | "mimetype": "text/x-python", 38 | "name": "python", 39 | "nbconvert_exporter": "python", 40 | "pygments_lexer": "ipython3", 41 | "version": "3.5.1" 42 | } 43 | }, 44 | "nbformat": 4, 45 | "nbformat_minor": 0 46 | } 47 | -------------------------------------------------------------------------------- /notebook/tests/test_paths.py: -------------------------------------------------------------------------------- 1 | 2 | import re 3 | import nose.tools as nt 4 | 5 | from notebook.base.handlers import path_regex 6 | 7 | try: # py3 8 | assert_regex = nt.assert_regex 9 | assert_not_regex = nt.assert_not_regex 10 | except AttributeError: # py2 11 | assert_regex = nt.assert_regexp_matches 12 | assert_not_regex = nt.assert_not_regexp_matches 13 | 14 | 15 | # build regexps that tornado uses: 16 | path_pat = re.compile('^' + '/x%s' % path_regex + '$') 17 | 18 | def test_path_regex(): 19 | for path in ( 20 | '/x', 21 | '/x/', 22 | '/x/foo', 23 | '/x/foo.ipynb', 24 | '/x/foo/bar', 25 | '/x/foo/bar.txt', 26 | ): 27 | assert_regex(path, path_pat) 28 | 29 | def test_path_regex_bad(): 30 | for path in ( 31 | '/xfoo', 32 | '/xfoo/', 33 | '/xfoo/bar', 34 | '/xfoo/bar/', 35 | '/x/foo/bar/', 36 | '/x//foo', 37 | '/y', 38 | '/y/x/foo', 39 | ): 40 | assert_not_regex(path, path_pat) 41 | -------------------------------------------------------------------------------- /notebook/services/security/handlers.py: -------------------------------------------------------------------------------- 1 | """Tornado handlers for security logging.""" 2 | 3 | # Copyright (c) Jupyter Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | 6 | from tornado import web 7 | 8 | from ...base.handlers import APIHandler 9 | from . import csp_report_uri 10 | 11 | class CSPReportHandler(APIHandler): 12 | '''Accepts a content security policy violation report''' 13 | 14 | _track_activity = False 15 | 16 | def skip_check_origin(self): 17 | """Don't check origin when reporting origin-check violations!""" 18 | return True 19 | 20 | def check_xsrf_cookie(self): 21 | # don't check XSRF for CSP reports 22 | return 23 | 24 | @web.authenticated 25 | def post(self): 26 | '''Log a content security policy violation report''' 27 | self.log.warning("Content security violation: %s", 28 | self.request.body.decode('utf8', 'replace')) 29 | 30 | default_handlers = [ 31 | (csp_report_uri, CSPReportHandler) 32 | ] 33 | -------------------------------------------------------------------------------- /notebook/templates/error.html: -------------------------------------------------------------------------------- 1 | {% extends "page.html" %} 2 | 3 | {% block login_widget %} 4 | {% endblock %} 5 | 6 | {% block stylesheet %} 7 | {{super()}} 8 | 14 | {% endblock %} 15 | {% block site %} 16 | 17 |
18 | {% block h1_error %} 19 |

{{status_code}} : {{status_message}}

20 | {% endblock h1_error %} 21 | {% block error_detail %} 22 | {% if message %} 23 |

{% trans %}The error was:{% endtrans %}

24 |
25 |
{{message}}
26 |
27 | {% endif %} 28 | {% endblock %} 29 |
30 | 31 | {% endblock %} 32 | 33 | {% block script %} 34 | {{super()}} 35 | 42 | {% endblock script %} 43 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/Installation.md: -------------------------------------------------------------------------------- 1 | # Jupyter Notebook 설치하기 2 | 3 | ## 필요한 것 : Python 4 | 5 | Jupyter Notebook 을 설치하기 위해선 Jupyter가 많은 프로그래밍 언어들로 동작되기 때문에, Python이 필요합니다. (Python 3.3이상, Python 2.7) 6 | 7 | Python과 Jupyter를 설치할 때 Anaconda를 이용하는 것을 추천합니다. 밑에서 이를 이용하여 설치할 것입니다. 8 | 9 | ## Anaconda 와 conda 를 이용하여 Jupyter 설치하기 10 | 11 | 새로운 이용자들은 Anaconda를 설치하는 것을 강력하게 추천합니다. Anaconda는 Python과 Jupyter를 쉽게 설치하게 해주고, 과학적인 계산과 데이터를 위한 자주 사용되는 패키지들의 설치에도 유용합니다. 12 | 13 | 설치 순서 : 14 | 15 | 1. Anaconda를 다운받으세요. Anaconda의 가장 최신의 Python 3버전을 다운 받는 것을 추천합니다. 16 | 2. 다운 받은 Anaconda 의 다운로드 페이지에 있는 설명을 읽고 설치해주세요. 17 | 3. 축하합니다. Jupyter Notebook 을 설치하셨습니다. Jupyter Notebook을 실행하려면 : 18 | 19 | $ jupyter notebook 20 | 21 | ## 숙련된 Python 이용자 : pip을 통해 설치하기 22 | 23 | Python 이용자라면, Anaconda 대신에 Python의 패키지 매니저 pip을 이용하여 설치하세요. 24 | 25 | 첫째로, 가장 최신의 pip인지를 확인하세요; 구 버전은 독립성에 문제가 있을 수 있습니다. 26 | 27 | $ pip install --upgrade pip 28 | 29 | 이제 다음을 이용하여 Jupyter Notebook를 설치하세요 : 30 | 31 | $ pip install jupyter 32 | 33 | (축하합니다. Jupyter Notebook를 설치하셨습니다.) 34 | -------------------------------------------------------------------------------- /docs/source/index.rst: -------------------------------------------------------------------------------- 1 | ==================== 2 | The Jupyter Notebook 3 | ==================== 4 | 5 | * `Installation `_ 6 | * `Starting the Notebook `_ 7 | 8 | .. toctree:: 9 | :maxdepth: 1 10 | :caption: User Documentation 11 | 12 | notebook 13 | ui_components 14 | examples/Notebook/examples_index.rst 15 | troubleshooting 16 | changelog 17 | comms 18 | 19 | .. toctree:: 20 | :maxdepth: 1 21 | :caption: Configuration 22 | 23 | config_overview 24 | config 25 | public_server 26 | security 27 | frontend_config 28 | examples/Notebook/Distributing Jupyter Extensions as Python Packages 29 | extending/index.rst 30 | 31 | .. toctree:: 32 | :maxdepth: 1 33 | :caption: Contributor Documentation 34 | 35 | contributing 36 | development_release 37 | development_faq 38 | 39 | .. toctree:: 40 | :hidden: 41 | 42 | examples/Notebook/nbpackage/mynotebook.ipynb 43 | examples/Notebook/nbpackage/nbs/other.ipynb 44 | -------------------------------------------------------------------------------- /notebook/services/api/tests/test_api.py: -------------------------------------------------------------------------------- 1 | """Test the basic /api endpoints""" 2 | 3 | import requests 4 | 5 | from notebook._tz import isoformat 6 | from notebook.utils import url_path_join 7 | from notebook.tests.launchnotebook import NotebookTestBase 8 | 9 | 10 | class KernelAPITest(NotebookTestBase): 11 | """Test the kernels web service API""" 12 | 13 | def _req(self, verb, path, **kwargs): 14 | r = self.request(verb, url_path_join('api', path)) 15 | r.raise_for_status() 16 | return r 17 | 18 | def get(self, path, **kwargs): 19 | return self._req('GET', path) 20 | 21 | def test_get_spec(self): 22 | r = self.get('spec.yaml') 23 | assert r.text 24 | 25 | def test_get_status(self): 26 | r = self.get('status') 27 | data = r.json() 28 | assert data['connections'] == 0 29 | assert data['kernels'] == 0 30 | assert data['last_activity'].endswith('Z') 31 | assert data['started'].endswith('Z') 32 | assert data['started'] == isoformat(self.notebook.web_app.settings['started']) 33 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/UIComponents.md: -------------------------------------------------------------------------------- 1 | # UI 기능 2 | 3 | 버그 리포트나 Jupyter Mailing list에 메일을 보내려고 할 때, 개발자나 사용자들이 버그를 진단하거나 해결해줄 경우 다른 UI를 사용하면 시간이 단축된다. 4 | 이번 장에서는 Notebook과 Notebook의 다른 모드의 UI 요소를 알려줄 것이다. 5 | 6 | ## Notebook Dashboard 7 | 8 | jupyter notebook 명령어를 실행하면 가장 먼저 Notebook Dashboard가 나타난다. 9 | 10 | ![Notebook Dashboard example](resources/dashboard.GIF "Notebook Dashboard") 11 | 12 | 13 | 14 | ## Notebook 편집기 15 | 16 | 편집을 위해 Notebook을 선택했다면, Notebook은 Notebook편집기를 열어준다. 17 | 18 | ![Notebook Editor example](resources/Notebook_Editor.GIF "Notebook Editor") 19 | ## Notebook 의 사용자 도움 인터페이스 20 | 21 | 만약 Notebook 편집기의 특정 요소를 더 배우고 싶다면, 도움 메뉴 - 사용자 인터페이스 를 선택함으로써 사용사 인터페이스 도움말을 볼 수 있습니다. 22 | 23 | ## 편집 모드와 Notebook편집기 24 | 25 | 셀이 편집모드에 있다면, 셀 모드 지시자는 셀의 상태를 반영합니다. 이 상태는 오른쪽 위의 작은 연필모양으로 선택가능합니다. 셀이 명령 모드에 있다면, 그 위치에 아이콘이 없습니다. 26 | 27 | ![Edit Mode example](resources/edit_mode.GIF "Edit Mode") 28 | 29 | ## 파일 편집기 30 | 31 | 이제 Notebook Dashboard 안의 Notebook 파일이 아닌 표시된 파일을 선택하여 열어야한다고 한다면, 파일은 파일 편집기로 열립니다. 32 | 33 | ![File Editor example](resources/file_editor.GIF "File Editor") 34 | 35 | 36 | 37 | 38 | 39 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/searchandreplace.less: -------------------------------------------------------------------------------- 1 | 2 | #find-and-replace { 3 | 4 | #replace-preview .match, #replace-preview .insert { 5 | background-color: #BBDEFB; // MD Blue 100 6 | border-color: #90CAF9; // MD Blue 200 7 | border-style: solid; 8 | border-width: 1px; 9 | border-radius: 0px; 10 | } 11 | 12 | 13 | [dir="ltr"] & .input-group-btn + .form-control { 14 | border-left: none; 15 | } 16 | 17 | [dir="rtl"] & .input-group-btn + .form-control { 18 | border-right: none; 19 | } 20 | 21 | #replace-preview .replace { 22 | 23 | & .match { 24 | // text-decoration: line-through; 25 | background-color: #FFCDD2; // MD Red 100 26 | border-color: #EF9A9A; // MD Red 200 27 | border-radius: 0px; 28 | 29 | } 30 | 31 | & .insert { 32 | background-color: #C8E6C9; // MD Green 100 33 | border-color: #A5D6A7; // MD Green 200 34 | border-radius: 0px; 35 | 36 | } 37 | } 38 | 39 | #replace-preview { 40 | max-height: 60vh; 41 | overflow: auto; 42 | pre { 43 | padding: 5px 10px; 44 | } 45 | } 46 | } 47 | -------------------------------------------------------------------------------- /notebook/_tz.py: -------------------------------------------------------------------------------- 1 | # encoding: utf-8 2 | """ 3 | Timezone utilities 4 | 5 | Just UTC-awareness right now 6 | """ 7 | 8 | # Copyright (c) Jupyter Development Team. 9 | # Distributed under the terms of the Modified BSD License. 10 | 11 | from datetime import tzinfo, timedelta, datetime 12 | 13 | # constant for zero offset 14 | ZERO = timedelta(0) 15 | 16 | class tzUTC(tzinfo): 17 | """tzinfo object for UTC (zero offset)""" 18 | 19 | def utcoffset(self, d): 20 | return ZERO 21 | 22 | def dst(self, d): 23 | return ZERO 24 | 25 | UTC = tzUTC() 26 | 27 | def utc_aware(unaware): 28 | """decorator for adding UTC tzinfo to datetime's utcfoo methods""" 29 | def utc_method(*args, **kwargs): 30 | dt = unaware(*args, **kwargs) 31 | return dt.replace(tzinfo=UTC) 32 | return utc_method 33 | 34 | utcfromtimestamp = utc_aware(datetime.utcfromtimestamp) 35 | utcnow = utc_aware(datetime.utcnow) 36 | 37 | def isoformat(dt): 38 | """Return iso-formatted timestamp 39 | 40 | Like .isoformat(), but uses Z for UTC instead of +00:00 41 | """ 42 | return dt.isoformat().replace('+00:00', 'Z') 43 | -------------------------------------------------------------------------------- /notebook/kernelspecs/handlers.py: -------------------------------------------------------------------------------- 1 | from tornado import web 2 | from ..base.handlers import IPythonHandler 3 | from ..services.kernelspecs.handlers import kernel_name_regex 4 | 5 | class KernelSpecResourceHandler(web.StaticFileHandler, IPythonHandler): 6 | SUPPORTED_METHODS = ('GET', 'HEAD') 7 | 8 | def initialize(self): 9 | web.StaticFileHandler.initialize(self, path='') 10 | 11 | @web.authenticated 12 | def get(self, kernel_name, path, include_body=True): 13 | ksm = self.kernel_spec_manager 14 | try: 15 | self.root = ksm.get_kernel_spec(kernel_name).resource_dir 16 | except KeyError: 17 | raise web.HTTPError(404, u'Kernel spec %s not found' % kernel_name) 18 | self.log.debug("Serving kernel resource from: %s", self.root) 19 | return web.StaticFileHandler.get(self, path, include_body=include_body) 20 | 21 | @web.authenticated 22 | def head(self, kernel_name, path): 23 | return self.get(kernel_name, path, include_body=False) 24 | 25 | default_handlers = [ 26 | (r"/kernelspecs/%s/(?P.*)" % kernel_name_regex, KernelSpecResourceHandler), 27 | ] -------------------------------------------------------------------------------- /notebook/services/nbconvert/tests/test_nbconvert_api.py: -------------------------------------------------------------------------------- 1 | import requests 2 | 3 | from notebook.utils import url_path_join 4 | from notebook.tests.launchnotebook import NotebookTestBase 5 | 6 | class NbconvertAPI(object): 7 | """Wrapper for nbconvert API calls.""" 8 | def __init__(self, request): 9 | self.request = request 10 | 11 | def _req(self, verb, path, body=None, params=None): 12 | response = self.request(verb, 13 | url_path_join('api/nbconvert', path), 14 | data=body, params=params, 15 | ) 16 | response.raise_for_status() 17 | return response 18 | 19 | def list_formats(self): 20 | return self._req('GET', '') 21 | 22 | class APITest(NotebookTestBase): 23 | def setUp(self): 24 | self.nbconvert_api = NbconvertAPI(self.request) 25 | 26 | def test_list_formats(self): 27 | formats = self.nbconvert_api.list_formats().json() 28 | self.assertIsInstance(formats, dict) 29 | self.assertIn('python', formats) 30 | self.assertIn('html', formats) 31 | self.assertEqual(formats['python']['output_mimetype'], 'text/x-python') -------------------------------------------------------------------------------- /notebook/tests/selenium/test_find_and_replace.py: -------------------------------------------------------------------------------- 1 | import pytest 2 | 3 | 4 | def test_find_and_replace(notebook): 5 | """ test find and replace on all the cells """ 6 | cell_0, cell_1, cell_2, cell_3 = "hello", "hellohello", "abc", "ello" 7 | 8 | find_str = "ello" # string to replace 9 | replace_str = "foo" # string to replace to 10 | 11 | # set the contents of the cells 12 | notebook.add_cell(index=0, content=cell_0); 13 | notebook.add_cell(index=1, content=cell_1); 14 | notebook.add_cell(index=2, content=cell_2); 15 | notebook.add_cell(index=3, content=cell_3); 16 | 17 | # replace the strings 18 | notebook.find_and_replace(index=0, find_txt=find_str, replace_txt=replace_str) 19 | 20 | # check content of the cells 21 | assert notebook.get_cell_contents(0) == cell_0.replace(find_str, replace_str) 22 | assert notebook.get_cell_contents(1) == cell_1.replace(find_str, replace_str) 23 | assert notebook.get_cell_contents(2) == cell_2.replace(find_str, replace_str) 24 | assert notebook.get_cell_contents(3) == cell_3.replace(find_str, replace_str) 25 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/variables.less: -------------------------------------------------------------------------------- 1 | 2 | // Our own variables for this page 3 | 4 | @cell_selected_background: darken(@body-bg, 2%); 5 | @cell_background: darken(@body-bg, 3.2%); 6 | @border_color: darken(@cell_selected_background, 31%); 7 | @light_border_color: darken(@cell_selected_background, 17%); 8 | @border_width: 1px; 9 | @notebook_font_size: 14px; 10 | @notebook_line_height: 20px; 11 | @code_line_height: 1.21429em; // changed from 1.231 to get 17px even 12 | @code_padding: 0.4em; // 5.6 px 13 | @rendered_html_border_color: black; 14 | @input_prompt_color: #303F9F; 15 | @output_prompt_color: #D84315; 16 | @output_pre_color: black; 17 | @notification_widget_bg: rgba(240, 240, 240, 0.5); 18 | 19 | 20 | @selected_border_color: #42A5F5; 21 | @selected_border_color_light: #90CAF9; 22 | @soft_select_color: #E3F2FD; 23 | 24 | 25 | @edit_mode_border_color: #66BB6A; 26 | @cell_padding: 6px; 27 | @cell_border_width: 1px; 28 | @cell_left_border_width: 5px; 29 | -------------------------------------------------------------------------------- /notebook/static/auth/js/loginwidget.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define([ 5 | 'jquery', 6 | 'base/js/utils', 7 | ], function($, utils){ 8 | "use strict"; 9 | 10 | var LoginWidget = function (selector, options) { 11 | options = options || {}; 12 | this.base_url = options.base_url || utils.get_body_data("baseUrl"); 13 | this.selector = selector; 14 | if (this.selector !== undefined) { 15 | this.element = $(selector); 16 | this.bind_events(); 17 | } 18 | }; 19 | 20 | 21 | LoginWidget.prototype.bind_events = function () { 22 | var that = this; 23 | this.element.find("button#logout").click(function () { 24 | window.location = utils.url_path_join( 25 | that.base_url, 26 | "logout" 27 | ); 28 | }); 29 | this.element.find("button#login").click(function () { 30 | window.location = utils.url_path_join( 31 | that.base_url, 32 | "login" 33 | ); 34 | }); 35 | }; 36 | 37 | return {'LoginWidget': LoginWidget}; 38 | }); 39 | -------------------------------------------------------------------------------- /notebook/tests/notebook/safe_append_output.js: -------------------------------------------------------------------------------- 1 | // 2 | // Test validation in append_output 3 | // 4 | // Invalid output data is stripped and logged. 5 | // 6 | 7 | casper.notebook_test(function () { 8 | // this.printLog(); 9 | var messages = []; 10 | this.on('remote.message', function (msg) { 11 | messages.push(msg); 12 | }); 13 | 14 | this.evaluate(function () { 15 | var cell = IPython.notebook.get_cell(0); 16 | cell.set_text( "dp = get_ipython().display_pub\n" + 17 | "dp.publish({'text/plain' : '5', 'image/png' : 5})" 18 | ); 19 | cell.execute(); 20 | }); 21 | 22 | this.wait_for_output(0); 23 | this.on('remote.message', function () {}); 24 | 25 | this.then(function () { 26 | var output = this.get_output_cell(0); 27 | this.test.assert(messages.length > 0, "Captured log message"); 28 | this.test.assertEquals(messages[messages.length-1].substr(0,26), "Invalid type for image/png", "Logged Invalid type message"); 29 | this.test.assertEquals(output.data['image/png'], undefined, "Non-string png data was stripped"); 30 | this.test.assertEquals(output.data['text/plain'], '5', "text data is fine"); 31 | }); 32 | }); 33 | -------------------------------------------------------------------------------- /notebook/tests/notebook/clipboard_multiselect.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // Test 4 | casper.notebook_test(function () { 5 | this.append_cell('1'); 6 | this.append_cell('2'); 7 | this.append_cell('3'); 8 | this.append_cell('4'); 9 | this.append_cell('a5'); 10 | this.append_cell('b6'); 11 | this.append_cell('c7'); 12 | this.append_cell('d8'); 13 | 14 | 15 | 16 | this.then(function () { 17 | // Copy/paste/cut 18 | this.select_cell(1); 19 | this.select_cell(3, false); 20 | 21 | this.trigger_keydown('c'); // Copy 22 | 23 | this.select_cell(6) 24 | this.select_cell(7,false) 25 | 26 | this.evaluate(function () { 27 | $("#paste_cell_replace").click(); 28 | }); 29 | 30 | var expected_state = ['', '1', '2', '3', '4', 'a5', '1' ,'2' ,'3', 'd8']; 31 | 32 | for (var i=1; i{% endblock %} 6 | 7 | {% block bodyclasses %}terminal-app {{super()}}{% endblock %} 8 | 9 | {% block params %} 10 | data-base-url="{{base_url | urlencode}}" 11 | data-ws-url="{{ws_url | urlencode}}" 12 | data-ws-path="{{ws_path}}" 13 | {% endblock %} 14 | 15 | {% block stylesheet %} 16 | {{super()}} 17 | 18 | 19 | {% endblock %} 20 | 21 | {% block headercontainer %} 22 | 23 | {% endblock headercontainer %} 24 | 25 | {% block site %} 26 |
27 |
28 |
29 | {% endblock %} 30 | 31 | {% block script %} 32 | 33 | {{super()}} 34 | 35 | 36 | {% endblock %} 37 | -------------------------------------------------------------------------------- /notebook/static/edit/less/edit.less: -------------------------------------------------------------------------------- 1 | .dirty-indicator{ 2 | .fa(); 3 | width:20px; 4 | } 5 | .dirty-indicator-dirty{ 6 | .dirty-indicator(); 7 | } 8 | 9 | .dirty-indicator-clean{ 10 | .dirty-indicator(); 11 | &:before{ 12 | .icon(@fa-var-check); 13 | } 14 | } 15 | 16 | #filename { 17 | font-size: 16pt; 18 | display: table; 19 | padding: 0px 5px; 20 | } 21 | 22 | #current-mode{ 23 | padding-left: 5px; 24 | padding-right: 5px; 25 | } 26 | 27 | #texteditor-backdrop { 28 | padding-top: @page-header-padding; 29 | padding-bottom: @page-header-padding; 30 | 31 | @media not print{ 32 | background-color: @page-backdrop-color; 33 | } 34 | 35 | #texteditor-container { 36 | .CodeMirror-gutter, .CodeMirror-gutters { 37 | @media print { 38 | background-color: @body-bg; 39 | } 40 | @media not print { 41 | background-color: @page-color; 42 | } 43 | } 44 | 45 | @media not print{ 46 | padding: 0px; 47 | background-color : @page-color; 48 | .box-shadow(@global-shadow); 49 | } 50 | } 51 | } 52 | 53 | .CodeMirror-dialog { 54 | background-color: @page-color; 55 | } 56 | -------------------------------------------------------------------------------- /notebook/tests/selenium/test_prompt_numbers.py: -------------------------------------------------------------------------------- 1 | import os 2 | import pytest 3 | import time 4 | 5 | # selenium test version for 'prompt_numbers.js' 6 | 7 | def get_prompt(nb, index): 8 | cell = nb.cells[0] 9 | return cell.find_element_by_class_name('input').find_element_by_class_name('input_prompt').get_attribute('innerHTML').strip() 10 | 11 | def set_prompt(nb, index, value): 12 | nb.set_cell_input_prompt(index, value) 13 | 14 | def test_prompt_numbers(notebook): 15 | cell_index = 0 16 | a = 'print("a")' 17 | notebook.edit_cell(index=cell_index, content=a) 18 | assert get_prompt(notebook, cell_index) == "In [ ]:" 19 | set_prompt(notebook, cell_index, 2); 20 | assert get_prompt(notebook, cell_index) == "In [2]:" 21 | set_prompt(notebook, cell_index, 0); 22 | assert get_prompt(notebook, cell_index) == "In [0]:" 23 | set_prompt(notebook, cell_index, "'*'"); 24 | assert get_prompt(notebook, cell_index) == "In [*]:" 25 | set_prompt(notebook, cell_index, "undefined"); 26 | assert get_prompt(notebook, cell_index) == "In [ ]:" 27 | set_prompt(notebook, cell_index, "null"); 28 | assert get_prompt(notebook, cell_index) == "In [ ]:" 29 | -------------------------------------------------------------------------------- /notebook/tests/selenium/test_markdown.py: -------------------------------------------------------------------------------- 1 | 2 | def get_rendered_contents(nb): 3 | cl = ["text_cell", "render"] 4 | rendered_cells = [cell.find_element_by_class_name("text_cell_render") 5 | for cell in nb.cells 6 | if all([c in cell.get_attribute("class") for c in cl])] 7 | return [x.get_attribute('innerHTML').strip() 8 | for x in rendered_cells 9 | if x is not None] 10 | 11 | 12 | def test_markdown_cell(notebook): 13 | nb = notebook 14 | cell_text = ["# Foo", 15 | '**Bar**', 16 | '*Baz*', 17 | '```\nx = 1\n```', 18 | '```aaaa\nx = 1\n```', 19 | ] 20 | expected_contents = ['

Foo

', 21 | '

Bar

', 22 | '

Baz

', 23 | '
x = 1
', 24 | '
x = 1
' 25 | ] 26 | nb.append(*cell_text, cell_type="markdown") 27 | nb.run_all() 28 | rendered_contents = get_rendered_contents(nb) 29 | assert rendered_contents == expected_contents 30 | -------------------------------------------------------------------------------- /docs/autogen_config.py: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env python 2 | 3 | import os 4 | from notebook.notebookapp import NotebookApp 5 | 6 | header = """\ 7 | .. _config: 8 | 9 | 10 | Config file and command line options 11 | ==================================== 12 | 13 | The notebook server can be run with a variety of command line arguments. 14 | A list of available options can be found below in the :ref:`options section 15 | `. 16 | 17 | Defaults for these options can also be set by creating a file named 18 | ``jupyter_notebook_config.py`` in your Jupyter folder. The Jupyter 19 | folder is in your home directory, ``~/.jupyter``. 20 | 21 | To create a ``jupyter_notebook_config.py`` file, with all the defaults 22 | commented out, you can use the following command line:: 23 | 24 | $ jupyter notebook --generate-config 25 | 26 | 27 | .. _options: 28 | 29 | Options 30 | ------- 31 | 32 | This list of options can be generated by running the following and hitting 33 | enter:: 34 | 35 | $ jupyter notebook --help 36 | 37 | """ 38 | try: 39 | destination = os.path.join(os.path.dirname(__file__), 'source/config.rst') 40 | except: 41 | destination = os.path.join(os.getcwd(), 'config.rst') 42 | 43 | with open(destination, 'w') as f: 44 | f.write(header) 45 | f.write(NotebookApp().document_config_options()) 46 | -------------------------------------------------------------------------------- /notebook/services/config/handlers.py: -------------------------------------------------------------------------------- 1 | """Tornado handlers for frontend config storage.""" 2 | 3 | # Copyright (c) Jupyter Development Team. 4 | # Distributed under the terms of the Modified BSD License. 5 | import json 6 | import os 7 | import io 8 | import errno 9 | from tornado import web 10 | 11 | from ipython_genutils.py3compat import PY3 12 | from ...base.handlers import APIHandler 13 | 14 | class ConfigHandler(APIHandler): 15 | 16 | @web.authenticated 17 | def get(self, section_name): 18 | self.set_header("Content-Type", 'application/json') 19 | self.finish(json.dumps(self.config_manager.get(section_name))) 20 | 21 | @web.authenticated 22 | def put(self, section_name): 23 | data = self.get_json_body() # Will raise 400 if content is not valid JSON 24 | self.config_manager.set(section_name, data) 25 | self.set_status(204) 26 | 27 | @web.authenticated 28 | def patch(self, section_name): 29 | new_data = self.get_json_body() 30 | section = self.config_manager.update(section_name, new_data) 31 | self.finish(json.dumps(section)) 32 | 33 | 34 | # URL to handler mappings 35 | 36 | section_name_regex = r"(?P\w+)" 37 | 38 | default_handlers = [ 39 | (r"/api/config/%s" % section_name_regex, ConfigHandler), 40 | ] 41 | -------------------------------------------------------------------------------- /bower.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "jupyter-notebook-deps", 3 | "version": "0.0.1", 4 | "dependencies": { 5 | "backbone": "components/backbone#~1.2", 6 | "bootstrap": "components/bootstrap#~3.3", 7 | "bootstrap-tour": "0.9.0", 8 | "codemirror": "components/codemirror#~5.35", 9 | "es6-promise": "~1.0", 10 | "font-awesome": "components/font-awesome#~4.7.0", 11 | "google-caja": "5669", 12 | "jed": "~1.1.1", 13 | "jquery": "components/jquery#~3.3", 14 | "jquery-typeahead": "~2.0.0", 15 | "jquery-ui": "components/jqueryui#~1.10", 16 | "marked": "~0.4", 17 | "MathJax": "components/MathJax#~2.6", 18 | "moment": "~2.19.3", 19 | "preact": "https://unpkg.com/preact@^7.2.0/dist/preact.min.js", 20 | "preact-compat": "https://unpkg.com/preact-compat@^3.14.3/dist/preact-compat.min.js", 21 | "proptypes": "https://unpkg.com/proptypes@^0.14.4/index.js", 22 | "requirejs": "~2.1", 23 | "requirejs-text": "~2.0.15", 24 | "requirejs-plugins": "~1.0.3", 25 | "text-encoding": "~0.1", 26 | "underscore": "components/underscore#~1.8.3", 27 | "xterm.js": "https://unpkg.com/xterm@~3.1.0/dist/xterm.js", 28 | "xterm.js-css": "https://unpkg.com/xterm@~3.1.0/dist/xterm.css", 29 | "xterm.js-fit": "https://unpkg.com/xterm@~3.1.0/dist/addons/fit/fit.js" 30 | } 31 | } 32 | -------------------------------------------------------------------------------- /notebook/static/base/js/events.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | // Give us an object to bind all events to. This object should be created 5 | // before all other objects so it exists when others register event handlers. 6 | // To register an event handler: 7 | // 8 | // requirejs(['base/js/events'], function (events) { 9 | // events.on("event.Namespace", function () { do_stuff(); }); 10 | // }); 11 | 12 | define(['jquery', 'base/js/namespace'], function($, Jupyter) { 13 | "use strict"; 14 | 15 | // Events singleton 16 | if (!window._Events) { 17 | window._Events = function () {}; 18 | window._events = new window._Events(); 19 | } 20 | 21 | // Backwards compatability. 22 | Jupyter.Events = window._Events; 23 | Jupyter.events = window._events; 24 | 25 | var events = $([window._events]); 26 | 27 | // catch and log errors in triggered events 28 | events._original_trigger = events.trigger; 29 | events.trigger = function (name, data) { 30 | try { 31 | this._original_trigger.apply(this, arguments); 32 | } catch (e) { 33 | console.error("Exception in event handler for " + name, e, arguments); 34 | } 35 | } 36 | return events; 37 | }); 38 | -------------------------------------------------------------------------------- /notebook/static/bidi/bidi.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define(['bidi/numericshaping'], function(numericshaping) { 5 | 'use strict'; 6 | 7 | var shaperType = ''; 8 | 9 | var _uiLang = function() { 10 | return navigator.language.toLowerCase(); 11 | }; 12 | 13 | var _loadLocale = function() { 14 | if (_isMirroringEnabled()) { 15 | document.body.dir = 'rtl'; 16 | } 17 | 18 | requirejs(['moment'], function (moment) { 19 | console.log('Loaded moment locale', moment.locale(_uiLang())); 20 | }); 21 | 22 | shaperType = _uiLang().split('-')[0] == 'ar' ? 'national' : 'defaultNumeral'; 23 | }; 24 | 25 | var _isMirroringEnabled = function() { 26 | return new RegExp('^(ar|he)').test(_uiLang()); 27 | }; 28 | 29 | /** 30 | * @param value : the string to apply the bidi-support on it. 31 | * @param flag :indicates the type of bidi-support (Numeric-shaping ,Base-text-dir ). 32 | */ 33 | var _applyBidi = function(value /*, flag*/) { 34 | value = numericshaping.shapeNumerals(value, shaperType); 35 | return value; 36 | }; 37 | 38 | var bidi = { 39 | applyBidi: _applyBidi, 40 | isMirroringEnabled: _isMirroringEnabled, 41 | loadLocale: _loadLocale, 42 | }; 43 | 44 | return bidi; 45 | }); 46 | -------------------------------------------------------------------------------- /notebook/tree/tests/test_tree_handler.py: -------------------------------------------------------------------------------- 1 | """Test the /tree handlers""" 2 | import os 3 | import io 4 | from notebook.utils import url_path_join 5 | from nbformat import write 6 | from nbformat.v4 import new_notebook 7 | try: 8 | from urllib.parse import urlparse 9 | except ImportError: 10 | from urlparse import urlparse 11 | 12 | import requests 13 | 14 | from notebook.tests.launchnotebook import NotebookTestBase 15 | 16 | class TreeTest(NotebookTestBase): 17 | def setUp(self): 18 | nbdir = self.notebook_dir 19 | d = os.path.join(nbdir, 'foo') 20 | os.mkdir(d) 21 | 22 | with io.open(os.path.join(d, 'bar.ipynb'), 'w', encoding='utf-8') as f: 23 | nb = new_notebook() 24 | write(nb, f, version=4) 25 | 26 | with io.open(os.path.join(d, 'baz.txt'), 'w', encoding='utf-8') as f: 27 | f.write(u'flamingo') 28 | 29 | self.base_url() 30 | 31 | def test_redirect(self): 32 | r = self.request('GET', 'tree/foo/bar.ipynb') 33 | self.assertEqual(r.url, self.base_url() + 'notebooks/foo/bar.ipynb') 34 | 35 | r = self.request('GET', 'tree/foo/baz.txt', allow_redirects=False) 36 | self.assertEqual(r.status_code, 302) 37 | self.assertEqual(r.headers['Location'], 38 | urlparse(url_path_join(self.base_url(), 'files/foo/baz.txt')).path) 39 | -------------------------------------------------------------------------------- /notebook/terminal/api_handlers.py: -------------------------------------------------------------------------------- 1 | import json 2 | from tornado import web, gen 3 | from ..base.handlers import APIHandler 4 | from ..utils import url_path_join 5 | 6 | class TerminalRootHandler(APIHandler): 7 | @web.authenticated 8 | def get(self): 9 | tm = self.terminal_manager 10 | terms = [{'name': name} for name in tm.terminals] 11 | self.finish(json.dumps(terms)) 12 | 13 | @web.authenticated 14 | def post(self): 15 | """POST /terminals creates a new terminal and redirects to it""" 16 | name, _ = self.terminal_manager.new_named_terminal() 17 | self.finish(json.dumps({'name': name})) 18 | 19 | 20 | class TerminalHandler(APIHandler): 21 | SUPPORTED_METHODS = ('GET', 'DELETE') 22 | 23 | @web.authenticated 24 | def get(self, name): 25 | tm = self.terminal_manager 26 | if name in tm.terminals: 27 | self.finish(json.dumps({'name': name})) 28 | else: 29 | raise web.HTTPError(404, "Terminal not found: %r" % name) 30 | 31 | @web.authenticated 32 | @gen.coroutine 33 | def delete(self, name): 34 | tm = self.terminal_manager 35 | if name in tm.terminals: 36 | yield tm.terminate(name, force=True) 37 | self.set_status(204) 38 | self.finish() 39 | else: 40 | raise web.HTTPError(404, "Terminal not found: %r" % name) 41 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/commandpalette.less: -------------------------------------------------------------------------------- 1 | ul.typeahead-list i{ 2 | margin-left: -10px; 3 | width: 18px; 4 | } 5 | 6 | [dir="rtl"] ul.typeahead-list i { 7 | margin-left: 0; 8 | margin-right: -10px; 9 | } 10 | 11 | ul.typeahead-list { 12 | max-height: 80vh; 13 | overflow:auto; 14 | 15 | & > li > a { 16 | /** Firefox bug **/ 17 | /* see https://github.com/jupyter/notebook/issues/559 */ 18 | white-space: normal; 19 | } 20 | } 21 | 22 | ul.typeahead-list & > li > a.pull-right { 23 | .pull-left(); 24 | } 25 | 26 | [dir="rtl"] .typeahead-list { 27 | text-align : right; 28 | } 29 | 30 | .cmd-palette { 31 | & .modal-body{ 32 | padding: 7px; 33 | } 34 | 35 | & form { 36 | background: white; 37 | } 38 | 39 | & input { 40 | outline:none; 41 | } 42 | } 43 | 44 | .no-shortcut{ 45 | min-width: 20px; 46 | color: transparent; 47 | } 48 | 49 | [dir="rtl"] .no-shortcut.pull-right{ 50 | .pull-left(); 51 | } 52 | 53 | [dir="rtl"] .command-shortcut.pull-right{ 54 | .pull-left(); 55 | } 56 | 57 | .command-shortcut:before{ 58 | content:"(command mode)"; 59 | padding-right:3px; 60 | color:@gray-light; 61 | } 62 | 63 | .edit-shortcut:before{ 64 | content:"(edit)"; 65 | padding-right:3px; 66 | color:@gray-light; 67 | } 68 | 69 | [dir="rtl"] .edit-shortcut.pull-right { 70 | .pull-left(); 71 | } 72 | -------------------------------------------------------------------------------- /notebook/templates/logout.html: -------------------------------------------------------------------------------- 1 | {% extends "page.html" %} 2 | 3 | {# This template is rendered in response to an authenticated request, so the 4 | user is technically logged in. But when the user sees it, the cookie is 5 | cleared by the Javascript, so we should render this as if the user was logged 6 | out, without e.g. authentication tokens. 7 | #} 8 | {% set logged_in = False %} 9 | 10 | {% block stylesheet %} 11 | {{super()}} 12 | 13 | {% endblock %} 14 | 15 | {% block login_widget %} 16 | {% endblock %} 17 | 18 | {% block site %} 19 | 20 |
21 | 22 | {% if message %} 23 | {% for key in message %} 24 |
25 | {{message[key]}} 26 |
27 | {% endfor %} 28 | {% endif %} 29 | 30 | {% if not login_available %} 31 | {% trans %}Proceed to the dashboard{% endtrans %}. 32 | {% else %} 33 | {% trans %}Proceed to the login page{% endtrans %}. 34 | {% endif %} 35 | 36 | 37 |
38 | 39 | {% endblock %} 40 | 41 | {% block script %} 42 | {{super()}} 43 | 44 | 49 | 50 | {% endblock %} 51 | -------------------------------------------------------------------------------- /notebook/static/tree/js/shutdownbutton.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define([ 5 | 'jquery', 6 | 'base/js/dialog', 7 | 'base/js/i18n', 8 | 'base/js/utils' 9 | ], function( 10 | $, 11 | dialog, 12 | i18n, 13 | utils 14 | ){ 15 | "use strict"; 16 | 17 | function display_shutdown_dialog() { 18 | var body = $('
').append( 19 | $('

').text(i18n.msg._("You have shut down Jupyter. You can now close this tab.")) 20 | ).append( 21 | $('

').text(i18n.msg._("To use Jupyter again, you will need to relaunch it.")) 22 | ); 23 | 24 | dialog.modal({ 25 | title: i18n.msg._("Server stopped"), 26 | body: body 27 | }) 28 | } 29 | 30 | function activate() { 31 | // Add shutdown button 32 | $("button#shutdown").click(function () { 33 | utils.ajax(utils.url_path_join( 34 | utils.get_body_data("baseUrl"), 35 | "api", 36 | "shutdown" 37 | ), { 38 | type: "POST", 39 | success: display_shutdown_dialog, 40 | error: function (error) { 41 | console.log(error); 42 | } 43 | }); 44 | }); 45 | } 46 | 47 | return {activate: activate} 48 | }); 49 | -------------------------------------------------------------------------------- /notebook/tests/notebook/interrupt.js: -------------------------------------------------------------------------------- 1 | // 2 | // Test kernel interrupt 3 | // 4 | casper.notebook_test(function () { 5 | this.evaluate(function () { 6 | var cell = IPython.notebook.get_cell(0); 7 | cell.set_text( 8 | 'import time'+ 9 | '\nfor x in range(3):'+ 10 | '\n time.sleep(1)' 11 | ); 12 | cell.execute(); 13 | }); 14 | 15 | this.wait_for_busy(); 16 | 17 | // interrupt using menu item (Kernel -> Interrupt) 18 | this.thenClick('li#int_kernel'); 19 | 20 | this.wait_for_output(0); 21 | 22 | this.then(function () { 23 | var result = this.get_output_cell(0); 24 | this.test.assertEquals(result.ename, 'KeyboardInterrupt', 'keyboard interrupt (mouseclick)'); 25 | }); 26 | 27 | // run cell 0 again, now interrupting using keyboard shortcut 28 | this.thenEvaluate(function () { 29 | var cell = IPython.notebook.get_cell(0); 30 | cell.clear_output(); 31 | cell.execute(); 32 | }); 33 | 34 | // interrupt using ii keyboard shortcut 35 | this.then(function(){ 36 | this.trigger_keydown('esc', 'i', 'i'); 37 | }); 38 | 39 | this.wait_for_output(0); 40 | 41 | this.then(function () { 42 | var result = this.get_output_cell(0); 43 | this.test.assertEquals(result.ename, 'KeyboardInterrupt', 'keyboard interrupt (shortcut)'); 44 | }); 45 | }); 46 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/tagbar.less: -------------------------------------------------------------------------------- 1 | 2 | 3 | .tags_button_container { 4 | width: 100%; 5 | display: flex; 6 | } 7 | 8 | .tag-container { 9 | display: flex; 10 | flex-direction: row; 11 | flex-grow: 1; 12 | overflow: hidden; 13 | position: relative; 14 | } 15 | 16 | .tag-container > * { 17 | margin: 0 4px; 18 | } 19 | 20 | .remove-tag-btn { 21 | margin-left: 4px; 22 | } 23 | 24 | .tags-input { 25 | display: flex; 26 | } 27 | 28 | .cell-tag:last-child:after { 29 | content: ""; 30 | position: absolute; 31 | right: 0; 32 | width: 40px; 33 | height: 100%; 34 | /* Fade to background color of cell toolbar */ 35 | background: linear-gradient(to right, rgba(0,0,0,0), #EEE); 36 | } 37 | 38 | .tags-input > * { 39 | margin-left: 4px; 40 | } 41 | 42 | .cell-tag, 43 | .tags-input input, 44 | .tags-input button { 45 | .form-control(); 46 | .input-sm(); 47 | // undo some of the sizing caused by the above mixins 48 | box-shadow: none; 49 | width: inherit; 50 | font-size: inherit; 51 | height: 22px; 52 | line-height: 22px; 53 | padding: 0px 4px; 54 | 55 | display: inline-block; 56 | } 57 | 58 | .cell-tag, 59 | .tags-input button { 60 | padding: 0px 4px; 61 | } 62 | 63 | .cell-tag { 64 | background-color: #fff; 65 | white-space: nowrap; 66 | } 67 | 68 | .tags-input input[type=text]:focus { 69 | outline: none; 70 | box-shadow: none; 71 | border-color: #ccc; 72 | } 73 | -------------------------------------------------------------------------------- /notebook/static/terminal/js/terminado.js: -------------------------------------------------------------------------------- 1 | define (["xterm", "xtermjs-fit"], function(Terminal, fit) { 2 | "use strict"; 3 | function make_terminal(element, ws_url) { 4 | var ws = new WebSocket(ws_url); 5 | Terminal.applyAddon(fit); 6 | var term = new Terminal(); 7 | ws.onopen = function(event) { 8 | term.on('data', function(data) { 9 | ws.send(JSON.stringify(['stdin', data])); 10 | }); 11 | 12 | term.on('title', function(title) { 13 | document.title = title; 14 | }); 15 | 16 | term.open(element); 17 | term.fit(); 18 | // send the terminal size to the server. 19 | ws.send(JSON.stringify(["set_size", term.rows, term.cols, 20 | window.innerHeight, window.innerWidth])); 21 | 22 | ws.onmessage = function(event) { 23 | var json_msg = JSON.parse(event.data); 24 | switch(json_msg[0]) { 25 | case "stdout": 26 | term.write(json_msg[1]); 27 | break; 28 | case "disconnect": 29 | term.write("\r\n\r\n[CLOSED]\r\n"); 30 | break; 31 | } 32 | }; 33 | }; 34 | return {socket: ws, term: term}; 35 | } 36 | 37 | return {make_terminal: make_terminal}; 38 | }); 39 | -------------------------------------------------------------------------------- /docs/source/examples/Notebook/nbpackage/mynotebook.ipynb: -------------------------------------------------------------------------------- 1 | { 2 | "cells": [ 3 | { 4 | "cell_type": "markdown", 5 | "metadata": {}, 6 | "source": [ 7 | "# My Notebook" 8 | ] 9 | }, 10 | { 11 | "cell_type": "code", 12 | "execution_count": 1, 13 | "metadata": { 14 | "collapsed": false 15 | }, 16 | "outputs": [], 17 | "source": [ 18 | "def foo():\n", 19 | " return \"foo\"" 20 | ] 21 | }, 22 | { 23 | "cell_type": "code", 24 | "execution_count": 2, 25 | "metadata": { 26 | "collapsed": false 27 | }, 28 | "outputs": [], 29 | "source": [ 30 | "def has_ip_syntax():\n", 31 | " listing = !ls\n", 32 | " return listing" 33 | ] 34 | }, 35 | { 36 | "cell_type": "code", 37 | "execution_count": 4, 38 | "metadata": { 39 | "collapsed": false 40 | }, 41 | "outputs": [], 42 | "source": [ 43 | "def whatsmyname():\n", 44 | " return __name__" 45 | ] 46 | } 47 | ], 48 | "metadata": { 49 | "kernelspec": { 50 | "display_name": "Python 3", 51 | "language": "python", 52 | "name": "python3" 53 | }, 54 | "language_info": { 55 | "codemirror_mode": { 56 | "name": "ipython", 57 | "version": 3 58 | }, 59 | "file_extension": ".py", 60 | "mimetype": "text/x-python", 61 | "name": "python", 62 | "nbconvert_exporter": "python", 63 | "pygments_lexer": "ipython3", 64 | "version": "3.5.1+" 65 | } 66 | }, 67 | "nbformat": 4, 68 | "nbformat_minor": 0 69 | } 70 | -------------------------------------------------------------------------------- /notebook/tests/notebook/merge_cells_api.js: -------------------------------------------------------------------------------- 1 | // 2 | // Test merging two notebook cells. 3 | // 4 | casper.notebook_test(function() { 5 | var that = this; 6 | var set_cells_text = function () { 7 | that.evaluate(function() { 8 | var cell_one = IPython.notebook.get_selected_cell(); 9 | cell_one.set_text('a = 5'); 10 | }); 11 | 12 | that.trigger_keydown('b'); 13 | 14 | that.evaluate(function() { 15 | var cell_two = IPython.notebook.get_selected_cell(); 16 | cell_two.set_text('print(a)'); 17 | }); 18 | }; 19 | 20 | this.evaluate(function () { 21 | IPython.notebook.command_mode(); 22 | }); 23 | 24 | // merge_cell_above() 25 | set_cells_text(); 26 | var output_above = this.evaluate(function () { 27 | IPython.notebook.merge_cell_above(); 28 | return IPython.notebook.get_selected_cell().get_text(); 29 | }); 30 | 31 | // merge_cell_below() 32 | set_cells_text(); 33 | var output_below = this.evaluate(function() { 34 | IPython.notebook.select(0); 35 | IPython.notebook.merge_cell_below(); 36 | return IPython.notebook.get_selected_cell().get_text(); 37 | }); 38 | 39 | this.test.assertEquals(output_above, 'a = 5\n\nprint(a)', 40 | 'Successful merge_cell_above().'); 41 | this.test.assertEquals(output_below, 'a = 5\n\nprint(a)', 42 | 'Successful merge_cell_below().'); 43 | }); 44 | -------------------------------------------------------------------------------- /notebook/static/notebook/less/toolbar.less: -------------------------------------------------------------------------------- 1 | .toolbar { 2 | padding: 0px; 3 | margin-left: -5px; 4 | margin-top: 2px; 5 | margin-bottom: 5px; 6 | 7 | select, label { 8 | width: auto; 9 | vertical-align:middle; 10 | margin-right:2px; 11 | margin-bottom:0px; 12 | display: inline; 13 | font-size: 92%; 14 | margin-left:0.3em; 15 | margin-right:0.3em; 16 | padding: 0px; 17 | padding-top: 3px; 18 | } 19 | .btn { 20 | padding: 2px 8px; 21 | } 22 | 23 | .border-box-sizing(); 24 | } 25 | 26 | .toolbar .btn-group { 27 | margin-top: 0px; 28 | margin-left: 5px; 29 | } 30 | 31 | .toolbar-btn-label { 32 | margin-left: 6px; 33 | } 34 | 35 | #maintoolbar { 36 | margin-bottom: -3px; 37 | margin-top: -8px; 38 | border: 0px; 39 | min-height: 27px; 40 | margin-left: 0px; 41 | padding-top: 11px; 42 | padding-bottom: 3px; 43 | 44 | .navbar-text { 45 | float: none; 46 | vertical-align: middle; 47 | text-align: right; 48 | margin-left: 5px; 49 | margin-right: 0px; 50 | margin-top: 0px; 51 | } 52 | } 53 | 54 | .select-xs { 55 | height: @btn_small_height; 56 | } 57 | 58 | [dir="rtl"] .btn-group > .btn, .btn-group-vertical > .btn { 59 | float: right; 60 | } 61 | 62 | // highlight the new menu where celltoolbar is 63 | .pulse, .dropdown-menu > li > a.pulse, li.pulse > a.dropdown-toggle, li.pulse.open > a.dropdown-toggle { 64 | background-color: #F37626; 65 | color: white; 66 | } 67 | -------------------------------------------------------------------------------- /notebook/tests/base/misc.js: -------------------------------------------------------------------------------- 1 | 2 | // 3 | // Miscellaneous javascript tests 4 | // 5 | casper.notebook_test(function () { 6 | var jsver = this.evaluate(function () { 7 | var cell = IPython.notebook.get_cell(0); 8 | cell.set_text('import notebook; print(notebook.__version__)'); 9 | cell.execute(); 10 | return IPython.version; 11 | }); 12 | 13 | this.wait_for_output(0); 14 | 15 | // refactor this into just a get_output(0) 16 | this.then(function () { 17 | var result = this.get_output_cell(0); 18 | this.test.assertEquals(result.text.trim(), jsver, 'IPython.version in JS matches server-side.'); 19 | }); 20 | 21 | // verify that requirejs loads the same CodeCell prototype at runtime as build time 22 | this.thenEvaluate(function () { 23 | require(['notebook/js/codecell'], function (codecell) { 24 | codecell.CodeCell.prototype.test = function () { 25 | return 'ok'; 26 | } 27 | window._waitForMe = true; 28 | }) 29 | }) 30 | 31 | this.waitFor(function () { 32 | return this.evaluate(function () { 33 | return window._waitForMe; 34 | }); 35 | }) 36 | 37 | this.then(function () { 38 | var result = this.evaluate(function () { 39 | var cell = Jupyter.notebook.get_cell(0); 40 | return cell.test(); 41 | }); 42 | this.test.assertEquals(result, 'ok', "runtime-requirejs loads the same modules") 43 | }) 44 | 45 | }); 46 | -------------------------------------------------------------------------------- /notebook/metrics.py: -------------------------------------------------------------------------------- 1 | """ 2 | Prometheus metrics exported by Jupyter Notebook Server 3 | 4 | Read https://prometheus.io/docs/practices/naming/ for naming 5 | conventions for metrics & labels. 6 | """ 7 | 8 | from prometheus_client import Histogram 9 | 10 | # This is a fairly standard name for HTTP duration latency reporting 11 | HTTP_REQUEST_DURATION_SECONDS = Histogram( 12 | 'http_request_duration_seconds', 13 | 'duration in seconds for all HTTP requests', 14 | ['method', 'handler', 'status_code'], 15 | ) 16 | 17 | def prometheus_log_method(handler): 18 | """ 19 | Tornado log handler for recording RED metrics. 20 | 21 | We record the following metrics: 22 | Rate - the number of requests, per second, your services are serving. 23 | Errors - the number of failed requests per second. 24 | Duration - The amount of time each request takes expressed as a time interval. 25 | 26 | We use a fully qualified name of the handler as a label, 27 | rather than every url path to reduce cardinality. 28 | 29 | This function should be either the value of or called from a function 30 | that is the 'log_function' tornado setting. This makes it get called 31 | at the end of every request, allowing us to record the metrics we need. 32 | """ 33 | HTTP_REQUEST_DURATION_SECONDS.labels( 34 | method=handler.request.method, 35 | handler='{}.{}'.format(handler.__class__.__module__, type(handler).__name__), 36 | status_code=handler.get_status() 37 | ).observe(handler.request.request_time()) 38 | -------------------------------------------------------------------------------- /notebook/terminal/handlers.py: -------------------------------------------------------------------------------- 1 | #encoding: utf-8 2 | """Tornado handlers for the terminal emulator.""" 3 | 4 | # Copyright (c) Jupyter Development Team. 5 | # Distributed under the terms of the Modified BSD License. 6 | 7 | from tornado import web 8 | import terminado 9 | from notebook._tz import utcnow 10 | from ..base.handlers import IPythonHandler 11 | from ..base.zmqhandlers import WebSocketMixin 12 | 13 | 14 | class TerminalHandler(IPythonHandler): 15 | """Render the terminal interface.""" 16 | @web.authenticated 17 | def get(self, term_name): 18 | self.write(self.render_template('terminal.html', 19 | ws_path="terminals/websocket/%s" % term_name)) 20 | 21 | 22 | class TermSocket(WebSocketMixin, IPythonHandler, terminado.TermSocket): 23 | 24 | def origin_check(self): 25 | """Terminado adds redundant origin_check 26 | 27 | Tornado already calls check_origin, so don't do anything here. 28 | """ 29 | return True 30 | 31 | def get(self, *args, **kwargs): 32 | if not self.get_current_user(): 33 | raise web.HTTPError(403) 34 | return super(TermSocket, self).get(*args, **kwargs) 35 | 36 | def on_message(self, message): 37 | super(TermSocket, self).on_message(message) 38 | self.application.settings['terminal_last_activity'] = utcnow() 39 | 40 | def write_message(self, message, binary=False): 41 | super(TermSocket, self).write_message(message, binary=binary) 42 | self.application.settings['terminal_last_activity'] = utcnow() 43 | -------------------------------------------------------------------------------- /docs-translations/ko-KR/HowtoRun.md: -------------------------------------------------------------------------------- 1 | # Notebook 실행하기 2 | 3 | ## 첫 걸음 4 | 1. 다음 명령어를 통해 Notebook 서버를 시작하세요 : 5 | 6 | $ jupyter notebook 7 | 8 | 2. 브라우저에 Notebook이 실행된 것을 확인할 수 있습니다. 9 | 10 | 11 | # Notebook 서버 시작하기 12 | 13 | Notebook을 컴퓨터에 설치하였으면 Notebook 서버를 시작할 수 있습니다. 다음 명령어를 이용하여 Notebook서버를 시작할 수 있습니다. 14 | 15 | $ jupyter notebook 16 | 17 | 이 명령어를 실행하면, 터미널에 웹 응용프로그램의 주소와 서버에 대한 정보가 출력됩니다. 18 | 19 | $ jupyter notebook 20 | $ [I 08:58:24.417 NotebookApp] Serving notebooks from local directory: /Users/catherline 21 | $ [I 08:58:24.417 NotebookApp] 0 active kernels 22 | $ [I 08:58:24.417 NotebookApp] The Jupyter Notebook is running at: http://localhost:8888/ 23 | $ [I 08:58:24.417 NotebookApp] Use Control-C to stop this server and shut down all kernels 24 | 25 | 기본 브라우저를 통해 이 주소가 열립니다. 26 | 27 | Notebook이 브라우저에 열리면, Notebook의 목록을 보여주는 Notebook Dashboard를 볼 수 있습니다. 대체로 가장 상위의 디렉토리를 열어줄 것입니다. 28 | 29 | **Notebook Dashboard** 30 | 31 | ![Notebook Dashboard example](resources/dashboard.GIF "Notebook Dashboard") 32 | 33 | # Notebook 서버의 명령어 소개 34 | 35 | ## 커스텀 IP 나 포트를 이용하여 시작하려면 어떻게 해야할까? 36 | 37 | 기본값으로, Notebook 서버는 포트 8888로 시작됩니다. 만약 포트8888이 사용할 수 없다면, Notebook 서버는 다른 가능한 포트를 찾습니다. 또한 임의로 포트를 설정해주는 것도 가능합니다. 예를 들어 포트 9999로 실행하면 : 38 | 39 | $ jupyter notebook --port 9999 40 | 41 | 42 | ## 브라우저를 열지않고 Notebook를 열기 43 | 44 | 브라우저를 열지 않고 Notebook 서버를 시작하려면 : 45 | 46 | $ jupyter notebook --no-browser 47 | 48 | 49 | ## Notebook 서버 옵션 도움말 보기 50 | 51 | Notebook 서버는 --help 옵션을 통해 도움말 메시지를 제공합니다 : 52 | 53 | $ jupyter notebook --help 54 | 55 | 56 | 57 | 58 | -------------------------------------------------------------------------------- /notebook/terminal/__init__.py: -------------------------------------------------------------------------------- 1 | import os 2 | 3 | import terminado 4 | from ..utils import check_version 5 | 6 | if not check_version(terminado.__version__, '0.8.1'): 7 | raise ImportError("terminado >= 0.8.1 required, found %s" % terminado.__version__) 8 | 9 | from ipython_genutils.py3compat import which 10 | from terminado import NamedTermManager 11 | from tornado.log import app_log 12 | from notebook.utils import url_path_join as ujoin 13 | from .handlers import TerminalHandler, TermSocket 14 | from . import api_handlers 15 | 16 | def initialize(webapp, notebook_dir, connection_url, settings): 17 | if os.name == 'nt': 18 | default_shell = 'powershell.exe' 19 | else: 20 | default_shell = which('sh') 21 | shell = settings.get('shell_command', 22 | [os.environ.get('SHELL') or default_shell] 23 | ) 24 | terminal_manager = webapp.settings['terminal_manager'] = NamedTermManager( 25 | shell_command=shell, 26 | extra_env={'JUPYTER_SERVER_ROOT': notebook_dir, 27 | 'JUPYTER_SERVER_URL': connection_url, 28 | }, 29 | ) 30 | terminal_manager.log = app_log 31 | base_url = webapp.settings['base_url'] 32 | handlers = [ 33 | (ujoin(base_url, r"/terminals/(\w+)"), TerminalHandler), 34 | (ujoin(base_url, r"/terminals/websocket/(\w+)"), TermSocket, 35 | {'term_manager': terminal_manager}), 36 | (ujoin(base_url, r"/api/terminals"), api_handlers.TerminalRootHandler), 37 | (ujoin(base_url, r"/api/terminals/(\w+)"), api_handlers.TerminalHandler), 38 | ] 39 | webapp.add_handlers(".*$", handlers) 40 | -------------------------------------------------------------------------------- /notebook/auth/__main__.py: -------------------------------------------------------------------------------- 1 | from notebook.auth import passwd 2 | from getpass import getpass 3 | from notebook.config_manager import BaseJSONConfigManager 4 | from jupyter_core.paths import jupyter_config_dir 5 | import argparse 6 | import sys 7 | 8 | def set_password(args): 9 | password = args.password 10 | while not password : 11 | password1 = getpass("" if args.quiet else "Provide password: ") 12 | password_repeat = getpass("" if args.quiet else "Repeat password: ") 13 | if password1 != password_repeat: 14 | print("Passwords do not match, try again") 15 | elif len(password1) < 4: 16 | print("Please provide at least 4 characters") 17 | else: 18 | password = password1 19 | 20 | password_hash = passwd(password) 21 | cfg = BaseJSONConfigManager(config_dir=jupyter_config_dir()) 22 | cfg.update('jupyter_notebook_config', { 23 | 'NotebookApp': { 24 | 'password': password_hash, 25 | } 26 | }) 27 | if not args.quiet: 28 | print("password stored in config dir: %s" % jupyter_config_dir()) 29 | 30 | def main(argv): 31 | parser = argparse.ArgumentParser(argv[0]) 32 | subparsers = parser.add_subparsers() 33 | parser_password = subparsers.add_parser('password', help='sets a password for your notebook server') 34 | parser_password.add_argument("password", help="password to set, if not given, a password will be queried for (NOTE: this may not be safe)", 35 | nargs="?") 36 | parser_password.add_argument("--quiet", help="suppress messages", action="store_true") 37 | parser_password.set_defaults(function=set_password) 38 | args = parser.parse_args(argv[1:]) 39 | args.function(args) 40 | 41 | if __name__ == "__main__": 42 | main(sys.argv) -------------------------------------------------------------------------------- /notebook/static/notebook/less/savewidget.less: -------------------------------------------------------------------------------- 1 | span.save_widget { 2 | height: 30px; 3 | margin-top: 4px; 4 | display: flex; 5 | justify-content: flex-start; 6 | align-items: baseline; 7 | width: 50%; 8 | flex: 1; 9 | 10 | span.filename { 11 | height: 100%; 12 | line-height: 1em; 13 | margin-left: @padding-large-horizontal; 14 | border: none; 15 | font-size: 146.5%; 16 | text-overflow: ellipsis; 17 | overflow: hidden; 18 | white-space: nowrap; 19 | &:hover{ 20 | // ensure body is lighter on dark palette, 21 | // and vice versa 22 | background-color:contrast(@body-bg, lighten(@body-bg,30%), darken(@body-bg,10%)); 23 | } 24 | .corner-all; 25 | } 26 | } 27 | 28 | [dir="rtl"] span.save_widget.pull-left { 29 | .pull-right(); 30 | } 31 | 32 | [dir="rtl"] span.save_widget { 33 | span.filename { 34 | margin-left : 0; 35 | margin-right : @padding-large-horizontal; 36 | } 37 | } 38 | 39 | span.checkpoint_status, span.autosave_status { 40 | font-size: small; 41 | white-space: nowrap; 42 | padding: 0 5px; 43 | } 44 | 45 | @media (max-width: @screen-xs-max) { 46 | span.save_widget { 47 | font-size: small; 48 | padding: 0 0 0 5px; 49 | } 50 | span.checkpoint_status, span.autosave_status { 51 | display: none; 52 | } 53 | } 54 | 55 | @media (min-width: @screen-sm-min) and (max-width: @screen-sm-max) { 56 | span.checkpoint_status { 57 | display: none; 58 | } 59 | span.autosave_status { 60 | font-size: x-small; 61 | } 62 | } 63 | -------------------------------------------------------------------------------- /notebook/tests/notebook/kernel_menu.js: -------------------------------------------------------------------------------- 1 | 2 | casper.notebook_test(function () { 3 | var that = this; 4 | 5 | var menuItems = ['#restart_kernel', '#restart_clear_output', '#restart_run_all', '#shutdown_kernel'] 6 | var cancelSelector = ".modal-footer button:first-of-type" 7 | 8 | menuItems.forEach( function(selector) { 9 | that.thenClick(selector); 10 | that.waitForSelector(cancelSelector); 11 | that.thenClick(cancelSelector); 12 | 13 | that.waitWhileSelector(".modal-content", function() { 14 | that.test.assert(true, selector + " confirmation modal pops up and is cancelable"); 15 | }); 16 | }); 17 | 18 | var shutdownSelector = menuItems.pop(); 19 | var confirmSelector = ".modal-footer .btn-danger" 20 | 21 | menuItems.forEach( function(selector) { 22 | that.thenClick(shutdownSelector); 23 | that.waitForSelector(confirmSelector); 24 | that.thenClick(confirmSelector); 25 | 26 | // wait for shutdown to go through 27 | that.waitFor(function() { return this.evaluate(function() { 28 | return IPython.notebook.kernel.is_connected() === false; 29 | })}); 30 | 31 | // Click on one of the restarts 32 | that.thenClick(selector); 33 | 34 | // Kernel should get connected, no need for confirmation. 35 | that.waitFor(function() { return this.evaluate(function() { 36 | return IPython.notebook.kernel.is_connected() === true; 37 | })}); 38 | that.then(function() { 39 | that.test.assert(true, "no confirmation for " + selector + " after session shutdown") 40 | }) 41 | }); 42 | 43 | }); 44 | 45 | -------------------------------------------------------------------------------- /notebook/static/notebook/js/codemirror-ipython.js: -------------------------------------------------------------------------------- 1 | // IPython mode is just a slightly altered Python Mode with `?` beeing a extra 2 | // single operator. Here we define `ipython` mode in the require `python` 3 | // callback to auto-load python mode, which is more likely not the best things 4 | // to do, but at least the simple one for now. 5 | 6 | (function(mod) { 7 | if (typeof exports == "object" && typeof module == "object"){ // CommonJS 8 | mod(requirejs("codemirror/lib/codemirror"), 9 | requirejs("codemirror/mode/python/python") 10 | ); 11 | } else if (typeof define == "function" && define.amd){ // AMD 12 | define(["codemirror/lib/codemirror", 13 | "codemirror/mode/python/python"], mod); 14 | } else {// Plain browser env 15 | mod(CodeMirror); 16 | } 17 | })(function(CodeMirror) { 18 | "use strict"; 19 | 20 | CodeMirror.defineMode("ipython", function(conf, parserConf) { 21 | var pythonConf = {}; 22 | for (var prop in parserConf) { 23 | if (parserConf.hasOwnProperty(prop)) { 24 | pythonConf[prop] = parserConf[prop]; 25 | } 26 | } 27 | pythonConf.name = 'python'; 28 | pythonConf.singleOperators = new RegExp("^[\\+\\-\\*/%&|@\\^~<>!\\?]"); 29 | if (pythonConf.version === 3) { 30 | pythonConf.identifiers = new RegExp("^[_A-Za-z\u00A1-\uFFFF][_A-Za-z0-9\u00A1-\uFFFF]*"); 31 | } else if (pythonConf.version === 2) { 32 | pythonConf.identifiers = new RegExp("^[_A-Za-z][_A-Za-z0-9]*"); 33 | } 34 | return CodeMirror.getMode(conf, pythonConf); 35 | }, 'python'); 36 | 37 | CodeMirror.defineMIME("text/x-ipython", "ipython"); 38 | }) 39 | -------------------------------------------------------------------------------- /notebook/static/notebook/js/celltoolbarpresets/attachments.js: -------------------------------------------------------------------------------- 1 | // Copyright (c) Jupyter Development Team. 2 | // Distributed under the terms of the Modified BSD License. 3 | 4 | define([ 5 | 'notebook/js/celltoolbar', 6 | 'base/js/dialog', 7 | 'base/js/i18n' 8 | ], function(celltoolbar, dialog, i18n) { 9 | "use strict"; 10 | 11 | var CellToolbar = celltoolbar.CellToolbar; 12 | 13 | var edit_attachments_dialog = function(cell) { 14 | dialog.edit_attachments({ 15 | attachments: cell.attachments, 16 | callback: function(attachments) { 17 | cell.attachments = attachments; 18 | // Force cell refresh 19 | cell.unrender(); 20 | cell.render(); 21 | }, 22 | name: 'Cell', 23 | notebook: cell.notebook, 24 | keyboard_manager: cell.keyboard_manager 25 | }); 26 | }; 27 | 28 | var add_dialog_button = function(div, cell) { 29 | var button_container = $(div); 30 | var button = $('