Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions jupyter_server_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

from __future__ import annotations

import pathlib
import sys
from textwrap import dedent, indent
from warnings import warn
Expand Down Expand Up @@ -45,14 +46,22 @@ class LauncherEntry(HasTraits):
""",
)

icon_path = Unicode(
"",
icon_path = Union(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does CUnicode work? It's meant to be a casting variant of Unicode so might automatically convert Path to string.
https://traitlets.readthedocs.io/en/stable/trait_types.html#traitlets.CUnicode

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

CUnicode is a little overly permissive because it will accept anything and cast to str. I think we should generally operate as if the C casting traitlets don't exist.

[
Unicode(),
Instance(pathlib.Path),
],
default_value="",
help="""
Full path to an svg icon that could be used with a launcher. Currently only used by the
JupyterLab launcher
""",
)

@validate("icon_path")
def _validate_icon_path(self, proposal):
return str(proposal["value"])

title = Unicode(
allow_none=False,
help="""
Expand Down