Skip to content

Commit

Permalink
Merge branch 'main' into update_python
Browse files Browse the repository at this point in the history
  • Loading branch information
RRosio authored Nov 4, 2024
2 parents ee54665 + 9ae4cb1 commit 2e32db0
Show file tree
Hide file tree
Showing 17 changed files with 105 additions and 52 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Check Release
on:
push:
branches: ["master"]
branches: ["main"]
pull_request:
branches: ["*"]

Expand All @@ -14,9 +14,9 @@ jobs:
fail-fast: false
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install Python
uses: actions/setup-python@v2
uses: actions/setup-python@v5
with:
python-version: 3.9
architecture: "x64"
Expand All @@ -25,7 +25,7 @@ jobs:
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ hashFiles('setup.cfg') }}
Expand All @@ -34,7 +34,7 @@ jobs:
${{ runner.os }}-pip-
- name: Cache checked links
if: ${{ matrix.group == 'link_check' }}
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: ~/.cache/pytest-link-check
key: ${{ runner.os }}-linkcheck-${{ hashFiles('**/*.md', '**/*.rst') }}-md-links
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,12 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04]
python-version: [ '3.7' ]
python-version: [ '3.10' ]
steps:
- name: Checkout
uses: actions/checkout@v1
uses: actions/checkout@v4
- name: Install Python ${{ matrix.python-version }}
uses: actions/setup-python@v1
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
architecture: 'x64'
Expand All @@ -28,7 +28,7 @@ jobs:
run: |
echo "::set-output name=dir::$(pip cache dir)"
- name: Cache pip
uses: actions/cache@v1
uses: actions/cache@v4
with:
path: ${{ steps.pip-cache.outputs.dir }}
key: ${{ runner.os }}-pip-${{ matrix.python-version }}-${{ hashFiles('setup.py') }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/js.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,18 +18,18 @@ jobs:
- group: services
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.8
- name: Set up Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '12.x'

- name: Cache node modules
uses: actions/cache@v2
uses: actions/cache@v4
env:
cache-name: cache-node-modules
with:
Expand All @@ -42,7 +42,7 @@ jobs:
${{ runner.os }}-
- name: Cache pip on Linux
uses: actions/cache@v1
uses: actions/cache@v4
if: startsWith(runner.os, 'Linux')
with:
path: ~/.cache/pip
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/playwright.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@ jobs:
python-version: [ '3.7', '3.8', '3.9', '3.10']
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4

- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Set up Node
uses: actions/setup-node@v1
uses: actions/setup-node@v4
with:
node-version: '12.x'

Expand Down
17 changes: 9 additions & 8 deletions .github/workflows/pythonpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Testing nbclassic
on:
push:
branches:
- master
- main
pull_request:

jobs:
Expand All @@ -13,10 +13,11 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-22.04, macos-12, windows-2022]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"]
python-version: ["3.8", "3.9", "3.10", "3.11", "3.12", "3.13"]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install pip dependencies
Expand Down Expand Up @@ -48,7 +49,7 @@ jobs:
# timeout-minutes: 20
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v2
# - uses: actions/checkout@v4
# - name: Base Setup
# uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
# with:
Expand All @@ -64,7 +65,7 @@ jobs:
timeout-minutes: 20
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Install the Python dependencies
Expand All @@ -83,14 +84,14 @@ jobs:
runs-on: ubuntu-latest
timeout-minutes: 20
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Build SDist
run: |
pip install build
python -m build --sdist
- uses: actions/upload-artifact@v2
- uses: actions/upload-artifact@v4
with:
name: "sdist"
path: dist/*.tar.gz
Expand All @@ -104,7 +105,7 @@ jobs:
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Download sdist
uses: actions/download-artifact@v2
uses: actions/download-artifact@v4
- name: Install From SDist
run: |
set -ex
Expand Down
3 changes: 2 additions & 1 deletion docs/environment.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
name: nbclassic_docs
channels:
- conda-forge
- nodefaults
dependencies:
- python=3.8
- python=3.10
- pydata-sphinx-theme
- jinja2
- tornado
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@
"\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",
"- [Repository Structure and Python](https://kennethreitz.org/essays/2013/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",
Expand Down
16 changes: 16 additions & 0 deletions docs/source/nbclassic.rst
Original file line number Diff line number Diff line change
Expand Up @@ -90,3 +90,19 @@ if available at the `Jupyterlab-contrib website <https://jupyterlab-contrib.gith

.. _JEP #79: https://jupyter.org/enhancement-proposals/79-notebook-v7/notebook-v7.html

Known issues
------------

Bellow are some known bugs and issues with the NbClassic project. These are items that may be of particular interest to users
migrating from notebook to nbclassic.

1. `#140 Error using jupyter_nbextensions_configurator with nbclassic <https://github.com/jupyter/nbclassic/issues/140>`_ is a
known issue with partial fix `Support nbclassic while updating the static path <https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator/pull/141>`_
pending to be merged into the `Jupyter-contrib/jupyter_nbextensions_configurator <https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator>`_ repository.

Once a release with this fix is available, users will be able to activate the extension with the following commands::

$ pip install 'jupyter_nbextensions_configurator @ git+https://github.com/datalayer-externals/jupyter-notebook-configurator.git@fix/nbclassic#egg=jupyter_nbextensions_configurator'
$ jupyter nbclassic-extension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
$ jupyter nbclassic-extension enable --sys-prefix --py jupyter_nbextensions_configurator
$ jupyter nbclassic-serverextension enable --sys-prefix --py jupyter_nbextensions_configurator
17 changes: 0 additions & 17 deletions docs/source/nbclassic_dev_faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -72,20 +72,3 @@ NbClassic Developer FAQ
.. _`allowed organization list`: https://github.com/MeeseeksBox/MeeseeksDev/blob/master/meeseeksdev/__init__.py#L26
.. _`Jupyter Community`: https://jupyter.org/community


Known issues
------------

Bellow are some known bugs and issues with the NbClassic project. These are items that may be of particular interest to users
migrating from notebook to nbclassic.

1. `#140 Error using jupyter_nbextensions_configurator with nbclassic <https://github.com/jupyter/nbclassic/issues/140>`_ is a
known issue with partial fix `Support nbclassic while updating the static path <https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator/pull/141>`_
pending to be merged into the `Jupyter-contrib/jupyter_nbextensions_configurator <https://github.com/Jupyter-contrib/jupyter_nbextensions_configurator>`_ repository.

Once a release with this fix is available, users will be able to activate the extension with the following commands::

$ pip install 'jupyter_nbextensions_configurator @ git+https://github.com/datalayer-externals/jupyter-notebook-configurator.git@fix/nbclassic#egg=jupyter_nbextensions_configurator'
$ jupyter nbclassic-extension install --sys-prefix --py jupyter_nbextensions_configurator --overwrite
$ jupyter nbclassic-extension enable --sys-prefix --py jupyter_nbextensions_configurator
$ jupyter nbclassic-serverextension enable --sys-prefix --py jupyter_nbextensions_configurator
3 changes: 2 additions & 1 deletion nbclassic/notebookapp.py
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,7 @@ def initialize_handlers(self):
handlers.extend(load_handlers('nbclassic.tree.handlers'))
handlers.extend(load_handlers('nbclassic.notebook.handlers'))
handlers.extend(load_handlers('nbclassic.edit.handlers'))
handlers.extend(load_handlers('nbclassic.view.handlers'))
self.handlers.extend(handlers)

# Wildcard routes
Expand Down Expand Up @@ -324,7 +325,7 @@ def initialize_handlers(self):
router.add_rules(core_rules)
router.add_rules(static_handlers)
router.add_rules(final_rules)
print("""
print(r"""
_ _ _ _
| | | |_ __ __| |__ _| |_ ___
| |_| | '_ \/ _` / _` | _/ -_)
Expand Down
2 changes: 1 addition & 1 deletion nbclassic/static/notebook/js/clipboard.js
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ function paste(event) {
}
}
first_inserted.focus_cell();
event.preventDefault();
}
event.preventDefault();
}

function notebookOnlyEvent(callback) {
Expand Down
4 changes: 3 additions & 1 deletion nbclassic/tests/end_to_end/test_display_isolation.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,10 @@


from .utils import EDITOR_PAGE
import pytest
import sys


@pytest.mark.skipif(sys.version_info >= (3, 8), reason="Fails in Python 3.8+")
def test_display_isolation(notebook_frontend):
import_ln = "from IPython.core.display import HTML, SVG, display, display_svg"
notebook_frontend.edit_cell(index=0, content=import_ln)
Expand Down
1 change: 1 addition & 0 deletions nbclassic/view/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
"""Tornado handlers for viewing HTML files."""
40 changes: 40 additions & 0 deletions nbclassic/view/handlers.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#encoding: utf-8
"""Tornado handlers for viewing HTML files."""

# Copyright (c) Jupyter Development Team.
# Distributed under the terms of the Modified BSD License.

from tornado import web, gen


from jupyter_server.base.handlers import JupyterHandler, path_regex
from jupyter_server.utils import url_escape, ensure_async, url_path_join

from nbclassic import nbclassic_path


class CustomViewHandler(JupyterHandler):
"""Render HTML files within an iframe."""

@web.authenticated
@gen.coroutine
def get(self, path):
"""Get a view on a given path."""

path = path.strip('/')
exists = yield ensure_async(self.contents_manager.file_exists(path))
if not exists:
raise web.HTTPError(404, u'File does not exist: %s' % path)

basename = path.rsplit('/', 1)[-1]
file_url = url_path_join(self.base_url, "files", url_escape(path))
self.write(self.render_template('view.html',
file_url=file_url,
page_title=basename,
)
)


default_handlers = [
(r"{}/view{}".format(nbclassic_path(), path_regex), CustomViewHandler),
]
14 changes: 11 additions & 3 deletions readthedocs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,12 @@
version: 2

build:
os: ubuntu-22.04
tools:
python: "miniconda3-4.7"

conda:
file: docs/environment.yml
python:
version: 3
environment: docs/environment.yml

sphinx:
configuration: docs/source/conf.py
6 changes: 3 additions & 3 deletions setupbase.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import os
import re
import pipes
import shlex
import shutil
import sys

Expand All @@ -27,7 +27,7 @@
from subprocess import list2cmdline
else:
def list2cmdline(cmd_list):
return ' '.join(map(pipes.quote, cmd_list))
return ' '.join(map(shlex.quote, cmd_list))

#-------------------------------------------------------------------------------
# Useful globals and utility functions
Expand Down Expand Up @@ -486,7 +486,7 @@ def run(self):
try:
run(['lessc',
'--source-map',
'--include-path=%s' % pipes.quote(static),
'--include-path=%s' % shlex.quote(static),
src,
dst,
], cwd=repo_root, env=env)
Expand Down

0 comments on commit 2e32db0

Please sign in to comment.