Skip to content

Commit 8bcdf52

Browse files
authored
Add more API docs (#177)
1 parent c8f4d9c commit 8bcdf52

File tree

9 files changed

+135
-11
lines changed

9 files changed

+135
-11
lines changed

docs/source/api/handlers.rst

Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
========
2+
Handlers
3+
========
4+
5+
Module: :mod:`jupyterlab_server.handlers`
6+
=========================================
7+
8+
.. automodule:: jupyterlab_server.handlers
9+
10+
.. currentmodule:: jupyterlab_server.handlers
11+
12+
.. autoclass:: LabHandler
13+
:members:
14+
15+
.. autofunction:: add_handlers
16+
17+
.. autofunction:: is_url
18+
19+
20+
Module: :mod:`jupyterlab_server.listings_handler`
21+
=================================================
22+
23+
.. automodule:: jupyterlab_server.listings_handler
24+
25+
.. currentmodule:: jupyterlab_server.listings_handler
26+
27+
.. autoclass:: ListingsHandler
28+
:members:
29+
30+
.. autofunction:: fetch_listings
31+
32+
33+
Module: :mod:`jupyterlab_server.settings_handler`
34+
=================================================
35+
36+
.. automodule:: jupyterlab_server.settings_handler
37+
38+
.. currentmodule:: jupyterlab_server.settings_handler
39+
40+
.. autoclass:: SettingsHandler
41+
:members:
42+
43+
.. autofunction:: get_settings
44+
45+
46+
Module: :mod:`jupyterlab_server.themes_handler`
47+
=================================================
48+
49+
.. automodule:: jupyterlab_server.themes_handler
50+
51+
.. currentmodule:: jupyterlab_server.themes_handler
52+
53+
.. autoclass:: ThemesHandler
54+
:members:
55+
56+
57+
Module: :mod:`jupyterlab_server.translations_handler`
58+
=====================================================
59+
60+
.. automodule:: jupyterlab_server.translations_handler
61+
62+
.. currentmodule:: jupyterlab_server.translations_handler
63+
64+
.. autoclass:: TranslationsHandler
65+
:members:
66+
67+
.. autofunction:: get_current_locale
68+
69+
70+
Module: :mod:`jupyterlab_server.workspaces_handler`
71+
=====================================================
72+
73+
.. automodule:: jupyterlab_server.workspaces_handler
74+
75+
.. currentmodule:: jupyterlab_server.workspaces_handler
76+
77+
.. autoclass:: WorkspacesHandler
78+
:members:
79+
80+
.. autofunction:: slugify

docs/source/api/index.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,9 @@ JupyterLab Server API Reference:
88
:maxdepth: 1
99
:caption: Contents:
1010

11-
app
1211
app-config
12+
app
1313
config
14+
handlers
15+
process
1416
rest

docs/source/api/process.rst

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
=======
2+
Process
3+
=======
4+
5+
Module: :mod:`jupyterlab_server.process`
6+
========================================
7+
8+
.. automodule:: jupyterlab_server.process
9+
10+
.. currentmodule:: jupyterlab_server.process
11+
12+
.. autoclass:: Process
13+
:members:
14+
15+
.. autoclass:: WatchHelper
16+
:members:
17+
18+
.. autofunction:: which
19+
20+
21+
Module: :mod:`jupyterlab_server.process_app`
22+
============================================
23+
24+
.. automodule:: jupyterlab_server.process_app
25+
26+
.. currentmodule:: jupyterlab_server.process_app
27+
28+
:class:`ProcessApp`
29+
-------------------
30+
31+
.. autoconfigurable:: ProcessApp

docs/source/conf.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@
4343
# ones.
4444
extensions = [
4545
'myst_parser',
46+
'numpydoc',
4647
'autodoc_traits',
4748
'sphinx.ext.autodoc',
4849
'sphinx.ext.intersphinx',
@@ -71,20 +72,22 @@
7172
#
7273
html_theme = "pydata_sphinx_theme"
7374

74-
# Add any paths that contain custom static files (such as style sheets) here,
75-
# relative to this directory. They are copied after the builtin static files,
76-
# so a file named "default.css" will overwrite the builtin "default.css".
77-
html_static_path = ['_static']
75+
# Add an Edit this Page button
76+
html_theme_options = {
77+
"use_edit_page_button": True,
78+
}
7879

7980
# Output for github to be used in links
8081
html_context = {
81-
"display_github": True, # Integrate GitHub
8282
"github_user": "jupyterlab", # Username
8383
"github_repo": "jupyterlab_server", # Repo name
8484
"github_version": "master", # Version
85-
"conf_py_path": "/docs/source/", # Path in the checkout to the docs root
85+
"doc_path": "/docs/source/", # Path in the checkout to the docs root
8686
}
8787

88+
# This option generates errors when methods do not have docstrings,
89+
# so disable
90+
numpydoc_show_class_members = False
8891

8992
def setup(app):
9093
dest = osp.join(HERE, 'changelog.md')

jupyterlab_server/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,8 @@ def get_federated_extensions(labextensions_path):
6969
def get_static_page_config(app_settings_dir=None, logger=None, level='all'):
7070
"""Get the static page config for JupyterLab
7171
72-
Params
73-
------
72+
Parameters
73+
----------
7474
logger: logger, optional
7575
An optional logging object
7676
level: string, optional ['all']

jupyterlab_server/handlers.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,7 @@ class LabHandler(ExtensionHandlerJinjaMixin, ExtensionHandlerMixin, JupyterHandl
5959
@web.authenticated
6060
@web.removeslash
6161
def get(self, mode = None, workspace = None, tree = None):
62+
"""Get the JupyterLab html page."""
6263
workspace = 'default' if workspace is None else workspace.replace('/workspaces/','')
6364
tree_path = '' if tree is None else tree.replace('/tree/','')
6465

jupyterlab_server/listings_handler.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515

1616
def fetch_listings(logger):
17+
"""Fetch the listings for the extension manager."""
1718
if not logger:
1819
from traitlets import log
1920
logger = log.get_logger()
@@ -68,6 +69,7 @@ class ListingsHandler(APIHandler):
6869

6970

7071
def get(self, path):
72+
"""Get the listings for the extension manager."""
7173
self.set_header('Content-Type', 'application/json')
7274
if path == LISTINGS_URL_SUFFIX:
7375
self.write(ListingsHandler.listings)

jupyterlab_server/settings_handler.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ def get_settings(app_settings_dir, schemas_dir, settings_dir, schema_name="", ov
299299
The first item is a dictionary with a list of setting if no `schema_name`
300300
was provided, otherwise it is a dictionary with id, raw, scheme, settings
301301
and version keys. The second item is a list of warnings. Warnings will
302-
either be a list of i) strings with the warning messages or ii) `None`s.
302+
either be a list of i) strings with the warning messages or ii) `None`.
303303
"""
304304
result = {}
305305
warnings = []
@@ -342,6 +342,7 @@ def initialize(self, name, app_settings_dir, schemas_dir, settings_dir, labexten
342342

343343
@web.authenticated
344344
def get(self, schema_name=""):
345+
"""Get setting(s)"""
345346
result, warnings = get_settings(
346347
self.app_settings_dir,
347348
self.schemas_dir,
@@ -360,6 +361,7 @@ def get(self, schema_name=""):
360361

361362
@web.authenticated
362363
def put(self, schema_name):
364+
"""Update a setting"""
363365
overrides = self.overrides
364366
schemas_dir = self.schemas_dir
365367
settings_dir = self.settings_dir

jupyterlab_server/workspaces_handler.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -101,14 +101,15 @@ def initialize(self, name, path, workspaces_url=None, **kwargs):
101101
self.workspaces_dir = path
102102

103103
def ensure_directory(self):
104-
"""Return the workspaces directory if set or raise error if not set."""
104+
"""Return the workspaces directory if set or raise error if not set"""
105105
if not self.workspaces_dir:
106106
raise web.HTTPError(500, 'Workspaces directory is not set')
107107

108108
return self.workspaces_dir
109109

110110
@web.authenticated
111111
def delete(self, space_name):
112+
"""Remove a workspace"""
112113
directory = self.ensure_directory()
113114

114115
if not space_name:
@@ -129,6 +130,7 @@ def delete(self, space_name):
129130

130131
@web.authenticated
131132
def get(self, space_name=''):
133+
"""Get workspace(s) data"""
132134
directory = self.ensure_directory()
133135

134136
if not space_name:
@@ -153,6 +155,7 @@ def get(self, space_name=''):
153155

154156
@web.authenticated
155157
def put(self, space_name=''):
158+
"""Update workspace data"""
156159
if not space_name:
157160
raise web.HTTPError(400, 'Workspace name is required for PUT.')
158161

0 commit comments

Comments
 (0)