|
11 | 11 | #
|
12 | 12 | # All configuration values have a default; values that are commented out
|
13 | 13 | # serve to show the default.
|
14 |
| -import logging |
15 | 14 | import os
|
16 | 15 | import os.path as osp
|
17 | 16 | import shutil
|
18 | 17 | import sys
|
19 |
| -from importlib.metadata import version |
20 |
| - |
21 |
| -from packaging.version import parse as parse_version |
22 | 18 |
|
23 | 19 | HERE = osp.abspath(osp.dirname(__file__))
|
24 |
| - |
25 |
| - |
26 |
| -# If extensions (or modules to document with autodoc) are in another directory, |
27 |
| -# add these directories to sys.path here. If the directory is relative to the |
28 |
| -# documentation root, use os.path.abspath to make it absolute, like shown here. |
29 |
| - |
30 |
| -# DEBUG for RTD |
31 |
| -log = logging.getLogger(__name__) |
32 |
| -info = log.info |
33 |
| -info("DEBUG:: sys.path") |
34 |
| -info("================") |
35 |
| -for item in sys.path: |
36 |
| - info(item) |
37 |
| - |
38 |
| -# add repo root to sys.path |
39 |
| -# here = root/docs/source |
40 |
| -here = os.path.abspath(os.path.dirname(__file__)) |
41 |
| -repo_root = os.path.dirname(os.path.dirname(here)) |
42 |
| -sys.path.insert(0, repo_root) |
43 |
| - |
44 |
| -info("repo_root") |
45 |
| -info("=====================") |
46 |
| -info(repo_root) |
47 |
| - |
48 |
| -# DEBUG for post insert on RTD |
49 |
| -info("DEBUG:: Post insert to sys.path") |
50 |
| -info("===============================") |
51 |
| -for item in sys.path: |
52 |
| - info(item) |
53 |
| - |
54 |
| -# Check if docs are being built by ReadTheDocs |
55 |
| -# If so, generate a config.rst file and populate it with documentation about |
56 |
| -# configuration options |
57 |
| - |
58 |
| -if os.environ.get("READTHEDOCS", ""): |
59 |
| - |
60 |
| - # Readthedocs doesn't run our Makefile, so we do this to force it to generate |
61 |
| - # the config docs. |
62 |
| - with open("../autogen_config.py") as f: |
63 |
| - exec(compile(f.read(), "../autogen_config.py", "exec"), {}) # noqa |
| 20 | +sys.path.insert(0, osp.join(HERE, "..", "")) |
| 21 | +from jupyter_server._version import version_info |
64 | 22 |
|
65 | 23 | # -- General configuration ------------------------------------------------
|
66 | 24 |
|
|
119 | 77 | # |version| and |release|, also used in various other places throughout the
|
120 | 78 | # built documents.
|
121 | 79 | #
|
122 |
| -__version__ = version("jupyter_server") |
123 | 80 | # The short X.Y version.
|
124 |
| -version_parsed = parse_version(__version__) |
125 |
| -version = f"{version_parsed.major}.{version_parsed.minor}" # type:ignore |
| 81 | +version = f"{version_info[0]}.{version_info[1]}" |
126 | 82 |
|
127 | 83 | # The language for content autogenerated by Sphinx. Refer to documentation
|
128 | 84 | # for a list of supported languages.
|
|
382 | 338 | # import before any doc is built, so _ is guaranteed to be injected
|
383 | 339 | import jupyter_server.transutils # noqa: F401
|
384 | 340 |
|
| 341 | +CONFIG_HEADER = """\ |
| 342 | +.. _other-full-config: |
| 343 | +
|
| 344 | +
|
| 345 | +Config file and command line options |
| 346 | +==================================== |
| 347 | +
|
| 348 | +The Jupyter Server can be run with a variety of command line arguments. |
| 349 | +A list of available options can be found below in the :ref:`options section |
| 350 | +<options>`. |
| 351 | +
|
| 352 | +Defaults for these options can also be set by creating a file named |
| 353 | +``jupyter_server_config.py`` in your Jupyter folder. The Jupyter |
| 354 | +folder is in your home directory, ``~/.jupyter``. |
| 355 | +
|
| 356 | +To create a ``jupyter_server_config.py`` file, with all the defaults |
| 357 | +commented out, you can use the following command line:: |
| 358 | +
|
| 359 | + $ jupyter server --generate-config |
| 360 | +
|
| 361 | +
|
| 362 | +.. _options: |
| 363 | +
|
| 364 | +Options |
| 365 | +------- |
| 366 | +
|
| 367 | +This list of options can be generated by running the following and hitting |
| 368 | +enter:: |
| 369 | +
|
| 370 | + $ jupyter server --help-all |
| 371 | +
|
| 372 | +""" |
| 373 | + |
385 | 374 |
|
386 | 375 | def setup(app):
|
387 | 376 | dest = osp.join(HERE, "other", "changelog.md")
|
388 | 377 | shutil.copy(osp.join(HERE, "..", "..", "CHANGELOG.md"), dest)
|
| 378 | + |
| 379 | + # Generate full-config docs. |
| 380 | + from jupyter_server.serverapp import ServerApp |
| 381 | + |
| 382 | + destination = os.path.join(HERE, "other/full-config.rst") |
| 383 | + with open(destination, "w") as f: |
| 384 | + f.write(CONFIG_HEADER) |
| 385 | + f.write(ServerApp().document_config_options()) |
0 commit comments