Skip to content

Commit 2677ce7

Browse files
authored
Clean up docs build (#363)
Fixes #350
1 parent be5d1bf commit 2677ce7

File tree

2 files changed

+49
-59
lines changed

2 files changed

+49
-59
lines changed

docs/autogen_config.py

Lines changed: 0 additions & 48 deletions
This file was deleted.

docs/source/conf.py

Lines changed: 49 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -20,23 +20,18 @@
2020
HERE = osp.abspath(osp.dirname(__file__))
2121
sys.path.insert(0, osp.join(HERE, "..", ".."))
2222

23+
from jupyterlab_server import LabServerApp, _version # noqa
24+
2325
# -- Project information -----------------------------------------------------
2426

2527
project = "JupyterLab Server"
2628
copyright = "2021, Project Jupyter" # noqa
2729
author = "Project Jupyter"
2830

29-
# The full version, including alpha/beta/rc tags
30-
_version_py = osp.join(HERE, "..", "..", "jupyterlab_server", "_version.py")
31-
version_ns = {}
32-
33-
with open(_version_py) as version_file:
34-
exec(version_file.read(), version_ns) # noqa
35-
3631
# The short X.Y version.
37-
version = "%i.%i" % version_ns["version_info"][:2]
32+
version = "%i.%i" % _version.version_info[:2]
3833
# The full version, including alpha/beta/rc tags.
39-
release = version_ns["__version__"]
34+
release = _version.__version__
4035

4136
# -- General configuration ---------------------------------------------------
4237

@@ -54,6 +49,14 @@
5449
"sphinx_copybutton",
5550
]
5651

52+
try:
53+
import enchant # type:ignore # noqa
54+
55+
extensions += ["sphinxcontrib.spelling"]
56+
except ImportError:
57+
pass
58+
59+
5760
myst_enable_extensions = ["html_image"]
5861

5962
# Add any paths that contain templates here, relative to this directory.
@@ -90,9 +93,44 @@
9093
# so disable
9194
numpydoc_show_class_members = False
9295

96+
config_header = """\
97+
.. _api-full-config:
98+
99+
100+
Config file and command line options
101+
====================================
102+
103+
The JupyterLab Server can be run with a variety of command line arguments.
104+
A list of available options can be found below in the :ref:`options section
105+
<options>`.
106+
107+
Defaults for these options can also be set by creating a file named
108+
``jupyter_jupyterlab_server_config.py`` in your Jupyter folder. The Jupyter
109+
folder is in your home directory, ``~/.jupyter``.
110+
111+
To create a ``jupyter_jupyterlab_server_config.py`` file, with all the defaults
112+
commented out, you can use the following command line::
113+
114+
$ python -m jupyterlab_server --generate-config
115+
116+
117+
.. _options:
118+
119+
Options
120+
-------
121+
122+
This list of options can be generated by running the following and hitting
123+
enter::
124+
125+
$ python -m jupyterlab_server --help-all
126+
127+
"""
128+
93129

94130
def setup(app):
95131
dest = osp.join(HERE, "changelog.md")
96132
shutil.copy(osp.join(HERE, "..", "..", "CHANGELOG.md"), dest)
97-
with open(osp.join(HERE, "../autogen_config.py")) as f:
98-
exec(compile(f.read(), "../autogen_config.py", "exec"), {}) # noqa
133+
destination = osp.join(HERE, "api/app-config.rst")
134+
with open(destination, "w") as f:
135+
f.write(config_header)
136+
f.write(LabServerApp().document_config_options())

0 commit comments

Comments
 (0)