From 6b9986bb8efa3bb308f29133702b2f009fb38f91 Mon Sep 17 00:00:00 2001 From: martinRenou Date: Tue, 19 Dec 2023 17:51:07 +0100 Subject: [PATCH] Fix CI (Backport #221 into 1.x) (#224) * Fix CI (#221) * Remove packageManager entry * Fix for Python 3.12 * Remove use of pytest-asyncio * Fix mypy * Re-enable Python 3.11 * Don't test win/py3.12 * Fix URLs in package.json * Update yarn.lock * Revert previous commit * Remove pip --pre * Missing hub command * Issue while cherry picking * Fix * Switch to gh * Fix pip install cmd --------- Co-authored-by: David Brochart --- .github/workflows/license-header.yml | 2 +- .github/workflows/test.yml | 17 ++++++++++++----- jupyter_collaboration/handlers.py | 4 +++- package.json | 9 ++++----- packages/collaboration-extension/package.json | 6 +++--- packages/collaboration/package.json | 6 +++--- packages/docprovider/package.json | 6 +++--- pyproject.toml | 4 +++- tests/test_loaders.py | 4 ---- 9 files changed, 32 insertions(+), 26 deletions(-) diff --git a/.github/workflows/license-header.yml b/.github/workflows/license-header.yml index 1046e76c..7ed6132e 100644 --- a/.github/workflows/license-header.yml +++ b/.github/workflows/license-header.yml @@ -21,7 +21,7 @@ jobs: run: git config --global hub.protocol https - name: Checkout the branch from the PR that triggered the job - run: hub pr checkout ${{ github.event.pull_request.number }} + run: gh pr checkout ${{ github.event.pull_request.number }} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 7103dd26..47df6de7 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -71,10 +71,17 @@ jobs: fail-fast: false matrix: os: [ubuntu-latest, windows-latest, macos-latest] - python-version: ["3.8", "3.11"] - include: - - os: ubuntu-latest - python-version: "pypy-3.8" + + python-version: ["3.8", "3.11", "3.12"] + # PyPy is not supported because we use the file_id_manager. See: + # https://github.com/jupyter-server/jupyter_server_fileid/issues/44 + #include: + # - os: ubuntu-latest + # python-version: "pypy-3.8" + exclude: + - os: windows-latest + python-version: "3.12" + steps: - name: Checkout uses: actions/checkout@v3 @@ -138,7 +145,7 @@ jobs: uses: jupyterlab/maintainer-tools/.github/actions/base-setup@v1 - name: Install the Python dependencies run: | - pip install --pre -e ".[test]" + pip install -e ".[test]" - name: List installed packages run: | pip freeze diff --git a/jupyter_collaboration/handlers.py b/jupyter_collaboration/handlers.py index 01710ea5..11e7bcfe 100644 --- a/jupyter_collaboration/handlers.py +++ b/jupyter_collaboration/handlers.py @@ -107,7 +107,9 @@ async def prepare(self): await self._websocket_server.start_room(self.room) self._websocket_server.add_room(self._room_id, self.room) - return await super().prepare() + res = super().prepare() + if res is not None: + return await res def initialize( self, diff --git a/package.json b/package.json index 5fedf9af..14880488 100644 --- a/package.json +++ b/package.json @@ -8,13 +8,13 @@ "jupyterlab", "jupyterlab-extension" ], - "homepage": "https://github.com/jupyterlab/jupyter_collaboration", + "homepage": "https://github.com/jupyterlab/jupyter-collaboration", "bugs": { - "url": "https://github.com/jupyterlab/jupyter_collaboration/issues" + "url": "https://github.com/jupyterlab/jupyter-collaboration/issues" }, "repository": { "type": "git", - "url": "https://github.com/jupyterlab/jupyter_collaboration.git" + "url": "https://github.com/jupyterlab/jupyter-collaboration.git" }, "license": "BSD-3-Clause", "author": { @@ -67,6 +67,5 @@ "stylelint-prettier": "^3.0.0", "typedoc": "~0.23.28", "typescript": "~5.0.4" - }, - "packageManager": "yarn@3.5.0" + } } diff --git a/packages/collaboration-extension/package.json b/packages/collaboration-extension/package.json index 4867bb54..383339fc 100644 --- a/packages/collaboration-extension/package.json +++ b/packages/collaboration-extension/package.json @@ -7,13 +7,13 @@ "jupyterlab", "jupyterlab-extension" ], - "homepage": "https://github.com/jupyterlab/jupyter_collaboration", + "homepage": "https://github.com/jupyterlab/jupyter-collaboration", "bugs": { - "url": "https://github.com/jupyterlab/jupyter_collaboration/issues" + "url": "https://github.com/jupyterlab/jupyter-collaboration/issues" }, "repository": { "type": "git", - "url": "https://github.com/jupyterlab/jupyter_collaboration.git" + "url": "https://github.com/jupyterlab/jupyter-collaboration.git" }, "license": "BSD-3-Clause", "author": "Project Jupyter", diff --git a/packages/collaboration/package.json b/packages/collaboration/package.json index 4ff9f797..c9337bff 100644 --- a/packages/collaboration/package.json +++ b/packages/collaboration/package.json @@ -2,13 +2,13 @@ "name": "@jupyter/collaboration", "version": "1.2.0", "description": "JupyterLab - Real-Time Collaboration Widgets", - "homepage": "https://github.com/jupyterlab/jupyter_collaboration", + "homepage": "https://github.com/jupyterlab/jupyter-collaboration", "bugs": { - "url": "https://github.com/jupyterlab/jupyter_collaboration/issues" + "url": "https://github.com/jupyterlab/jupyter-collaboration/issues" }, "repository": { "type": "git", - "url": "https://github.com/jupyterlab/jupyter_collaboration.git" + "url": "https://github.com/jupyterlab/jupyter-collaboration.git" }, "license": "BSD-3-Clause", "author": "Project Jupyter", diff --git a/packages/docprovider/package.json b/packages/docprovider/package.json index c939fc11..908f5b5c 100644 --- a/packages/docprovider/package.json +++ b/packages/docprovider/package.json @@ -2,13 +2,13 @@ "name": "@jupyter/docprovider", "version": "1.2.0", "description": "JupyterLab - Document Provider", - "homepage": "https://github.com/jupyterlab/jupyter_collaboration", + "homepage": "https://github.com/jupyterlab/jupyter-collaboration", "bugs": { - "url": "https://github.com/jupyterlab/jupyter_collaboration/issues" + "url": "https://github.com/jupyterlab/jupyter-collaboration/issues" }, "repository": { "type": "git", - "url": "https://github.com/jupyterlab/jupyter_collaboration.git" + "url": "https://github.com/jupyterlab/jupyter-collaboration.git" }, "license": "BSD-3-Clause", "author": "Project Jupyter", diff --git a/pyproject.toml b/pyproject.toml index fd6fd7f4..a521580b 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -47,7 +47,7 @@ test = [ "jupyter_server[test]>=2.0.0", "pytest>=7.0", "pytest-cov", - "pytest-asyncio" + "websockets" ] docs = [ "jupyterlab>=4.0.0", @@ -139,6 +139,8 @@ filterwarnings = [ "module:Jupyter is migrating its paths to use standard platformdirs:DeprecationWarning", # In PyPy/Cython: see https://github.com/yaml/pyyaml/issues/688 "ignore:can't resolve package from __spec__ or __package__, falling back on __name__ and __path__:ImportWarning", + # see https://github.com/dateutil/dateutil/issues/1314 + "ignore:.*datetime.utcfromtimestamp\\(\\) is deprecated.*:DeprecationWarning:", ] [tool.mypy] diff --git a/tests/test_loaders.py b/tests/test_loaders.py index 5c2cc14b..ba7a5a4c 100644 --- a/tests/test_loaders.py +++ b/tests/test_loaders.py @@ -7,7 +7,6 @@ from datetime import datetime from typing import Any -import pytest from jupyter_server import _tz as tz from jupyter_collaboration.loaders import FileLoader, FileLoaderMapping @@ -45,7 +44,6 @@ def save_content(self, model: dict[str, Any], path: str) -> dict: return self.model -@pytest.mark.asyncio async def test_FileLoader_with_watcher(): id = "file-4567" path = "myfile.txt" @@ -78,7 +76,6 @@ async def trigger(*args): await loader.clean() -@pytest.mark.asyncio async def test_FileLoader_without_watcher(): id = "file-4567" path = "myfile.txt" @@ -110,7 +107,6 @@ async def trigger(*args): await loader.clean() -@pytest.mark.asyncio async def test_FileLoaderMapping_with_watcher(): id = "file-4567" path = "myfile.txt"