Skip to content

Commit

Permalink
Merge pull request #273 from davidbrochart/fix_test
Browse files Browse the repository at this point in the history
Update python, jupyter-ydoc, y-py
  • Loading branch information
davidbrochart committed Feb 23, 2023
2 parents bb4a6a2 + f888fc9 commit cf56682
Show file tree
Hide file tree
Showing 23 changed files with 39 additions and 38 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '3.7', '3.8', '3.9', '3.10' ]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]

steps:
- name: Checkout
Expand Down
2 changes: 1 addition & 1 deletion plugins/auth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "fps_auth"
description = "An FPS plugin for the authentication API"
keywords = ["jupyter", "server", "fastapi", "pluggy", "plugins"]
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"fps[uvicorn] >=0.0.17",
"fps-lab",
Expand Down
2 changes: 1 addition & 1 deletion plugins/auth_base/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_auth_base"
description = "An FPS plugin for the authentication API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = ["fps >=0.0.17"]
dynamic = [ "version",]

Expand Down
2 changes: 1 addition & 1 deletion plugins/auth_fief/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "fps_auth_fief"
description = "An FPS plugin for the authentication API, using Fief"
keywords = ["jupyter", "server", "fastapi", "pluggy", "plugins"]
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"fief-client[fastapi]",
"fps >=0.0.8"
Expand Down
2 changes: 1 addition & 1 deletion plugins/contents/fps_contents/fileid.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ def __init__(self, db_path: str = "fileid.db"):
self.db_path = db_path
self.initialized = asyncio.Event()
self.watchers = {}
asyncio.create_task(self.watch_files())
self._watch_files_task = asyncio.create_task(self.watch_files())

