Skip to content

Commit

Permalink
Clean-up ServerProcess doc
Browse files Browse the repository at this point in the history
  • Loading branch information
manics committed Oct 27, 2024
1 parent f8d431a commit fef3695
Showing 1 changed file with 26 additions and 21 deletions.
47 changes: 26 additions & 21 deletions jupyter_server_proxy/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,12 +77,13 @@ def _default_path_info(self):


class ServerProcess(Configurable):
name = Unicode(help="Name").tag(config=True)
name = Unicode(help="Name of the server").tag(config=True)

command = List(
Unicode(),
help="""\
help="""
An optional list of strings that should be the full command to be executed.
The optional template arguments {{port}}, {{unix_socket}} and {{base_url}}
The optional template arguments ``{port}``, ``{unix_socket}`` and ``{base_url}``
will be substituted with the port or Unix socket path the process should
listen on and the base-url of the notebook.
Expand All @@ -97,9 +98,9 @@ class ServerProcess(Configurable):
environment = Union(
[Dict(Unicode()), Callable()],
default_value={},
help="""\
help="""
A dictionary of environment variable mappings. As with the command
traitlet, {{port}}, {{unix_socket}} and {{base_url}} will be substituted.
traitlet, ``{port}``, ``{unix_socket}`` and ``{base_url}`` will be substituted.
Could also be a callable. It should return a dictionary.
""",
Expand All @@ -112,7 +113,7 @@ class ServerProcess(Configurable):
absolute_url = Bool(
False,
help="""
Proxy requests default to being rewritten to '/'. If this is True,
Proxy requests default to being rewritten to ``/``. If this is True,
the absolute URL will be sent to the backend instead.
""",
).tag(config=True)
Expand Down Expand Up @@ -155,24 +156,24 @@ class ServerProcess(Configurable):
Keys recognized are:
enabled
Set to True (default) to make an entry in the launchers. Set to False to have no
explicit entry.
``enabled``
Set to True (default) to make an entry in the launchers. Set to False to have no
explicit entry.
icon_path
Full path to an svg icon that could be used with a launcher. Currently only used by the
JupyterLab launcher
``icon_path``
Full path to an svg icon that could be used with a launcher. Currently only used by the
JupyterLab launcher
title
Title to be used for the launcher entry. Defaults to the name of the server if missing.
``title``
Title to be used for the launcher entry. Defaults to the name of the server if missing.
path_info
The trailing path that is appended to the user's server URL to access the proxied server.
By default it is the name of the server followed by a trailing slash.
``path_info``
The trailing path that is appended to the user's server URL to access the proxied server.
By default it is the name of the server followed by a trailing slash.
category
The category for the launcher item. Currently only used by the JupyterLab launcher.
By default it is "Notebook".
``category``
The category for the launcher item. Currently only used by the JupyterLab launcher.
By default it is "Notebook".
""",
).tag(config=True)

Expand All @@ -199,7 +200,7 @@ def _default_launcher_entry(self):
default_value={},
help="""
A dictionary of additional HTTP headers for the proxy request. As with
the command traitlet, {{port}}, {{unix_socket}} and {{base_url}} will be substituted.
the command traitlet, ``{port}``, ``{unix_socket}`` and ``{base_url}`` will be substituted.
""",
).tag(config=True)

Expand All @@ -213,6 +214,8 @@ def _default_launcher_entry(self):
``.body``, ``.headers``, ``.code``, or ``.reason`` of the ``response``
argument. For example:
.. code-block::
def dog_to_cat(response):
response.headers["I-Like"] = "tacos"
response.body = response.body.replace(b'dog', b'cat')
Expand All @@ -229,6 +232,8 @@ def dog_to_cat(response):
A list or tuple of functions can also be specified for chaining multiple
rewrites. For example:
.. code-block::
def cats_only(response, path):
if path.startswith("/cat-club"):
response.code = 403
Expand Down

0 comments on commit fef3695

Please sign in to comment.