Merge pull request #6304 from blink1073/update-ci

Clean up CI
Jeremy Tuloup 4 years ago committed by GitHub
commit 22fe46f3e8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -2,16 +2,17 @@ name: Build
on:
push:
branches:
- '*'
branches: ['main']
pull_request:
branches:
- '*'
permissions:
contents:
write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
env:
PIP_DISABLE_PIP_VERSION_CHECK: 1

@ -2,14 +2,17 @@ name: Build Utilities
on:
push:
branches: '*'
branches: ['main']
pull_request:
branches: '*'
defaults:
run:
shell: bash -l {0}
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
versioning:
runs-on: ubuntu-latest

@ -1,36 +1,38 @@
name: Check Release
on:
push:
branches:
- "*"
branches: ["main"]
pull_request:
branches:
- "*"
permissions:
contents:
write
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
check_release:
runs-on: ubuntu-latest
strategy:
matrix:
group: [check_release, link_check]
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Upgrade packaging dependencies
run: |
pip install --upgrade jupyter-packaging~=0.10 --user
- name: Install Dependencies
run: |
pip install .
pip install -e .
- name: Check Release
if: ${{ matrix.group == 'check_release' }}
uses: jupyter-server/jupyter_releaser/.github/actions/check-release@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
version_spec: next
- name: Check Links
if: ${{ matrix.group == 'link_check' }}
uses: jupyter-server/jupyter_releaser/.github/actions/check-links@v1

@ -1,40 +1,23 @@
name: Docs Tests
on:
push:
branches: '*'
branches: ['main']
pull_request:
branches: '*'
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build:
runs-on: ${{ matrix.os }}-latest
strategy:
fail-fast: false
matrix:
os: [ubuntu]
python-version: [ '3.7' ]
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/checkout@v2
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
- name: Upgrade packaging dependencies
run: |
pip install --upgrade pip setuptools wheel
- name: Get pip cache dir
id: pip-cache
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v1
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
restore-keys: |
${{ runner.os }}-pip-${{ matrix.python-version }}-
${{ runner.os }}-pip-
python_version: '3.7'
- name: Install the Python dependencies
run: |
pip install -e .[test] codecov
@ -47,6 +30,6 @@ jobs:
- name: Run tests on documentation
run: |
EXIT_STATUS=0
make -C docs/ html || EXIT_STATUS=$?
make -C docs/ html SPHINXOPTS="-W" || EXIT_STATUS=$?
pytest --nbval --current-env docs || EXIT_STATUS=$?
exit $EXIT_STATUS

@ -1,6 +1,13 @@
name: UI Tests
on: [push, pull_request]
on:
push:
branches: ["main"]
pull_request:
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build:
@ -97,4 +104,4 @@ jobs:
uses: actions/upload-artifact@v2
with:
name: notebook-${{ matrix.browser }}-updated-snapshots
path: ui-tests/test
path: ui-tests/test

2
.gitignore vendored

