Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compatibility with Notebook7 and jupyterLab4 #1684

Merged
merged 27 commits into from
Jul 18, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
509c3ef
Update dependencies to jupyterlab>=4, fix menu entries and fix mathja…
brichet Jul 19, 2022
7a2c9da
Includes assignment-list, course-list and formgrader extensions as ma…
brichet Jul 19, 2022
54a415c
Remove required dependency to LabShell
brichet Jul 20, 2022
73842d7
Make it work with Notebook7 and JupyterLab4
brichet Oct 14, 2022
98a8464
update dependencies
brichet Oct 14, 2022
b5830f9
Refactore create_assignment_extension to depend on CellModel instead …
brichet Oct 26, 2022
3269a13
Update the tests according to the updates of JupyterLab
brichet Oct 26, 2022
d419d43
Reintegrate the cellPrompt in create assignment cell widget
brichet Oct 26, 2022
cd94e84
Activate by default the new created tab in Notebook (assignment list,…
brichet Oct 28, 2022
16d7249
add test for extensions in notebook
brichet Nov 15, 2022
35949e7
Fix docs tests and insert nbextensions test in UI-tests
brichet Nov 16, 2022
0fd8ecc
Update dependencies to jupyterlab-4.0.0a32 and notebook-7.0.0a10
brichet Jan 11, 2023
1b32330
Downgrade dependency to Notebook as it breaks installation
brichet Jan 11, 2023
bb62fa4
bump to Notebook-7.0.0a10
brichet Jan 11, 2023
e835591
update dependencies
brichet Jan 11, 2023
325f0cc
Refactor the extensions for a better managment of the menu and palett…
brichet Jan 12, 2023
172ba40
Update to Jlab 4.0.0a34 and Notebook 7.0.0a13
brichet Feb 23, 2023
5ce64ae
Open the existing Formgrader tab if already loaded from courses list tab
brichet Feb 23, 2023
479a177
fix UI tests
brichet Mar 2, 2023
481143c
Removal of python 3.7 support and integration of python 3.11 in tests
brichet Mar 6, 2023
eb319ad
Update actions and node version in tests
brichet Mar 6, 2023
aa4511b
Update to jupyterlab 4.0.0a37 and notebook 7.0.0a17
brichet Mar 23, 2023
bafe724
Fix before-build-npm
brichet Mar 23, 2023
5c90603
Includes #1756
brichet Jun 12, 2023
e9b50f3
Remove nbextensions and related code
brichet Jun 15, 2023
e7ac735
Update dependencies to lab 4 released and notebook 7b.4
brichet Jun 16, 2023
71d7817
Add the playwright report as artifact
brichet Jun 16, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/check-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
group: [check_release, link_check]
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v3
- name: Base Setup
uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1
- name: Check Release
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
#
name: Test python-nbextensions-doc
name: Test python-doc

on:
pull_request:
Expand Down Expand Up @@ -29,7 +29,7 @@ jobs:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-22.04]
group: ["docs", "nbextensions", "python"]
group: ["docs", "python"]
python: ["3.8", "3.9", "3.10", "3.11"]
exclude:
- os: windows-latest
Expand All @@ -40,8 +40,6 @@ jobs:
group: docs
- python: "3.10"
group: docs
- python: "3.8"
group: nbextensions
steps:
# This is how you set an environment variable in a GitHub workflow that
# will be available in following steps as if you would used `export
Expand All @@ -52,19 +50,15 @@ jobs:
echo "GROUP=docs" >> $GITHUB_ENV
echo "TIMEOUT_MINUTES=15" >> $GITHUB_ENV
fi
if [ "${{ matrix.group }}" == "nbextensions" ]; then
echo "GROUP=nbextensions" >> $GITHUB_ENV
echo "TIMEOUT_MINUTES=25" >> $GITHUB_ENV
fi
if [ "${{ matrix.group }}" == "python" ]; then
echo "GROUP=python" >> $GITHUB_ENV
echo "TIMEOUT_MINUTES=20" >> $GITHUB_ENV
fi
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '17.x'
node-version: '18.x'
# NOTE: actions/setup-python@v2 can make use of a cache within the GitHub
# Action virtual environment and setup extremely fast. 3.9 isn't
# available in this cache as of November 2020.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# This is a GitHub workflow defining a set of jobs with a set of steps.
# ref: https://docs.github.com/en/free-pro-team@latest/actions/reference/workflow-syntax-for-github-actions
#
name: Test labextensions
name: Test extensions

on:
pull_request:
Expand All @@ -15,7 +15,7 @@ defaults:
shell: bash