async def get_id(self, path: str) -> Optional[str]:
await self.initialized.wait()
Expand Down
2 changes: 1 addition & 1 deletion plugins/contents/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_contents"
description = "An FPS plugin for the contents API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "anyio", "watchfiles >=0.16.1,<1", "aiosqlite >=0.17.0,<1", "anyio>=3.6.2,<4"]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/frontend/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_frontend"
description = "An FPS plugin for the frontend related configuration"
keywords = ["fastapi", "pluggy", "plugins", "fps"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = ["fps>=0.0.8"]
dynamic = ["version"]

Expand Down
2 changes: 1 addition & 1 deletion plugins/jupyterlab/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_jupyterlab"
description = "An FPS plugin for the JupyterLab API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "fps-frontend", "fps-lab", "jupyterlab >=4.0.0a27",]
dynamic = [ "version",]
[[project.authors]]
Expand Down
7 changes: 7 additions & 0 deletions plugins/kernels/fps_kernels/kernel_driver/connect.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
import json
import os
import socket
import sys
import tempfile
import uuid
from typing import Dict, Optional, Tuple, Union
Expand Down Expand Up @@ -75,6 +76,12 @@ async def launch_kernel(
with open(kernelspec_path) as f:
kernelspec = json.load(f)
cmd = [s.format(connection_file=connection_file_path) for s in kernelspec["argv"]]
if cmd and cmd[0] in {
"python",
"python%i" % sys.version_info[0],
"python%i.%i" % sys.version_info[:2],
}:
cmd[0] = sys.executable
if kernel_cwd:
prev_dir = os.getcwd()
os.chdir(kernel_cwd)
Expand Down
2 changes: 1 addition & 1 deletion plugins/kernels/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_kernels"
description = "An FPS plugin for the kernels API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "fps-frontend", "fps-yjs", "pyzmq", "websockets", "python-dateutil", "watchfiles >=0.16.1,<1"]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/lab/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_lab"
description = "An FPS plugin for the JupyterLab/RetroLab API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "fps-frontend", "babel", "json5",]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/login/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_login"
description = "An FPS plugin for the login API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8",]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/nbconvert/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_nbconvert"
description = "An FPS plugin for the nbconvert API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "nbconvert",]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/noauth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "fps_noauth"
description = "An FPS plugin for an unprotected API"
keywords = ["jupyter", "server", "fastapi", "pluggy", "plugins"]
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.8"

[[project.authors]]
name = "Jupyter Development Team"
Expand Down
2 changes: 1 addition & 1 deletion plugins/resource_usage/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_resource_usage"
description = "An FPS plugin for the resource usage API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "psutil >=5.9.4", "anyio >=3.6.2", ]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/retrolab/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_retrolab"
description = "An FPS plugin for the RetroLab API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "fps-frontend", "fps-lab", "retrolab",]
dynamic = [ "version",]
[[project.authors]]
Expand Down
2 changes: 1 addition & 1 deletion plugins/terminals/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ build-backend = "hatchling.build"
name = "fps_terminals"
description = "An FPS plugin for the terminals API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "websockets", "pywinpty;platform_system=='Windows'",]
dynamic = [ "version",]
[[project.authors]]
Expand Down
6 changes: 2 additions & 4 deletions plugins/yjs/fps_yjs/routes.py
Original file line number Diff line number Diff line change
Expand Up @@ -259,14 +259,12 @@ async def clean_room(self) -> None:
self.room.document.unobserve()
self.websocket_server.delete_room(room=self.room)

def on_document_change(self, event):
try:
def on_document_change(self, target, event):
if target == "state" and "dirty" in event.keys:
dirty = event.keys["dirty"]["newValue"]
if not dirty:
# we cleared the dirty flag, nothing to save
return
except Exception:
pass
# unobserve and observe again because the structure of the document may have changed
# e.g. a new cell added to a notebook
self.room.document.unobserve()
Expand Down
11 changes: 9 additions & 2 deletions plugins/yjs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,15 @@ build-backend = "hatchling.build"
name = "fps_yjs"
description = "An FPS plugin for the Yjs API"
keywords = [ "jupyter", "server", "fastapi", "pluggy", "plugins",]
requires-python = ">=3.7"
dependencies = [ "fps >=0.0.8", "fps-auth-base", "fps-contents", "jupyter_ydoc >=0.1.16,<0.2.0", "ypy-websocket >=0.8.2,<1",]
requires-python = ">=3.8"
dependencies = [
"fps >=0.0.8",
"fps-auth-base",
"fps-contents",
"jupyter_ydoc >=0.3.0,<0.4.0",
"ypy-websocket >=0.8.2,<1",
"y-py >=0.5.9,<0.6.0",
]
dynamic = [ "version",]
[[project.authors]]
name = "Jupyter Development Team"
Expand Down
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ name = "jupyverse"
description = "A set of FPS plugins implementing a Jupyter server"
keywords = ["jupyter", "server", "fastapi", "pluggy", "plugins"]
dynamic = ["version"]
requires-python = ">=3.7"
requires-python = ">=3.8"
dependencies = [
"fastapi>=0.87.0",
"fps>=0.0.21",
Expand Down
7 changes: 3 additions & 4 deletions tests/test_kernels.py
Original file line number Diff line number Diff line change
@@ -1,17 +1,16 @@
import os
import sys
from pathlib import Path
from time import sleep

import pytest
from fps_kernels.kernel_server.server import KernelServer, kernels

os.environ["PYDEVD_DISABLE_FILE_VALIDATION"] = "1"


@pytest.mark.asyncio
@pytest.mark.parametrize("auth_mode", ("noauth",))
@pytest.mark.skipif(
sys.version_info < (3, 8) or sys.platform.startswith("win"),
reason="pytest-asyncio issue",
)
async def test_kernel_messages(client, capfd):
kernel_id = "kernel_id_0"
kernel_name = "python3"
Expand Down
7 changes: 1 addition & 6 deletions tests/test_server.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
import asyncio
import json
import sys
from pathlib import Path

import pytest
Expand Down Expand Up @@ -49,10 +48,6 @@ def test_settings_persistence_get(start_jupyverse):
@pytest.mark.asyncio
@pytest.mark.parametrize("auth_mode", ("noauth",))
@pytest.mark.parametrize("clear_users", (False,))
@pytest.mark.skipif(
sys.platform.startswith("win"),
reason="Issue with POST /api/sessions",
)
async def test_rest_api(start_jupyverse):
url = start_jupyverse
ws_url = url.replace("http", "ws", 1)
Expand Down Expand Up @@ -101,7 +96,7 @@ async def test_rest_api(start_jupyverse):
),
)
# wait for Y model to be updated
await asyncio.sleep(1)
await asyncio.sleep(0.5)
# retrieve cells
cells = ydoc.get_array("cells").to_json()
assert cells[0]["outputs"] == [
Expand Down
5 changes: 0 additions & 5 deletions tests/test_settings.py
Original file line number Diff line number Diff line change
@@ -1,16 +1,11 @@
import json
import sys

import pytest

test_theme = {"raw": '{// jupyverse test\n"theme": "JupyterLab Dark"}'}


@pytest.mark.parametrize("auth_mode", ("noauth",))
@pytest.mark.skipif(
sys.platform.startswith(("linux", "darwin")) and sys.version_info < (3, 8),
reason="pytest-asyncio issue",
)
def test_settings(client):
# get previous theme
response = client.get("/lab/api/settings/@jupyterlab/apputils-extension:themes")
Expand Down

0 comments on commit cf56682

Please sign in to comment.