Skip to content

Commit

Permalink
Merge pull request #112 from silx-kit/jupyterhub5
Browse files Browse the repository at this point in the history
Added support of Jupyterhub v5
  • Loading branch information
t20100 authored Jul 30, 2024
2 parents d7fac91 + 56d64d0 commit 07c0188
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 10 deletions.
3 changes: 3 additions & 0 deletions demo/jupyterhub_conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -95,3 +95,6 @@
c.JupyterHub.ip = "127.0.0.1"
c.JupyterHub.hub_ip = "127.0.0.1"
c.JupyterHub.port = 8000

# Demo: Allow any user
c.Authenticator.allow_all = True
6 changes: 3 additions & 3 deletions jupyterhub_moss/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
field_validator,
BaseModel,
ConfigDict,
FieldValidationInfo,
NonNegativeInt,
PositiveInt,
RootModel,
ValidationInfo,
)

# Validators


def check_match_gpu(v: Optional[int], info: FieldValidationInfo) -> Optional[int]:
def check_match_gpu(v: Optional[int], info: ValidationInfo) -> Optional[int]:
if v is not None and v > 0 and info.data.get("gpu") == "":
return 0 # GPU explicitly disabled
return v
Expand Down Expand Up @@ -69,7 +69,7 @@ class JupyterEnvironment(BaseModel, frozen=True, extra="forbid"):

# validators
@field_validator("modules")
def check_path_or_mods(cls, v: str, info: FieldValidationInfo) -> str:
def check_path_or_mods(cls, v: str, info: ValidationInfo) -> str:
if not v and not info.data.get("path"):
raise ValueError("Jupyter environment path or modules is required")
return v
Expand Down
12 changes: 8 additions & 4 deletions jupyterhub_moss/templates/option_form.html
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,19 @@ <h4 class="subheading">Available resources</h4>
charset="utf-8"
></script>
<ul class="nav nav-tabs nav-justified">
<li class="active">
<a data-toggle="tab" href="#home" id="simple_tab_link">
<li class="nav-item">
<a class="nav-link active" data-bs-toggle="tab" href="#home" id="simple_tab_link" >
Simple
</a>
</li>
<li><a data-toggle="tab" href="#menu1" id="advanced_tab_link">Advanced</a></li>
<li class="nav-item">
<a class="nav-link" data-bs-toggle="tab" href="#menu1" id="advanced_tab_link">
Advanced
</a>
</li>
</ul>
<div class="tab-content">
<div id="home" class="tab-pane fade in active">
<div id="home" class="tab-pane fade show active">
<h4 class="subheading">Partition</h4>
<div class="radio-toolbar">
{% for name, partition in partitions.items() %}
Expand Down
6 changes: 3 additions & 3 deletions setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ python_requires = >=3.8
install_requires =
batchspawner>=1.0
jinja2
jupyterhub
pydantic>=2.0,<3
jupyterhub>=5.0.0
pydantic>=2.4.0,<3
traitlets

[options.extras_require]
Expand All @@ -39,7 +39,7 @@ dev =
jupyter_server
mypy
pytest
pytest-asyncio
pytest-asyncio>=0.17,<0.23

# E501 (line too long) ignored
# E203 and W503 incompatible with black formatting (https://black.readthedocs.io/en/stable/compatible_configs.html#flake8)
Expand Down

0 comments on commit 07c0188

Please sign in to comment.