jobs:
test_labextensions:
ui-test:
runs-on: ${{ matrix.os }}
timeout-minutes: 40

Expand All @@ -30,18 +30,19 @@ jobs:
matrix:
os: [windows-latest, ubuntu-22.04]
python: ["3.10", "3.11"]
group: ["labextensions", "nbextensions"]
steps:
# This is how you set an environment variable in a GitHub workflow that
# will be available in following steps as if you would used `export
# MY_ENV=my-value`.
- name: Configure environment variables from job flags
run: |
echo "GROUP=labextensions" >> $GITHUB_ENV
- uses: actions/checkout@v2
echo "GROUP=${{ matrix.group }}" >> $GITHUB_ENV
- uses: actions/checkout@v3
- name: Install node
uses: actions/setup-node@v1
uses: actions/setup-node@v3
with:
node-version: '17.x'
node-version: '18.x'
# NOTE: actions/setup-python@v2 can make use of a cache within the GitHub
# Action virtual environment and setup extremely fast. 3.9 isn't
# available in this cache as of November 2020.
Expand All @@ -52,18 +53,18 @@ jobs:
- name: Install Python dependencies
run: |
python -m pip install --upgrade pip wheel setuptools
python tasks.py install --group=labextensions
python tasks.py install --group=${{ matrix.group }}
pip freeze
- name: Install Playwright
run: |
npx playwright install
- name: Run playwright tests
run: |
python tasks.py tests --group=labextensions
python tasks.py tests --group=${{ matrix.group }}
- name: Upload Playwright Test report
if: always()
uses: actions/upload-artifact@v2
with:
name: nbgrader-playwright-tests-os_${{ matrix.os }}-python_${{ matrix.python }}
name: nbgrader-uitests-${{ matrix.group }}-${{ matrix.os }}-python${{ matrix.python }}
path: |
playwright-tests
playwright-report
5 changes: 2 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ var/
# built labextension
tsconfig.tsbuildinfo
nbgrader/labextension/
# Yarn cache
.yarn/

# PyInstaller
# Usually these files are written by a python script from a template
Expand Down Expand Up @@ -62,9 +64,6 @@ target/

# Coverage files
.coverage.*
.selenium.screenshot.png
nbgrader/tests/formgrader/selenium.screenshot.png
nbgrader/tests/nbextensions/selenium.screenshot.png

# Autogenerated docs
nbgrader/docs/build
Expand Down
1 change: 1 addition & 0 deletions .yarnrc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
nodeLinker: node-modules
15 changes: 6 additions & 9 deletions demos/restart_demo.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,19 +69,16 @@ install_nbgrader () {

# Install global extensions, and disable them globally. We will re-enable
# specific ones for different user accounts in each demo.
jupyter nbextension install --symlink --sys-prefix --py nbgrader --overwrite
jupyter nbextension disable --sys-prefix --py nbgrader
jupyter labextension develop --overwrite .
jupyter labextension disable --level=sys_prefix nbgrader/assignment-list
jupyter labextension disable --level=sys_prefix nbgrader/formgrader
jupyter labextension disable --level=sys_prefix nbgrader/course-list
jupyter labextension disable --level=sys_prefix nbgrader/create-assignment
jupyter serverextension disable --sys-prefix --py nbgrader
jupyter labextension disable --level=sys_prefix nbgrader:assignment-list
jupyter labextension disable --level=sys_prefix nbgrader:formgrader
jupyter labextension disable --level=sys_prefix nbgrader:course-list
jupyter labextension disable --level=sys_prefix nbgrader:create-assignment
jupyter server extension disable --sys-prefix --py nbgrader

# Everybody gets the validate extension, however.
jupyter nbextension enable --sys-prefix validate_assignment/main --section=notebook
jupyter labextension enable --level=sys_prefix nbgrader/validate_assignment
jupyter serverextension enable --sys-prefix nbgrader.server_extensions.validate_assignment
jupyter server extension enable --sys-prefix nbgrader.server_extensions.validate_assignment

# Reset exchange.
rm -rf "${exchange_root}"
Expand Down
26 changes: 11 additions & 15 deletions demos/utils.sh
Original file line number Diff line number Diff line change
Expand Up @@ -69,42 +69,38 @@ enable_create_assignment () {
HOME="/home/${USER}"
local runas="sudo -u ${USER}"

${runas} jupyter nbextension enable --user create_assignment/main
${runas} jupyter labextension disable --level=user nbgrader/create-assignment
${runas} jupyter labextension enable --level=user nbgrader/create-assignment
${runas} jupyter labextension disable --level=user nbgrader:create-assignment
${runas} jupyter labextension enable --level=user nbgrader:create-assignment
}

enable_formgrader () {
USER="${1}"
HOME="/home/${USER}"
local runas="sudo -u ${USER}"

${runas} jupyter nbextension enable --user formgrader/main --section=tree
${runas} jupyter labextension disable --level=user nbgrader/formgrader
${runas} jupyter labextension enable --level=user nbgrader/formgrader
${runas} jupyter serverextension enable --user nbgrader.server_extensions.formgrader
${runas} jupyter labextension disable --level=user nbgrader:formgrader
${runas} jupyter labextension enable --level=user nbgrader:formgrader
${runas} jupyter server extension enable --user nbgrader.server_extensions.formgrader
}

enable_assignment_list () {
USER="${1}"
HOME="/home/${USER}"
local runas="sudo -u ${USER}"

${runas} jupyter nbextension enable --user assignment_list/main --section=tree
${runas} jupyter labextension disable --level=user nbgrader/assignment-list
${runas} jupyter labextension enable --level=user nbgrader/assignment-list
${runas} jupyter serverextension enable --user nbgrader.server_extensions.assignment_list
${runas} jupyter labextension disable --level=user nbgrader:assignment-list
${runas} jupyter labextension enable --level=user nbgrader:assignment-list
${runas} jupyter server extension enable --user nbgrader.server_extensions.assignment_list
}

enable_course_list () {
USER="${1}"
HOME="/home/${USER}"
local runas="sudo -u ${USER}"

${runas} jupyter nbextension enable --user course_list/main --section=tree
${runas} jupyter labextension disable --level=user nbgrader/course-list
${runas} jupyter labextension enable --level=user nbgrader/course-list
${runas} jupyter serverextension enable --user nbgrader.server_extensions.course_list
${runas} jupyter labextension disable --level=user nbgrader:course-list
${runas} jupyter labextension enable --level=user nbgrader:course-list
${runas} jupyter server extension enable --user nbgrader.server_extensions.course_list
}

create_course () {
Expand Down
59 changes: 0 additions & 59 deletions nbgrader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,65 +33,6 @@ def _jupyter_server_extension_points():
"module": "nbgrader"
}]


