File tree Expand file tree Collapse file tree 9 files changed +36
-48
lines changed Expand file tree Collapse file tree 9 files changed +36
-48
lines changed Original file line number Diff line number Diff line change 4545 uses : actions/checkout@v3
4646 - name : Base Setup
4747 uses : jupyterlab/maintainer-tools/.github/actions/base-setup@v1
48+ - name : Run the tests on pypy
49+ if : ${{ startsWith(matrix.python-version, 'pypy') }}
50+ run : |
51+ hatch run test:nowarn || hatch run test:nowarn --lf
4852 - name : Run the tests
53+ if : ${{ !startsWith(matrix.python-version, 'pypy') }}
4954 run : |
5055 hatch run cov:test --cov-fail-under 75 || hatch run test:test --lf
5156 - name : Coverage
Original file line number Diff line number Diff line change 3636 - id : black
3737
3838 - repo : https://github.com/charliermarsh/ruff-pre-commit
39- rev : v0.0.165
39+ rev : v0.0.181
4040 hooks :
4141 - id : ruff
4242 args : ["--fix"]
Original file line number Diff line number Diff line change 11from ._version import __version__ # noqa:F401
22
33try :
4- from . app import TerminalsExtensionApp
4+ from jupyter_server . _version import version_info
55except ModuleNotFoundError :
6- import warnings
6+ raise ModuleNotFoundError ( "Jupyter Server must be installed to use this extension." ) from None
77
8- warnings .warn ("Could not import submodules" )
8+ if int (version_info [0 ]) < 2 : # type:ignore
9+ raise RuntimeError ("Jupyter Server Terminals requires Jupyter Server 2.0+" )
10+
11+ from .app import TerminalsExtensionApp
912
1013
1114def _jupyter_server_extension_points (): # pragma: no cover
Original file line number Diff line number Diff line change 22from pathlib import Path
33from typing import Optional
44
5+ from jupyter_server .auth .decorator import authorized
6+ from jupyter_server .base .handlers import APIHandler
57from tornado import web
68
79from .base import TerminalsMixin
810
9- try :
10- from jupyter_server .auth .decorator import authorized
11- from jupyter_server .base .handlers import APIHandler
12- except ModuleNotFoundError :
13- raise ModuleNotFoundError ("Jupyter Server must be installed to use this extension." ) from None
14-
15-
1611AUTH_RESOURCE = "terminals"
1712
1813
Original file line number Diff line number Diff line change 33import sys
44from shutil import which
55
6+ from jupyter_core .utils import ensure_async
7+ from jupyter_server .extension .application import ExtensionApp
8+ from jupyter_server .transutils import trans
69from traitlets import Type
710
811from . import api_handlers , handlers
912from .terminalmanager import TerminalManager
1013
11- try :
12- from jupyter_core .utils import ensure_async
13- from jupyter_server .extension .application import ExtensionApp
14- from jupyter_server .transutils import trans
15- except ModuleNotFoundError :
16- raise ModuleNotFoundError ("Jupyter Server must be installed to use this extension." ) from None
17-
1814
1915class TerminalsExtensionApp (ExtensionApp ):
2016
Original file line number Diff line number Diff line change 1- try :
2- from jupyter_server .extension .handler import ExtensionHandlerMixin
3- except ModuleNotFoundError :
4- raise ModuleNotFoundError ("Jupyter Server must be installed to use this extension." ) from None
1+ from jupyter_server .extension .handler import ExtensionHandlerMixin
52
63
74class TerminalsMixin (ExtensionHandlerMixin ):
Original file line number Diff line number Diff line change 11"""Tornado handlers for the terminal emulator."""
22# Copyright (c) Jupyter Development Team.
33# Distributed under the terms of the Modified BSD License.
4+ from jupyter_server ._tz import utcnow
5+ from jupyter_server .auth .utils import warn_disabled_authorization
6+ from jupyter_server .base .handlers import JupyterHandler
7+ from jupyter_server .base .websocket import WebSocketMixin
48from terminado .websocket import TermSocket as BaseTermSocket
59from tornado import web
610
711from .base import TerminalsMixin
812
9- try :
10- from jupyter_server ._tz import utcnow
11- from jupyter_server .auth .utils import warn_disabled_authorization
12- from jupyter_server .base .handlers import JupyterHandler
13- from jupyter_server .base .websocket import WebSocketMixin
14- except ModuleNotFoundError :
15- raise ModuleNotFoundError ("Jupyter Server must be installed to use this extension." ) from None
16-
1713AUTH_RESOURCE = "terminals"
1814
1915
Original file line number Diff line number Diff line change 66# Distributed under the terms of the Modified BSD License.
77from datetime import timedelta
88
9+ from jupyter_server ._tz import isoformat , utcnow
10+ from jupyter_server .prometheus .metrics import ( # type:ignore[attr-defined]
11+ TERMINAL_CURRENTLY_RUNNING_TOTAL ,
12+ )
913from terminado .management import NamedTermManager
1014from tornado import web
1115from tornado .ioloop import IOLoop , PeriodicCallback
1216from traitlets import Integer
1317from traitlets .config import LoggingConfigurable
1418
15- try :
16- from jupyter_server ._tz import isoformat , utcnow
17- from jupyter_server .prometheus .metrics import ( # type:ignore[attr-defined]
18- TERMINAL_CURRENTLY_RUNNING_TOTAL ,
19- )
20- except ModuleNotFoundError :
21- raise ModuleNotFoundError ("Jupyter Server must be installed to use this extension." ) from None
22-
2319
2420class TerminalManager (LoggingConfigurable , NamedTermManager ): # type:ignore[misc]
2521 """ """
Original file line number Diff line number Diff line change @@ -55,13 +55,6 @@ docs = [
5555" sphinxcontrib_github_alt" ,
5656" sphinxemoji" ,
5757]
58- lint = [
59- " black[jupyter]>=22.6.0" ,
60- " mdformat>0.7" ,
61- " mdformat-gfm>=0.3.5" ,
62- " ruff>=0.0.156"
63- ]
64- typing = [" mypy>=0.990" ]
6558
6659[tool .hatch .version ]
6760path = " jupyter_server_terminals/_version.py"
@@ -88,12 +81,19 @@ test = "python -m pytest -vv --cov jupyter_server_terminals --cov-branch --cov-r
8881nowarn = " test -W default {args}"
8982
9083[tool .hatch .envs .typing ]
91- features = [" typing" , " test" ]
84+ features = [" test" ]
85+ dependencies = [" mypy>=0.990" ]
9286[tool .hatch .envs .typing .scripts ]
9387test = " mypy --install-types --non-interactive {args:jupyter_server_terminals tests}"
9488
9589[tool .hatch .envs .lint ]
96- features = [" lint" ]
90+ dependencies = [
91+ " black[jupyter]==22.10.0" ,
92+ " mdformat>0.7" ,
93+ " mdformat-gfm>=0.3.5" ,
94+ " ruff==0.0.181"
95+ ]
96+ detached = true
9797[tool .hatch .envs .lint .scripts ]
9898style = [
9999 " ruff {args:.}" ,
@@ -163,7 +163,7 @@ ignore = [
163163 # Line too long
164164 " E501" ,
165165 # Relative imports are banned
166- " I252 " ,
166+ " TID252 " ,
167167 # Boolean ... in function definition
168168 " FBT001" , " FBT002" ,
169169 # Module level import not at top of file
You can’t perform that action at this time.
0 commit comments