@ -117,6 +117,8 @@ notebook/static/*
!notebook/static/favicons
notebook/labextension
notebook/schemas
docs/source/changelog.md
docs/source/contributing.md
# playwright
ui-tests/test-results

@ -151,7 +151,7 @@ Use `pip install pip --upgrade` to upgrade pip. Check pip version with
- Add missing file to manifest [#6122](https://github.com/jupyter/notebook/pull/6122) ([@afshin](https://github.com/afshin))
- Fix issue #3218 [#6108](https://github.com/jupyter/notebook/pull/6108) ([@Nazeeh21](https://github.com/Nazeeh21))
- Fix version of jupyter-packaging in pyproject.toml [#6101](https://github.com/jupyter/notebook/pull/6101) ([@frenzymadness](https://github.com/frenzymadness))
- "#element".tooltip is not a function on home page fixed. [#6070](https://github.com/jupyter/notebook/pull/6070) ([@ilayh123](https://github.com/ilayh123))
- "#element".tooltip is not a function on home page fixed. [#6070](https://github.com/jupyter/notebook/pull/6070) @ilayh123
### Maintenance and upkeep improvements
@ -1014,7 +1014,7 @@ Thanks to the following contributors:
- Peter Parente ([parente](https://github.com/parente))
- Paul Masson ([paulmasson](https://github.com/paulmasson))
- Philipp Rudiger ([philippjfr](https://github.com/philippjfr))
- Mac Knight ([Shels1909](https://github.com/Shels1909))
- Mac Knight (Shels1909)
- Hisham Elsheshtawy ([Sheshtawy](https://github.com/Sheshtawy))
- Simon Biggs ([SimonBiggs](https://github.com/SimonBiggs))
- Sunil Hari (`@sunilhari`)
@ -1260,15 +1260,11 @@ user-facing changes are described here.
Files in the dashboard may now be sorted by last modified date or name
([943](https://github.com/jupyter/notebook/pull/943)):
![image](/_static/images/dashboard-sort.png)
### Cell tags
There is a new cell toolbar for adding _cell tags_
([2048](https://github.com/jupyter/notebook/pull/2048)):
![image](/_static/images/cell-tags-toolbar.png)
Cell tags are a lightweight way to customise the behaviour of tools
working with notebooks; we're working on building support for them into
tools like [nbconvert](https://nbconvert.readthedocs.io/en/latest/) and
@ -1283,21 +1279,11 @@ future releases.
The default styling for tables in the notebook has been updated
([1776](https://github.com/jupyter/notebook/pull/1776)).
Before:
![image](/_static/images/table-style-before.png)
After:
![image](/_static/images/table-style-after.png)
### Customise keyboard shortcuts
You can now edit keyboard shortcuts for _Command Mode_ within the UI
([1347](https://github.com/jupyter/notebook/pull/1347)):
![image](/_static/images/shortcut-editor.png)
See the `Help > Edit Keyboard Shortcuts` menu item and follow the
instructions.
@ -1333,8 +1319,7 @@ instructions.
- Load server extensions with ConfigManager so that merge happens
recursively, unlike normal config values, to make it load more
consistently with frontend extensions([2108](https://github.com/jupyter/notebook/pull/2108)).
- The notebook server now supports the [bundler
API](https://jupyter-notebook.readthedocs.io/en/latest/extending/bundler_extensions.html)
- The notebook server now supports the bundler API
from the [jupyter_cms incubator
project](https://github.com/jupyter-incubator/contentmanagement) ([1579](https://github.com/jupyter/notebook/pull/1579)).
- The notebook server now provides information about kernel activity
@ -1546,9 +1531,6 @@ UI changes:
find the new location. (Click here to see a
[screencast](https://cloud.githubusercontent.com/assets/335567/10711889/59665a5a-7a3e-11e5-970f-86b89592880c.gif)
)
> ![image](/_static/images/cell-toolbar-41.png)
- Added _Restart & Run All_ to the _Kernel_ menu. Users can also bind
it to a keyboard shortcut on action
`restart-kernel-and-run-all-cells`.
@ -1558,19 +1540,13 @@ UI changes:
such as cut/copy/paste, execute, and cell type conversions apply to
all selected cells.
![image](/_static/images/multi-select-41.png)
- Added a command palette for executing Jupyter actions by name. Users
press `Cmd/Ctrl-Shift-P` or click the new command palette icon on
the toolbar.
![image](/_static/images/command-palette-41.png)
- Added a _Find and Replace_ dialog to the _Edit_ menu. Users can also
press `F` in command mode to show the dialog.
![image](/_static/images/find-replace-41.png)
Other improvements:
- Custom KernelManager methods can be Tornado coroutines, allowing

@ -75,7 +75,7 @@ jlpm run build:test
jlpm run test
```
There are also end to end tests to cover higher level user interactions, located in the [`ui-tests`](./ui-tests) folder. To run these tests:
There are also end to end tests to cover higher level user interactions, located in the `ui-tests` folder. To run these tests:
```bash
cd ui-tests

File diff suppressed because one or more lines are too long

@ -35,6 +35,9 @@ sys.path.insert(0, repo_root)
# Copy the markdown file here
shutil.copy(os.path.join(repo_root, "CHANGELOG.md"), os.path.join(here, "changelog.md"))
# Copy the contributing file here
shutil.copy(os.path.join(repo_root, "CONTRIBUTING.md"), os.path.join(here, "contributing.md"))
print("repo_root")
print("=====================")
print(repo_root)
@ -116,7 +119,7 @@ language = None
# List of patterns, relative to source directory, that match files and
# directories to ignore when looking for source files.
exclude_patterns = ['examples/Notebook/.ipynb_checkpoints']
exclude_patterns = ['examples/Notebook/.ipynb_checkpoints', 'examples/Notebook/nbpackage/*.ipynb', 'examples/Notebook/nbpackage/nbs/*.ipynb']
# The reST default role (used for this markup: `text`) to use for all
# documents.

@ -7,6 +7,5 @@ Configuration
:caption: Configuration
config_overview
config
Security <https://jupyter-server.readthedocs.io/en/stable/operators/security.html>
extending/index.rst

@ -1,3 +0,0 @@
.. highlight:: sh
.. include:: ../../CONTRIBUTING.rst

@ -1,10 +1,10 @@
=========================
Contributor Documentation
=========================
===========
Contributor
===========
.. toctree::
:maxdepth: 1
:caption: Contributor Documentation
contributing
development_faq
development_faq

@ -1,510 +0,0 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# Distributing Jupyter Extensions as Python Packages"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Overview\n",
"### How can the notebook be extended?\n",
"The Jupyter Notebook client and server application are both deeply customizable. Their behavior can be extended by creating, respectively:\n",
"\n",
"- nbextension: a notebook extension\n",
" - a single JS file, or directory of JavaScript, Cascading StyleSheets, etc. that contain at\n",
" minimum a JavaScript module packaged as an\n",
" [AMD modules](https://en.wikipedia.org/wiki/Asynchronous_module_definition)\n",
" that exports a function `load_ipython_extension`\n",
"- server extension: an importable Python module\n",
" - that implements `load_jupyter_server_extension`\n",
"- bundler extension: an importable Python module with generated File -> Download as / Deploy as menu item trigger\n",
" - that implements `bundle`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Why create a Python package for Jupyter extensions?\n",
"Since it is rare to have a server extension that does not have any frontend components (an nbextension), for convenience and consistency, all these client and server extensions with their assets can be packaged and versioned together as a Python package with a few simple commands, or as of Notebook 5.3, handled automatically by your package manager of choice. This makes installing the package of extensions easier and less error-prone for the user."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Installation of Jupyter Extensions\n",
"### Install a Python package containing Jupyter Extensions\n",
"There are several ways that you may get a Python package containing Jupyter Extensions. Commonly, you will use a package manager for your system:\n",
"```shell\n",
"pip install helpful_package\n",
"# or\n",
"conda install helpful_package\n",
"# or\n",
"apt-get install helpful_package\n",
"\n",
"# where 'helpful_package' is a Python package containing one or more Jupyter Extensions\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Automatic installation and Enabling\n",
"> New in Notebook 5.3\n",
"\n",
"The absolute simplest case requires no user interaction at all! Configured correctly, after installing with their package manager of choice, both server and frontend extensions can be enabled by default in the environment where they were installed, i.e. `--sys-prefix`. See the `setup.py` in the example below."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Enable a Server Extension\n",
"\n",
"The simplest case would be to enable a server extension which has no frontend components. \n",
"\n",
"A `pip` user that wants their configuration stored in their home directory would type the following command:\n",
"```shell\n",
"jupyter serverextension enable --py helpful_package\n",
"```\n",
"\n",
"Alternatively, a `virtualenv` or `conda` user can pass `--sys-prefix` which keeps their environment isolated and reproducible. For example:\n",
"```shell\n",
"# Make sure that your virtualenv or conda environment is activated\n",
"[source] activate my-environment\n",
"\n",
"jupyter serverextension enable --py helpful_package --sys-prefix\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Install the nbextension assets"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"If a package also has an nbextension with frontend assets that must be available (but not neccessarily enabled by default), install these assets with the following command:\n",
"```shell\n",
"jupyter nbextension install --py helpful_package # or --sys-prefix if using virtualenv or conda\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Enable nbextension assets\n",
"If a package has assets that should be loaded every time a Jupyter app (e.g. lab, notebook, dashboard, terminal) is loaded in the browser, the following command can be used to enable the nbextension:\n",
"```shell\n",
"jupyter nbextension enable --py helpful_package # or --sys-prefix if using virtualenv or conda\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Did it work? Check by listing Jupyter Extensions.\n",
"After running one or more extension installation steps, you can list what is presently known about nbextensions, server extensions, or bundler extensions. The following commands will list which extensions are available, whether they are enabled, and other extension details:\n",
"\n",
"```shell\n",
"jupyter nbextension list\n",
"jupyter serverextension list\n",
"jupyter bundlerextension list\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Additional resources on creating and distributing packages \n",
"\n",
"> Of course, in addition to the files listed, there are number of other files one needs to build a proper package. Here are some good resources:\n",
"- [The Hitchhiker's Guide to Packaging](https://the-hitchhikers-guide-to-packaging.readthedocs.io/en/latest/quickstart.html)\n",
"- [Repository Structure and Python](https://kenreitz.org/essays/2013/01/27/repository-structure-and-python) by Kenneth Reitz\n",
"\n",
"> How you distribute them, too, is important:\n",
"- [Packaging and Distributing Projects](https://python-packaging-user-guide.readthedocs.io/tutorials/distributing-packages/)\n",
"- [conda: Building packages](https://conda.io/projects/conda-build/en/latest/user-guide/tutorials/building-conda-packages.html)\n"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example - Server extension"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Creating a Python package with a server extension\n",
"\n",
"Here is an example of a python module which contains a server extension directly on itself. It has this directory structure:\n",
"```\n",
"- setup.py\n",
"- MANIFEST.in\n",
"- my_module/\n",
" - __init__.py\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Defining the server extension\n",
"This example shows that the server extension and its `load_jupyter_server_extension` function are defined in the `__init__.py` file.\n",
"\n",
"#### `my_module/__init__.py`\n",
"\n",
"```python\n",
"def _jupyter_server_extension_paths():\n",
" return [{\n",
" \"module\": \"my_module\"\n",
" }]\n",
"\n",
"\n",
"def load_jupyter_server_extension(nbapp):\n",
" nbapp.log.info(\"my module enabled!\")\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Install and enable the server extension\n",
"Which a user can install with:\n",
"```\n",
"jupyter serverextension enable --py my_module [--sys-prefix]\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example - Server extension and nbextension"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Creating a Python package with a server extension and nbextension\n",
"Here is another server extension, with a front-end module. It assumes this directory structure:\n",
"\n",
"```\n",
"- setup.py\n",
"- MANIFEST.in\n",
"- my_fancy_module/\n",
" - __init__.py\n",
" - static/\n",
" index.js\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {
"collapsed": true
},
"source": [
"### Defining the server extension and nbextension\n",
"This example again shows that the server extension and its `load_jupyter_server_extension` function are defined in the `__init__.py` file. This time, there is also a function `_jupyter_nbextension_paths` for the nbextension.\n",
"\n",
"#### `my_fancy_module/__init__.py`\n",
"\n",
"```python\n",
"def _jupyter_server_extension_paths():\n",
" return [{\n",
" \"module\": \"my_fancy_module\"\n",
" }]\n",
"\n",
"# Jupyter Extension points\n",
"def _jupyter_nbextension_paths():\n",
" return [dict(\n",
" section=\"notebook\",\n",
" # the path is relative to the `my_fancy_module` directory\n",
" src=\"static\",\n",
" # directory in the `nbextension/` namespace\n",
" dest=\"my_fancy_module\",\n",
" # _also_ in the `nbextension/` namespace\n",
" require=\"my_fancy_module/index\")]\n",
"\n",
"def load_jupyter_server_extension(nbapp):\n",
" nbapp.log.info(\"my module enabled!\")\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Install and enable the server extension and nbextension\n",
"\n",
"The user can install and enable the extensions with the following set of commands:\n",
"```\n",
"jupyter nbextension install --py my_fancy_module [--sys-prefix|--user]\n",
"jupyter nbextension enable --py my_fancy_module [--sys-prefix|--system]\n",
"jupyter serverextension enable --py my_fancy_module [--sys-prefix|--system]\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Automatically enabling a server extension and nbextension\n",
"> New in Notebook 5.3\n",
"\n",
"Server extensions and nbextensions can be installed and enabled without any user intervention or post-install scripts beyond `<package manager> install <extension package name>`"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"In addition to the `my_fancy_module` file tree, assume:\n",
"\n",
"```\n",
"jupyter-config/\n",
"├── jupyter_notebook_config.d/\n",
"│   └── my_fancy_module.json\n",
"└── nbconfig/\n",
" └── notebook.d/\n",
" └── my_fancy_module.json\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### `jupyter-config/jupyter_notebook_config.d/my_fancy_module.json`\n",
"```json\n",
"{\n",
" \"NotebookApp\": {\n",
" \"nbserver_extensions\": {\n",
" \"my_fancy_module\": true\n",
" }\n",
" }\n",
"}\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### `jupyter-config/nbconfig/notebook.d/my_fancy_module.json`\n",
"```json\n",
"{\n",
" \"load_extensions\": {\n",
" \"my_fancy_module/index\": true\n",
" }\n",
"}\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"Put all of them in place via:\n",
"\n",
"#### `setup.py`\n",
"```python\n",
"import setuptools\n",
"\n",
"setuptools.setup(\n",
" name=\"MyFancyModule\",\n",
" ...\n",
" include_package_data=True,\n",
" data_files=[\n",
" # like `jupyter nbextension install --sys-prefix`\n",
" (\"share/jupyter/nbextensions/my_fancy_module\", [\n",
" \"my_fancy_module/static/index.js\",\n",
" ]),\n",
" # like `jupyter nbextension enable --sys-prefix`\n",
" (\"etc/jupyter/nbconfig/notebook.d\", [\n",
" \"jupyter-config/nbconfig/notebook.d/my_fancy_module.json\"\n",
" ]),\n",
" # like `jupyter serverextension enable --sys-prefix`\n",
" (\"etc/jupyter/jupyter_notebook_config.d\", [\n",
" \"jupyter-config/jupyter_notebook_config.d/my_fancy_module.json\"\n",
" ])\n",
" ],\n",
" ...\n",
" zip_safe=False\n",
")\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"and last, but not least:\n",
"\n",
"#### `MANIFEST.in`\n",
"```config\n",
"recursive-include jupyter-config *.json\n",
"recursive-include my_fancy_module/static *.js\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"As most package managers will only modify their environment, the eventual configuration will be as if the user had typed:\n",
"```\n",
"jupyter nbextension install --py my_fancy_module --sys-prefix\n",
"jupyter nbextension enable --py my_fancy_module --sys-prefix\n",
"jupyter serverextension enable --py my_fancy_module --sys-prefix\n",
"```\n",
"\n",
"If a user manually `disable`s an extension, that configuration will override the bundled package configuration."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"#### When automagical install fails\n",
"Note this can still fail in certain situations with `pip`, requiring manual use of `install` and `enable` commands.\n",
"\n",
"Non-python-specific package managers (e.g. `conda`, `apt`) may choose not to implement the above behavior at the `setup.py` level, having more ways to put data files in various places at build time."
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"## Example - Bundler extension"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Creating a Python package with a bundlerextension\n",
"\n",
"Here is a bundler extension that adds a *Download as -> Notebook Tarball (tar.gz)* option to the notebook *File* menu. It assumes this directory structure:\n",
"\n",
"```\n",
"- setup.py\n",
"- MANIFEST.in\n",
"- my_tarball_bundler/\n",
" - __init__.py\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### Defining the bundler extension\n",
"\n",
"This example shows that the bundler extension and its `bundle` function are defined in the `__init__.py` file.\n",
"\n",
"#### `my_tarball_bundler/__init__.py`\n",
"\n",
"```python\n",
"import tarfile\n",
"import io\n",
"import os\n",
"import nbformat\n",
"\n",
"def _jupyter_bundlerextension_paths():\n",
" \"\"\"Declare bundler extensions provided by this package.\"\"\"\n",
" return [{\n",
" # unique bundler name\n",
" \"name\": \"tarball_bundler\",\n",
" # module containing bundle function\n",
" \"module_name\": \"my_tarball_bundler\",\n",
" # human-readable menu item label\n",
" \"label\" : \"Notebook Tarball (tar.gz)\",\n",
" # group under 'deploy' or 'download' menu\n",
" \"group\" : \"download\",\n",
" }]\n",
"\n",
"\n",
"def bundle(handler, model):\n",
" \"\"\"Create a compressed tarball containing the notebook document.\n",
" \n",
" Parameters\n",
" ----------\n",
" handler : tornado.web.RequestHandler\n",
" Handler that serviced the bundle request\n",
" model : dict\n",
" Notebook model from the configured ContentManager\n",
" \"\"\"\n",
" notebook_filename = model['name']\n",
" notebook_content = nbformat.writes(model['content']).encode('utf-8')\n",
" notebook_name = os.path.splitext(notebook_filename)[0]\n",
" tar_filename = '{}.tar.gz'.format(notebook_name)\n",
" \n",
" info = tarfile.TarInfo(notebook_filename)\n",
" info.size = len(notebook_content)\n",
"\n",
" with io.BytesIO() as tar_buffer:\n",
" with tarfile.open(tar_filename, \"w:gz\", fileobj=tar_buffer) as tar:\n",
" tar.addfile(info, io.BytesIO(notebook_content))\n",
" \n",
" # Set headers to trigger browser download\n",
" handler.set_header('Content-Disposition',\n",
" 'attachment; filename=\"{}\"'.format(tar_filename))\n",
" handler.set_header('Content-Type', 'application/gzip')\n",
" \n",
" # Return the buffer value as the response\n",
" handler.finish(tar_buffer.getvalue())\n",
"```"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"See [Extending the Notebook](../../extending/index.rst) for more documentation about writing nbextensions, server extensions, and bundler extensions."
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Python 3",
"language": "python",
"name": "python3"
},
"language_info": {
"codemirror_mode": {
"name": "ipython",
"version": 3
},
"file_extension": ".py",
"mimetype": "text/x-python",
"name": "python",
"nbconvert_exporter": "python",
"pygments_lexer": "ipython3",
"version": "3.7.2"
}
},
"nbformat": 4,
"nbformat_minor": 1
}

@ -5,7 +5,7 @@ Notebook Examples
The pages in this section are all converted notebook files. You can also
`view these notebooks on nbviewer`__.
__ https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/
__ https://nbviewer.jupyter.org/github/jupyter/notebook/blob/main/
docs/source/examples/Notebook/
.. toctree::
@ -16,7 +16,6 @@ __ https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/
Running Code
Working With Markdown Cells
Custom Keyboard Shortcuts
JavaScript Notebook Extensions
Importing Notebooks
Connecting with the Qt Console
Typesetting Equations

@ -102,7 +102,7 @@ If you want to work with sensitive data in those cases,
talk to your IT or data protection staff about it.
We aim to ensure that other pages in your browser or other users on the same
computer can't access your notebook server. See :ref:`server_security` for
computer can't access your notebook server. See the `security documentation <https://jupyter-server.readthedocs.io/en/stable/operators/security.html>`__ for
more about this.
@ -234,7 +234,7 @@ drop-down on the toolbar (which will be "Code", initially), or via
For more information on the different things you can do in a notebook,
see the `collection of examples
<https://nbviewer.jupyter.org/github/jupyter/notebook/tree/master/docs/source/examples/Notebook/>`_.
<https://nbviewer.jupyter.org/github/jupyter/notebook/tree/main/docs/source/examples/Notebook/>`_.
Code cells
~~~~~~~~~~
@ -397,7 +397,9 @@ at the command-line with::
$ jupyter trust mynotebook.ipynb
See :ref:`notebook_security` for more details about the trust mechanism.
See the `security documentation <https://jupyter-server.readthedocs.io/en/stable/operators/security.html>`__ for more details about the trust mechanism.
Browser Compatibility
---------------------

@ -2,7 +2,7 @@
{% macro notebooklink() -%}
`View the original notebook on nbviewer <https://nbviewer.jupyter.org/github/jupyter/notebook/blob/master/docs/{{ resources['metadata']['path'] }}/{{ resources['metadata']['name'] | replace(' ', '%20') }}.ipynb>`__
`View the original notebook on nbviewer <https://nbviewer.jupyter.org/github/jupyter/notebook/blob/main/docs/{{ resources['metadata']['path'] }}/{{ resources['metadata']['name'] | replace(' ', '%20') }}.ipynb>`__
{%- endmacro %}

@ -81,6 +81,9 @@
"options": {
"version-cmd": [
"jlpm run release:bump --force --skip-commit"
],
"ignore-links": [
"https://playwright.dev/docs/test-cli/"
]
},
"skip": [

Loading…
Cancel
Save