# Classic notebook extensions
def _jupyter_nbextension_paths():
paths = [
dict(
section="notebook",
src=os.path.join('nbextensions', 'create_assignment'),
dest="create_assignment",
require="create_assignment/main"
),
dict(
section="tree",
src=os.path.join('nbextensions', 'formgrader'),
dest="formgrader",
require="formgrader/main"
),
dict(
section="notebook",
src=os.path.join('nbextensions', 'validate_assignment'),
dest="validate_assignment",
require="validate_assignment/main"
),
]

if sys.platform != 'win32':
paths.append(
dict(
section="tree",
src=os.path.join('nbextensions', 'assignment_list'),
dest="assignment_list",
require="assignment_list/main"
)
)
paths.append(
dict(
section="tree",
src=os.path.join('nbextensions', 'course_list'),
dest="course_list",
require="course_list/main"
)
)

return paths


# Classic notebook server extensions
def _jupyter_server_extension_paths():
paths = [
dict(module="nbgrader.server_extensions.formgrader"),
dict(module="nbgrader.server_extensions.validate_assignment")
]

if sys.platform != 'win32':
paths.append(dict(module="nbgrader.server_extensions.assignment_list"))
paths.append(dict(module="nbgrader.server_extensions.course_list"))

return paths


def _load_jupyter_server_extension(app):
load_assignments(app)
load_courses(app)
Expand Down
12 changes: 6 additions & 6 deletions nbgrader/docs/source/contributor_guide/releasing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,9 @@ The version number should have been changed in the following files :
- ``pyproject.toml``
- ``package.json``
- ``nbgrader/_version.py``
- ``nbgrader/nbextensions/assignment_list/main.js``
- ``nbgrader/nbextensions/course_list/main.js``
- ``nbgrader/nbextensions/validate_assignment/main.js``
- ``src/assignment_list/index.ts``
- ``src/course_list/index.ts``
- ``src/validate_assignment/index.ts``

Rebuild the documentation
-------------------------
Expand Down Expand Up @@ -173,6 +173,6 @@ As a reminder, the files concerned are :
- ``pyproject.toml``
- ``package.json``
- ``nbgrader/_version.py``
- ``nbgrader/nbextensions/assignment_list/main.js``
- ``nbgrader/nbextensions/course_list/main.js``
- ``nbgrader/nbextensions/validate_assignment/main.js``
- ``src/assignment_list/index.ts``
- ``src/course_list/index.ts``
- ``src/validate_assignment/index.ts``
Loading