Skip to content

Commit c8f4d9c

Browse files
authored
Add cli config options documentation (#176)
* Add cli config options documentation * Update RTD config * Update autogen_config.py
1 parent 34ce153 commit c8f4d9c

File tree

6 files changed

+65
-2
lines changed

6 files changed

+65
-2
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,6 @@ __pycache__
2020

2121
# generated changelog
2222
docs/source/changelog.md
23+
24+
# generated cli docs
25+
docs/source/api/app-config.rst

docs/autogen_config.py

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/usr/bin/env python
2+
3+
import os
4+
from jupyterlab_server import LabServerApp
5+
6+
header = """\
7+
.. _api-full-config:
8+
9+
10+
Config file and command line options
11+
====================================
12+
13+
The JupyterLab Server can be run with a variety of command line arguments.
14+
A list of available options can be found below in the :ref:`options section
15+
<options>`.
16+
17+
Defaults for these options can also be set by creating a file named
18+
``jupyter_jupyterlab_server_config.py`` in your Jupyter folder. The Jupyter
19+
folder is in your home directory, ``~/.jupyter``.
20+
21+
To create a ``jupyter_jupyterlab_server_config.py`` file, with all the defaults
22+
commented out, you can use the following command line::
23+
24+
$ python -m jupyterlab_server --generate-config
25+
26+
27+
.. _options:
28+
29+
Options
30+
-------
31+
32+
This list of options can be generated by running the following and hitting
33+
enter::
34+
35+
$ python -m jupyterlab_server --help-all
36+
37+
"""
38+
# Handle local and RTD locations
39+
cwd = os.getcwd()
40+
if os.path.basename(cwd) == 'source':
41+
destination = os.path.join(cwd, 'api/app-config.rst')
42+
else:
43+
destination = os.path.join(cwd, 'source/api/app-config.rst')
44+
45+
with open(destination, 'w') as f:
46+
f.write(header)
47+
f.write(LabServerApp().document_config_options())

docs/source/api/index.rst

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,5 +9,6 @@ JupyterLab Server API Reference:
99
:caption: Contents:
1010

1111
app
12+
app-config
1213
config
1314
rest

docs/source/conf.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,6 @@
3636
# The full version, including alpha/beta/rc tags.
3737
release = version_ns['__version__']
3838

39-
4039
# -- General configuration ---------------------------------------------------
4140

4241
# Add any Sphinx extension module names here, as strings. They can be
@@ -90,3 +89,5 @@
9089
def setup(app):
9190
dest = osp.join(HERE, 'changelog.md')
9291
shutil.copy(osp.join(HERE, '..', '..', 'CHANGELOG.md'), dest)
92+
with open(osp.join(HERE, '../autogen_config.py')) as f:
93+
exec(compile(f.read(), '../autogen_config.py', 'exec'), {})

jupyterlab_server/__main__.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
2+
from jupyterlab_server.app import main
3+
import sys
4+
5+
sys.exit(main())

readthedocs.yml

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,12 @@
1-
21
version: 2
32
sphinx:
43
configuration: docs/source/conf.py
54
conda:
65
environment: docs/environment.yml
6+
python:
7+
version: 3.8
8+
install:
9+
# install jupyterlab_server itself
10+
- method: pip
11+
path: .
12+

0 commit comments

Comments
 (0)