Skip to content

Commit

Permalink
Update FastAPI-Users v13.0.0 (#395)
Browse files Browse the repository at this point in the history
* Update FastAPI-Users v13.0.0

* Test Python 3.12

* Drop pkg_resources for entry points
  • Loading branch information
davidbrochart authored Apr 9, 2024
1 parent 0c07b8d commit 66aac71
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 10 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: '3.11'
python-version: '3.12'
cache: 'pip'
- name: Install hatch
run: |
Expand All @@ -43,7 +43,7 @@ jobs:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: [ '3.8', '3.9', '3.10', '3.11' ]
python-version: [ '3.8', '3.9', '3.10', '3.11', '3.12' ]

steps:
- name: Checkout
Expand Down
9 changes: 7 additions & 2 deletions jupyverse_api/jupyverse_api/cli.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,14 @@
import sys
from typing import List, Tuple

import pkg_resources
import rich_click as click
from asphalt.core.cli import run

if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points


@click.command() # type: ignore
@click.option(
Expand Down Expand Up @@ -72,7 +77,7 @@ def main(
def get_config(disable: Tuple[str, ...]) -> str:
jupyverse_components = [
ep.name
for ep in pkg_resources.iter_entry_points(group="jupyverse.components")
for ep in entry_points(group="jupyverse.components")
if ep.name not in disable
]

Expand Down
1 change: 1 addition & 0 deletions jupyverse_api/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ classifiers = [
"Programming Language :: Python :: Implementation :: PyPy",
]
dependencies = [
"importlib_metadata >=3.6; python_version<'3.10'",
"pydantic >=2,<3",
"fastapi >=0.95.0,<1",
"rich-click >=1.6.1,<2",
Expand Down
2 changes: 1 addition & 1 deletion plugins/auth/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ dynamic = ["version"]
requires-python = ">=3.8"
dependencies = [
"aiosqlite",
"fastapi-users[sqlalchemy,oauth] >=12,<13",
"fastapi-users[sqlalchemy,oauth] >=13.0.0,<14.0.0",
"jupyverse-api >=0.1.2,<1",
]

Expand Down
11 changes: 8 additions & 3 deletions plugins/lab/fps_lab/routes.py
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import json
import logging
import os
import sys
from glob import glob
from http import HTTPStatus
from pathlib import Path
from typing import List, Optional, Tuple

import json5 # type: ignore
import pkg_resources
from babel import Locale
from fastapi import Response, status
from fastapi.responses import FileResponse, RedirectResponse
Expand All @@ -19,6 +19,11 @@
from jupyverse_api.jupyterlab import JupyterLabConfig
from jupyverse_api.lab import Lab

if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points

logger = logging.getLogger("lab")


Expand Down Expand Up @@ -79,7 +84,7 @@ async def get_translations(self, user: User):
"nativeName": native_name,
}
}
for ep in pkg_resources.iter_entry_points(group="jupyterlab.languagepack"):
for ep in entry_points(group="jupyterlab.languagepack"):
locale = Locale.parse(ep.name)
data[ep.name] = {
"displayName": display_name,
Expand All @@ -96,7 +101,7 @@ async def get_translation(
self.locale = language
return {}

for ep in pkg_resources.iter_entry_points(group="jupyterlab.languagepack"):
for ep in entry_points(group="jupyterlab.languagepack"):
if ep.name == language:
break
else:
Expand Down
1 change: 1 addition & 0 deletions plugins/lab/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "An FPS plugin for the JupyterLab/Notebook API"
keywords = ["jupyter", "server", "fastapi", "plugins"]
requires-python = ">=3.8"
dependencies = [
"importlib_metadata >=3.6; python_version<'3.10'",
"babel",
"json5",
"jupyverse-api >=0.1.2,<1",
Expand Down
9 changes: 7 additions & 2 deletions plugins/yjs/fps_yjs/ywidgets/widgets.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import sys
from typing import Any

import pkg_resources
from pycrdt import TransactionEvent

try:
Expand All @@ -15,14 +15,19 @@
except ImportError:
ypywidgets_installed = False

if sys.version_info < (3, 10):
from importlib_metadata import entry_points
else:
from importlib.metadata import entry_points


Widgets: Any

if ypywidgets_installed:
class Widgets: # type: ignore
def __init__(self):
self.ydocs = {
ep.name: ep.load() for ep in pkg_resources.iter_entry_points(group="ypywidgets")
ep.name: ep.load() for ep in entry_points(group="ypywidgets")
}
self.widgets = {}

Expand Down
1 change: 1 addition & 0 deletions plugins/yjs/pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ description = "An FPS plugin for the Yjs API"
keywords = [ "jupyter", "server", "fastapi", "plugins" ]
requires-python = ">=3.8"
dependencies = [
"importlib_metadata >=3.6; python_version<'3.10'",
"pycrdt >=0.8.16,<0.9.0",
"jupyverse-api >=0.1.2,<1",
]
Expand Down

0 comments on commit 66aac71

Please sign in to comment.